[Fwd: Re: [Insight-users] Meta and raw Images are displayed reversally]

Stephen R. Aylward aylward@unc.edu
Tue, 10 Dec 2002 23:55:47 -0500


Hi,

This is normal.

MetaImage and raw and other readers read the data in the order it is
stored on the disk.  But different programs will display ITKImages in
different ways.

Specifically, a program may display an image with 0,0 in the upper left
of your window, or 0,0 in the lower left of your window - so, on some
display programs, your image will look right-side-up and on other it
will look up-side-down.   Certain display programs associate where 0,0
is with the file format.   MetaImage and raw are very generic formats.
   Raw does not encode where 0,0 belongs.   You can encode it in
MetaImage, but most (i.e., all) display programs don't make use of that
info.

If you are using the MetaImageViewer app or any other app that uses the
GlSliceView class, then you can hit the 'y' key while the cursor is over
the window to flip the image about the y-axis or you can call the
FlipY(true/false) member function of GlSliceView.

Hope this helps.
Stephen

Fucang Jia wrote:
 > Hi, everyone,
 >
 > I use MetaImageImporter to produce a .mhd file associated with original
 > raw format file, then use MetaImageViewer, MetaImageColorViewer,
 > ImageRegistration,
 > MutualInformationEuler2DRegistration,RawImageReaderViewer to view it,
 > but the image is reverally displayed, that is to say, the upper becomes
 > the nether, the nether becomes the upper, it seems that the file pointer
 > reads a Windows BMP file (begins from the last line). This case not only
 > happens on Windows, but also on Linux.
 >
 > The .mhd(a) images can be opened right by ImageRegistration2D,
 > RegionGrowingSegmentation2D, Curves2DExtractor, GaussianFilter2D.
 >
 > I use "RawImageReadWritePNG fixed.raw 200 300 1 fixed_new", the
 > fixed_new000.png is reversal.
 >
 > If I write a header.txt like this:
 >
 > P5
 > 200 300
 > 255
 >
 > and use "cat header.txt fixed.raw > fixed.pgm", the fixed.pgm can be
 > display normally by other image display software.
 >
 > A .mhd file is as follows:
 >
 > NDims = 2
 > DimSize = 200 300
 > ElementSpacing = 1 1
 > Position = 0 0
 > ElementByteOrderMSB = False
 > ElementType = MET_UCHAR
 > ElementDataFile = fixed.raw
 >
 > Can anyone point out why it is the case?
 >
 > Thank you very much!
 >
 > Fucang
 >
 > _________________________________________________________________
 > MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
 > http://join.msn.com/?page=features/virus
 >
 > _______________________________________________
 > Insight-users mailing list
 > Insight-users@public.kitware.com
 > http://public.kitware.com/mailman/listinfo/insight-users


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695