[Insight-users] Re: questions about byte ordering

Luis Ibanez luis.ibanez at kitware.com
Thu, 29 Jan 2004 17:20:38 -0500


Hi Soumen,

You don't have to worry or care about the Endianness
of your DICOM files.  The DICOMImageIO2 reader will
take care of converting the image pixel data from
the endianness of your file to the endianness of your
platform.

Simply load the file using a 2D ImageFilReader
if you want to load a single slice, or use the
ImageSeriesFileReader is you want to compose a
volume with multiple slices.

The rescaling and offset of the pixel data is also
done by the reader. You shouldn't be loosing any
sleep with these details. That's what the ImageIO
class is doing for you.

If you are reading CT data your image type should
be "signed short", and if you are reading PET your
image type should be "float".

Are you getting your DICOM files from a trustworthy
source ?

Have you tried visualizing these files with standard
tools such as MRIConvert or VolView ?

You can download MRIConvert from
http://lcni.uoregon.edu/~jolinda/MRIConvert

and VolView from
http://www.kitware.com/products/volview.html

If your images don't look good when loaded in
any of these two viewers, you certainly have
to go back to your image provider.



Regards,



    Luis



-------------------------

soumen dey wrote:

> Hi!!!!
> I want to a bit byte orderting in DICOM file.
>  
> I am working on winXP and my DICOM image is of big Endian type.
> Pet image has following data in the header.....
>  
> pixel representation 1.
> bits allocate 16. bits stored 16; high bit=15.
>  
> Now whole pixel data is read in a unsigned short array.
>  
> For a value,say, unsignedshort array[i]=FF7F (65407)i am doing the 
> followin.......
> swapping it....so it becomes 7FFF(32767) and putting it in float array 
> after mutiplying rescale slope and adding rescale offest.
>  
> I get good image if I store the data in unsigned array but storing data 
> in short gave very bad image. But my qs is since pixel representation is 
> 1 should not i store it in short(signed) array and then swap and then 
> multiply.
>  
> Image file reader takes Image <short ,3> as inputimagetype.
> 
>