[Insight-users] Creating 3D image object from a stack
Stephen R. Aylward
aylward@unc.edu
Thu, 06 Mar 2003 21:38:00 -0500
Sure.
We are working on a general solution to this problem, but in the
meantime you can use the MetaImage reader - you just need to create a
properly formated text file that describes how your data is stored - we
call such text files "MetaImage" files.
The MetaImage format supports specifying a volume as a stack of 2D files
or as a single file. In the InsightApplications directory you can use
MetaImageImporter to specify the text file that is parsed by the
MetaImage reader to compose the volume. Or you can easily specify that
text file yourself. The documentation for the MetaImage format is in
Insight/Utilities/MetaIO/doc.
Basically, the text file should look like the following
NDims = 3
DimSize = 256 256 100
ElementSpacing = 1.0 1.0 1.0
BinaryDataByteOrderMSB = true (or false if data is from a PC)
ElementType = MET_SHORT (or MET_USHORT, MET_UCHAR, ....)
ElementDataFileName = LIST
<FilenameOfSlice0>
<FilenameOfSlice1>
...
or you can use printf style wildcards for the filenames by changing the
ElementDataFileName tag such as
ElementDataFileName = filename%03d.raw 1 201 2
to specify the slices being in files called
filename001.raw
filename003.raw
filename005.raw
...
filename201.raw
I hope this helps.
Stephen
Gary O Tedeschi wrote:
> Hi,
>
> Is there a way to read in a set of files, each holding a slice of a stack,
> so as to create a 3D itk::Image object?
>
> thanks,
> Gary
> _______________________________________________
> 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