[Insight-users] Q: MetaImageViewer and TripleTKID input and display differences?

Stephen R. Aylward aylward@unc.edu
Thu, 26 Sep 2002 23:57:14 -0400


Hi,

Your mhd file looks good.

You're correct that TripleTK uses a different IO method - but that 
method is not "the ITK way."

So, the easy question to answer is the upsidedown image problem - once 
you've loaded it into MetaImageViewer, just position the cursor within 
the window and type the letter y.   This will cause the image to be 
flipped about the y axis and thereby appear rightsideup.   Most medical 
images are stored "upsidedown" from what opengl considers to be the 0,0 
coordinate, so you can put a call to the GLSliceView memberfunction 
FlipY(true) in your program after an image is loaded, and most medical 
images will appear rightsideup.  For a full list of such options, press 
the h key when in that window.

About MetaImageViewer not reading your image and reporting NDims not 
defined...could you send me your .mhd file as an attachment.   I will 
try to replicate your problem - a quick look at the code doesn't make 
anything jump out for me right now...

One thing - we experienced this exact problem on an older version of the 
code on some platforms (suns I think) since the declaration for reading 
a binary file was a bit off in the opinion of those few compilers. 
This was several weeks or maybe even a few months ago.   What version of 
ITK are you using.

Thanks,
Sorry for the problems,
Stephen

Feng Ma wrote:
> Hello,
> 
>  I am playing around with the examples provided in ITK, to import my CT 
> data using metaimage format. I construct a .mhd file according to the 
> suggestions in the list.
> 
>  I was able to load the CT data into TripleTKID and display it on 2D 
> view. By scrolling images, everything looks fine. However, when I tried 
> to load it use MetaImageViewer, I got the error:
> 
> NDims required and not defined.
> MetaObject: Read: MET_Read Failed
> MetaImage: M_Read: Error parsing file
> MetaImage: Read: Cannot parse file
> Problems reading file format
> 
>  while the .mhd file looks like this:
> 
> % more LV103.mhd
> NDims = 3
> DimSize = 512 512 311
> ElementSpacing = 0.61 0.61 1.25
> Position = 0 0 0
> ElementByteOrderMSB = False
> ElementType = MET_USHORT
> HeaderSize = -1
> ElementDataFile = LIST
> LV00010300_000.dcm
> LV00010300_001.dcm
> LV00010300_002.dcm
> LV00010300_003.dcm
> 
>  Seems that TripleTKID use a special meta image IO library to read meta 
> images, different from the more general usage in MetaImageViewer. Which 
> one is better to use?
> 
>  Then I copy the code in TripleTKID into MetaImageViewer, using the 
> non-general metaimage reader provided in utilities library, as 
> TripleTKID did. This time, I was able to load the data and display it. 
> But problem is the displayed images are upside down. I checked the code, 
> both views use GLSliceView as the base class. This is my second 
> question: Why the MetaImageViewer display images differently from 
> TripleTKID? By the way, if I load simulated brainweb data, there is no 
> difference. !??
> 
>  Finally, can I have a quick guide on how to code my specific image IO 
> lib? I think I read some answers in the list, but I can not find it again.
> 
>  Thanks a lot.
> 
> Best regards,
> 
> -Feng
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> _______________________________________________
> 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