[Insight-developers] RE: [Insight-users] Byte Order Swapping? ?

Lorensen, William E (Research) lorensen@crd.ge.com
Thu, 8 May 2003 08:55:26 -0400


I fixed it. Bad code in metaUtils.h. Apparently never tested... I'll look at
the double swapping next. That is also broken.

Bill

-----Original Message-----
From: Miller, James V (Research) [mailto:millerjv@crd.ge.com]
Sent: Thursday, May 08, 2003 8:18 AM
To: 'Luis Ibanez'; Insight-developers (E-mail)
Cc: aylward@unc.edu
Subject: [Insight-developers] RE: [Insight-users] Byte Order Swapping??


Bill and I have been trying to track down a byte order problem
with the MetaImageIO.

We have a number of regression tests that use a Meta image.  If the
images were written on a Windows or Linux system, and then read on a
Solaris or Irix system, it looks like the data is not being swapped.

We don't see this often since most of the Meta images used in 
regression tests are char.  But the following link shows why it
looks like a byte swap problem (where the pixel type is float)

http://www.itk.org/Insight/Testing/Sites/esopus.crd/SunOS-5.7-c++/20030507-0
500-Nightly/Results/__Examples_Filtering_DerivativeImageFilterTest.html



> -----Original Message-----
> From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
> Sent: Wednesday, May 07, 2003 5:30 PM
> To: Neha D
> Cc: ITK Users; aylward@unc.edu
> Subject: Re: [Insight-users] Byte Order Swapping??
> 
> 
> 
> Hi Neha,
> 
> The message is probably produced by the MetaImageReader.
>  From the file:
> 
>           Insight/Utilities/MetaIO/metaImage.cxx
> 
> in line 355.
> 
> The message is just a notification, and not an error in itself.
> It actually shouldn't be printed out except when debugging the
> class. A META_DEBUG gard was just added to it.
> 
> It seems that the reader is just notifying that the swap
> took place.  If you think that your data doesn't really
> needed to be swapped then you need to edit your MetaImage
> header and change the value of
> 
> 
>        ElementByteOrderMSB
> 
> 
> About the comparision of images, you may want to take
> a look at the filter:
> 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1Difference
> ImageFilter.html
> 
> and the SquaredDifference image filter
> 
> http://www.itk.org/Insight/Doxygen/html/classitk_1_1SquaredDif
> ferenceImageFilter.html
> 
> 
> Regards,
> 
>    Luis
> 
> 
> ------------------
> 
> Neha D wrote:
> > Hi Luis,
> >  
> > Actually, I am using MetaImage Rerader for reading raw images.
> > What I do is - first read RAW image using Meta Image Reader 
> and then 
> > once image is loaded into memory, i apply different filters on it.
> > When I apply Discrete Gaussian Filter in such way, and it 
> displays this 
> > message "elementByteOrderSwapped".
> > So, want to know exactly what function creates this message.
> > Other filters such as "Gradient Magnitude Filter" does not 
> display such 
> > message.
> > Also, I want to know if there is any example which reads 
> the image and 
> > then after writing it to the disk, compares the written images with 
> > original image that was read by reader.
> >  
> > Thanks
> > Neha
> > */Luis Ibanez <luis.ibanez@kitware.com>/* wrote:
> > 
> > 
> >     Hi Neha,
> > 
> >     1) ITK does not have any endianess default.
> > 
> >     2) The DiscreteGaussianFilter does not alter
> >     the endianess of an image.
> > 
> >     3) Endianess is a property of the platform you
> >     are using.
> > 
> >     4) ITK image filters are unaware and independent
> >     of the endianess used by your platform.
> > 
> >     The only classes in ITK that deal with endianess
> >     are the ImageIO classes. Among them you seem to
> >     be using the RawImageIO class.
> > 
> >     Please *DON'T* use raw images. Raw images are
> >     dangerous due to their lack of fundamental
> >     information about the image content.
> > 
> >     If you have raw files, please write MetaImage
> >     headers for them and use the standard ITK
> >     ImageFileReader and ImageFileWriter to read
> >     and write images. This is illustrated in almost
> >     all the examples in
> > 
> >     Insight/Examples
> > 
> >     and their associated descriptions in the
> >     software guide:
> > 
> >     http://www.itk.org/ItkSoftwareGuide.pdf
> > 
> > 
> >     Regards,
> > 
> > 
> >     Luis
> > 
> > 
> > 
> >     --------------------------
> > 
> > 
> >     Neha D wrote:
> >      > Hi Luis,
> >      >
> >      > I am using "Discrete Gaussian Image Filter" on my 
> raw image which
> >     has
> >      > byte order - Big Endian. For this images, when i use 
> filter, this
> >     filter
> >      > swaps the byte order ( message : ElementbyteOrder Swapped).
> >      > But I remember somebody saying "ITK's Default byte 
> Order is Big
> >     Endian".
> >      >
> >      > Why does this filter swaps the byte order ?
> >      >
> >      > Thanks,
> >      > Neha
> >      >
> > 
> >     _______________________________________________
> >     Insight-users mailing list
> >     Insight-users@public.kitware.com
> >     http://public.kitware.com/mailman/listinfo/insight-users
> > 
> > 
> --------------------------------------------------------------
> ----------
> > Do you Yahoo!?
> > The New Yahoo! Search 
> > <http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com> - 
> > Faster. Easier. Bingo.
> 
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
> 
_______________________________________________
Insight-developers mailing list
Insight-developers@public.kitware.com
http://public.kitware.com/mailman/listinfo/insight-developers