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

Home » Public Forums » archive » need the dimensions of an array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: need the dimensions of an array [message #38803 is a reply to message #38748] Sun, 28 March 2004 23:55 Go to previous messageGo to previous message
Thomas Nehls is currently offline  Thomas Nehls
Messages: 24
Registered: March 2004
Junior Member
M. Katz wrote:

> Thomas Nehls <thomas.nehls@tu-berlin.de> wrote in message news:<c41a69$pvv$1@mamenchi.zrz.TU-Berlin.DE>...
>
>> Hi,
>>
>> using read_tiff I Read an image into a variable lets say pixel
>> interleaved (channels, columns, rows)
>>
>> now I need the number of columns and the number of rows
>>
>> like that:
>> img = READ_TIFF(file)
>> num_col = ?(img[1])
>> num_rows= ?(img[2])
>>
>> I tried SIZE(img,/Dimensions) which returns: 3, 385, 345
>> very nice! I need only the Number "385" and the "345" respectively
>> Do you understand what I want to say?
>> Thanks
>> Tom
>
>
> Since SIZE(img, /Dimensions) returns an array, you are looking to
> extract single values from the array. If you're always reading
> 3-dimensional arrays, you can do this
>
> s = SIZE(img, /Dimensions)
> width = s[1]
> height = s[2]
> depth = s[0].
>
> Or in one less step, treat the values returned by the SIZE function
> like this
> width = (SIZE(img, /Dimensions))[1]
> height = (SIZE(img, /Dimensions))[2]
> depth = (SIZE(img, /Dimensions))[0]
>
> You could also have a 2-element size array
> Nxy = (SIZE(img, /Dimensions))[1:2]
> and then access Nxy[0] for the width and Nxy[1] for the height.
>
> M. Katz

Thank you very much for your help, unfortunately and because of the Time
shifting between you and me, I needed to find a solution somehow and now
this works:

col = LONG(N_ELEMENTS(img[0,*,0]))
row = LONG(N_ELEMENTS(img[0,0,*]))

Bye
Tom
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Image structure
Next Topic: Re: Averaging quaternions

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

Current Time: Fri Oct 10 10:20:23 PDT 2025

Total time taken to generate the page: 1.04739 seconds