comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Confused about image dimensions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Confused about image dimensions [message #91075] Mon, 01 June 2015 08:27 Go to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
maybe I'm missing something very basic...
Suppose I make an image with these commands:
w = window(dimension=[600,600])
i = image(dist(600), margin=0, image_dimensions=[100,100], current=w)

The idea is that the image has 600x600 pixels, but the units are 100x100.
So each pixel (device units) has a size of 6.

If I now change the data:
i.setData, dist(300)

It turns out that the "image does not change" (in appearance) and not the 300 pixel correspond to 100 units. So that the pixel has a size of 3 units.

Can I redefine, after the setData, the image_dimensions?

I did notice that the "image_dimensions" keyword is under the "Keywords are applied only during the initial creation of the graphic." part of the help. Just looking for a way around this.

Thanks,
Helder
Re: Confused about image dimensions [message #91076 is a reply to message #91075] Mon, 01 June 2015 14:35 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, June 1, 2015 at 9:18:36 PM UTC+2, alx wrote:
> Le lundi 1 juin 2015 17:27:14 UTC+2, Helder a écrit :
>> Hi,
>> maybe I'm missing something very basic...
>> Suppose I make an image with these commands:
>> w = window(dimension=[600,600])
>> i = image(dist(600), margin=0, image_dimensions=[100,100], current=w)
>>
>> The idea is that the image has 600x600 pixels, but the units are 100x100.
>> So each pixel (device units) has a size of 6.
>>
>> If I now change the data:
>> i.setData, dist(300)
>>
>> It turns out that the "image does not change" (in appearance) and not the 300 pixel correspond to 100 units. So that the pixel has a size of 3 units.
>>
>> Can I redefine, after the setData, the image_dimensions?
>>
>> I did notice that the "image_dimensions" keyword is under the "Keywords are applied only during the initial creation of the graphic." part of the help. Just looking for a way around this.
>>
>> Thanks,
>> Helder
>
> Keywords IMAGE_DIMENSIONS and IMAGE_LOCATION are meant for replacing X and Y vectors in case of a regularly sampled image, independently on the number of pixels in the image.
> For example, qiven the array A[300,300],
> i = image(A, IMAGE_DIMENSIONS=[100,150], IMAGE_LOCATION=[20,30])
> means that the X-axis goes from 20 to 120 and Y-axis from 30 to 180.
>
> alx.

Thanks Alx.
Ok, so I think I got this. I need to use:
i.setData, dist(300), xVector, yVector

I tried this and the result puzzled me quite a bit.
Lets start from looking at what I get when I print the image object (in my case i) after creation:
IDL> i = image(dist(600), margin=0, image_dimensions=[100,100], current=w)
IDL> i
SCALE_CENTER = 50.000000 50.000000
XRANGE = 0.00000000 100.00000
YRANGE = 0.00000000 100.00000

I only left the relevant results above.
If I use dist(300) I get exactly the same result.
If I then insert a image using two vectors x and y, here is what I get:

IDL> i.setData, dist(300), cgscalevector(findgen(300),0,100, /double), cgscalevector(findgen(300),0,100, /double)

SCALE_CENTER = 50.167224 50.167224
XRANGE = 0.00000000 100.33445
YRANGE = 0.00000000 100.33445

Why is xrange not ending at 100? I would expect that because
IDL> min(cgscalevector(findgen(300),0,100, /double))
0.00000000000000000
IDL> max(cgscalevector(findgen(300),0,100, /double))
100.00000000000000

In order to get the original result, I need this:
IDL> i.setData, dist(300), cgscalevector(findgen(300),0,99.0+2.0/3d, /double), cgscalevector(findgen(300),0,99.0+2.0/3d, /double)
SCALE_CENTER = 50.000000 50.000000
XRANGE = 0.00000000 100.00000
YRANGE = 0.00000000 100.00000

With:
IDL> min(cgscalevector(findgen(300),0,99.0+2.0/3d, /double))
0.00000000000000000
IDL> max(cgscalevector(findgen(300),0,99.0+2.0/3d, /double))
99.666666666666671

Where is this missing third coming from?

Thanks,
Helder

PS: pardon my being pedantic...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Writing each filename into new line of text file
Next Topic: Modal dialog missing close button on Linux

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:53:57 PDT 2025

Total time taken to generate the page: 0.00469 seconds