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

Home » Public Forums » archive » Re: Reading 256x256x16bit images
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
Re: Reading 256x256x16bit images [message #6377] Wed, 19 June 1996 00:00
peter is currently offline  peter
Messages: 80
Registered: February 1994
Member
Jason Young (jyoung@olie.wvitcoe.wvnet.edu) wrote:
: This sounds like something I tried to do about a month ago. Except
: mine were 512x512x12bit CT scan images. Of course the relative intensities
: sould have been 0 to 4095 so the code looked like this:

: a=intarr(512,512)
: a=ishft(a,-4)
: tvscl, a

: This could create an image, but for some reason there was alot of
: noise around where the bone should have been. I have tried many different
: scaleing procedures that haven't helped. I also noticed that the data is
: chopped because the upper value is 4080. This would probably be the cause
: of the upper end noise since dence bone should be above 4080. I had to do
: the shift because of IDL being 16 bit.

Scaling by bit-shifting shouldn't make any difference, since tvscl does
the scaling anyway. How big are the files? Is each 12-bit pixel stored
in a 16-bit word on disk? Or are two 12-bit pixels stored in 3 8-bit
bytes? If the latter, you'll have to do some fancy bit-twiddling to
correctly load the image.

Finally, are you sure you don't need to byteswap the data?

Peter
Re: Reading 256x256x16bit images [message #6380 is a reply to message #6377] Wed, 19 June 1996 00:00 Go to previous message
jyoung is currently offline  jyoung
Messages: 5
Registered: May 1996
Junior Member
This sounds like something I tried to do about a month ago. Except
mine were 512x512x12bit CT scan images. Of course the relative intensities
sould have been 0 to 4095 so the code looked like this:

a=intarr(512,512)
a=ishft(a,-4)
tvscl, a

This could create an image, but for some reason there was alot of
noise around where the bone should have been. I have tried many different
scaleing procedures that haven't helped. I also noticed that the data is
chopped because the upper value is 4080. This would probably be the cause
of the upper end noise since dence bone should be above 4080. I had to do
the shift because of IDL being 16 bit.

Jason Young
EPSCoR Research Assistant
Montgomery, WV 25136

phone: 304-442-1021

e-mail: jyoung@olie.wvitcoe.wvnet.edu

http://www.wvitcoe.wvnet.edu/~jyoung
Re: Reading 256x256x16bit images [message #6400 is a reply to message #6377] Sun, 16 June 1996 00:00 Go to previous message
jsbenens is currently offline  jsbenens
Messages: 5
Registered: April 1996
Junior Member
Chris Penland <chris@erc-sparc.mc.duke.edu> wrote:
> I have been using the following commands on IDL for PowerMac:
>
> openr, 1, 'silce214.dat'
--->I assume you're correctly typing slice, not silce...
> a=assoc(1,intarr(256,256))
> b=a(1)
>
> then I get an "Encountered end of file" error.

If there's only one image in the file, You should say b=a(0).
Remember, in IDL, an array A of length n has values A(0) thru A(n-1).

> tv, b
>
> then I get something that looks nothing like my image. I have tried
> using a bytarr(256,256) and I don;t run out of file but the
> image looks like it has been checkerboarded and moved around.

Since "b" is an integer array, to use "tv" you should first scale
the values into a byte array using "BYTSCL". For example,
h=bytscl(b)
tv,h

Or use "TVSCL" to do the same thing via:
tvscl, b

If you have multiple images and want them all displayed with the
same scaling, use the keywords "max", "min", and "top" with BYTSCL.

You should probably RTFM on ASSOC, BYTSCL, TV, and TVSCL.

Hope that helps,
-Jeff.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: [Q]IDL: AXIS label alignment
Next Topic: Write to COM port from IDL/Windows?

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

Current Time: Wed Oct 08 17:41:22 PDT 2025

Total time taken to generate the page: 0.00526 seconds