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 #38807 is a reply to message #38748] Sun, 28 March 2004 15:30 Go to previous message
MKatz843 is currently offline  MKatz843
Messages: 98
Registered: March 2002
Member
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
[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: Sun Oct 12 12:09:48 PDT 2025

Total time taken to generate the page: 1.92257 seconds