[Insight-users] How to read and store multiple variable-length frame images?

kent williams nkwmailinglists at gmail.com
Mon Feb 12 00:58:07 EST 2007


When you write an ImageIO, you're not dealing directly with ITK images.  The
ImageIO is called by the ImageFileReader and ImageFileWriter.  Your ImageIO
class is responsible for initializing its own dimensions, spacing, pixel
type and orientation in the ReadImageInformation method.

Then, the Read function of your ImageIO class will get called to read the
file and put its data into the supplied buffer.  This is, in effect, a
linear array of pixels, organized as reported in the dimensions reported by
your ImageIO class.  If for some reason your file format doesn't arange the
pixels on disk the way that ITK expects, you will have to read the file and
rearrange the pixels appropriately when you copy them into the read buffer.

But the more usual way things work is the on-disk pixel ordering matches the
ITK ordering, so you can just read your file directly into the passed-in
buffer in the ImageIO::Read function.

ITK doesn't understand non-uniform spacing -- the spacing is given one value
per dimension.  So you need a way to pass your array of volume times out to
your application.  You can do this by using the MetaDataDictionary.

Each descendent of itk::Object has a MetaDataDictionary, including your
ImageIO class.  Anything you put in the MetaDataDictionary for the ImageIO
class will be copied out to the Image returned from itk::ImageFileReader.
So you can create a MetaDataObject templated over a vector type, and put
your volume times in the vector.  If you look at itkMetaDataObject.h, there
are some convenience template functions EncapsulateMetaData and
ExposeMetaData for adding and retrieving values from MetaDataDictionaries.

The various transform types supported by ITK don't always support dimensions
greater than three, so if you want to transform 3d sub-volumes of a 4D
Image, you pretty much have to use an ExtractImageFilter to get the volumes,
do the transformations, and then put the sub-volumes back into the 4D image.


On 2/9/07, Geoff Topping <g_topping at hotmail.com> wrote:
>
> I'm writing a custom ImageIO class to read a file format that has multiple
> 3D volumes in one file, with each volume corresponding to a different time
> frame.  I am unsure how I should store this information to be compatible
> and
> consistent with the rest if ITK...
>
> The frames are of different durations, so I can't use a single m_Spacing
> value for that dimension.  Also, I don't want the time dimension to be
> treated as if it was a spatial dimension when doing registrations on the
> volumes...  In particular, I'd like to be able to apply a spatial
> transformation to each 3D  frame volume as if it was a separate 3D image.
>
> That said, it is essentially a 4D data set, so it would seem natural to
> treat it as a 4D image, if this is possible.  I'm also not sure how to
> properly read and store multiple 3D volumes from a single ::Read() call.
>
> I haven't been able to find any indication online of how this sort of
> situation should be dealt in ITK.  Are there any existing multi-frame
> variable-duration image reading classes I can base my work off of?  Any
> help
> would be appreciated.
>
> Geoff Topping
>
> _________________________________________________________________
> Find out the restaurants participating in Winterlicious
>
> http://local.live.com/default.aspx?v=2&cp=43.658648~-79.383962&style=r&lvl=15&tilt=-90&dir=0&alt=-1000&scene=3702663&cid=7ABE80D1746919B4!1329
> >From January 26 to February 8, 2007
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070211/0d7ebb16/attachment.htm


More information about the Insight-users mailing list