[Insight-developers] Reading vector images
Stephen R. Aylward
aylward at unc.edu
Thu, 13 May 2004 10:51:01 -0400
Hi,
I think we need to think about this more for consistency.
I've traditionally distinguished multi-component images from images of
vectors. MetaImage supports multi-component images - that is, an image
of float with multiple channels per pixel. Versus an image of float_arrays.
MetaImage has been working for multi-channel images perhaps it has been
broken recently, but I know it has worked in the past ai-is.
If you make changes, please ensure backward compatibility with what has
been working in the past. We and others have been using it by
by-passing itk's IO classes and using MetaIO direct.
Thanks,
Stephen
Miller, James V (Research) wrote:
>Okay.
>
>I have part of this working now. There was a minor error in the MetaIO
>object wrt to setting ComponentType verses setting PixelType for arrays.
>
>I need to go back and check whether MetaIO writes pixel type in its header
>as META_FLOAT_ARRAY when writing vector images. I may have editted a
>meta header by hand to change a META_FLOAT to a META_FLOAT_ARRAY.
>
>However, most of bug is in the ImageFileReader and ImageIOBase. My current
>solution relies on the memory layout for a Vector<T, N> being equivalent to
>the
>memory layout of an array T[N]. If we can assume this, then I have most
>of the trivial case working (I was able to read a meta image with 2D
>vectors).
>
>One hurdle is going to be if a file has vectors of floats and the reader is
>asked to produce a vector of ints. I'll need to modify DoConvertPixelBuffer
>to handle this.
>
>Interesting that we have a number of examples that read vector images. What
>file formats were these tested on?
>
>Jim
>
>
>
>-----Original Message-----
>From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>Sent: Wednesday, May 12, 2004 7:10 PM
>To: Miller, James V (Research)
>Cc: Insight-developers (E-mail); Julien Jomier
>Subject: Re: [Insight-developers] Reading vector images
>
>
>
>Hi Jim,
>
>Yes, this is a known bug in the MetaImage reader.
>
> http://www.itk.org/Bug/bug.php?op=show&bugid=580&pos=12
>
>Although, as you pointed out, the error may actually
>be in the ImageFileReader<> class.
>
>
>If you have any hints of how to solve it,
>please go ahead :-)
>
>
>Your suggestion seem to be in the right direction.
>We certainly have a lot more types defined in
>
>
> ImageIOBase::SetPixelType()
>
>that in
>
> ImageIOBase::GetPixelType()
>
>
>They should probably be made symmetrical...
>
>
>
> Luis
>
>
>
>
>------------------------------------
>Miller, James V (Research) wrote:
>
>
>
>>I just tried to read an image of two component vectors into ITK using
>>the Meta format.
>>
>>I get all zeros.
>>
>>It looks to me that in ImageFileReader::GenerateData() there is a test for
>>
>> m_ImageIO->GetPixelType() == typeid(TOutputImage::PixelType)
>>
>>TOutputImage::PixelType should be Vector<float, 2>
>>
>>m_ImageIO->GetPixelType() returns float
>>
>>The above check for equality fails and a data conversion occurs. The
>>result is all zeros.
>>
>>It looks as though people have asked this on the list before but I did
>>not find a response.
>>I seem to recall people reading vectors as RGB pixels.
>>
>>Perhaps if I add a GetPixelType() method to MetaImageIO that checks the
>>m_PixelType to be VECTOR?
>>
>>
>>
>>
>>*Jim Miller*
>>*/_____________________________________/*
>>/Visualization & Computer Vision//
>>/GE Research/
>>/Bldg. KW, Room C218B/
>>/P.O. Box 8, Schenectady NY 12301/
>>
>>//_millerjv at research.ge.com <mailto:millerjv at research.ge.com>_/
>>
>>/_james.miller at research.ge.com_/
>>/(518) 387-4005, Dial Comm: 8*833-4005, /
>>/Cell: (518) 505-7065, Fax: (518) 387-6981/
>>
>>
>>
>>
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>
>
--
===========================================================
Dr. Stephen R. Aylward
Associate Professor of Radiology
Adjunct Associate Professor of Computer Science and Surgery
http://caddlab.rad.unc.edu
aylward at unc.edu
(919) 966-9695