[Insight-developers] MetaImage lists for more than 3D data
Stephen R. Aylward
aylward@unc.edu
Fri, 20 Sep 2002 14:44:37 -0400
Hi Bradley,
Its great that you're using Meta to read dicom data as 4D volumes.
Cool idea.
I'd rather not change the LIST option to always read 2D slices
regardless of the overall dimension. We have apps that create 4D
volumes by providing a list of 3D volumes - which definition of "slice"
is correct is arguable, but we decided that the ND thing to do was to
consider a "slice" as an (N-1)D chunk of data. Perhaps our logic was
flawed, but...
Perhaps it would be better to follow your suggestion of having a LIST2D
option for the ElementDataFile tag to indicate that the data is in 2D
slices and not (N-1)D slices. Or perhaps the ElementDataFile tag can
optionally have a second argument if "LIST" is passed, and the second
argument would give the dimension of the data in the subfiles, e.g.,
"LIST 2D", and the default would be the number of dimensions minus one.
If you go with the second argument idea, just the first character of the
second argument could be parsed to determine the dimensionality of the
"slices" so the user could write "LIST 2" or "LIST 2DSlices"...
Either option is good with me - and it is great if you want to make
those changes. Let me know if you need help...or if you want me to do
them.
About other readers - only RAW also supports ND data, and yet it does
not support splitting data across files. So, none of the other readers
will need changing.
Stephen
Bradley Wyman wrote:
> I composed a MetaImage header for 4D data that I am trying to read in slice by slice. The .mhd file is:
>
> NDims = 4
> DimSize = 204 256 8 9
> ElementSpacing = 0.784314 0.785156 11.0 1.0
> HeaderSize = -1
> ElementType = MET_USHORT
> ElementByteOrderMSB = False
> ElementDataFile = LIST
> t00\p01_t00_s00.dcm
> t00\p01_t00_s01.dcm
> t00\p01_t00_s02.dcm
> t00\p01_t00_s03.dcm
> t00\p01_t00_s04.dcm
> t00\p01_t00_s05.dcm
> t00\p01_t00_s06.dcm
> t00\p01_t00_s07.dcm
> t01\p01_t01_s00.dcm
> t01\p01_t01_s01.dcm
> ...
> and so on for all the files.
>
> It appears that MetaImage::Read requires that the datafiles be dimensioned of size one less than the desired dimension. This works great for NDims = 3, but in the case for NDims=4 it requires that the data needs to be stored in files as 3D imagestacks and not 2D image stacks. The problem arises with the looping and the call to M_ReadElements which is as follows:
>
> M_ReadElements(readStreamTemp,
> &(((char *)m_ElementData)[i*m_SubQuantity[m_NDims-1]*
> elementSize]),
> m_SubQuantity[m_NDims-1]);
>
> Given I want to read the data in slice by slice it appears that the code needs to be modified. First, I want to make sure that I'm not missing something. Second, does anybody mind if I add an m_ElementDataFileName option to read 2D slice by 2D slice. Or should the defalt if(!strcmp("LIST", m_ElementDataFileName) routine assume 2D slice by 2D slice? Also, would anybody else like to make this change (before I go messin' with someone elses code)?
>
> Finally, does this change need to be propogated to any of the other IO readers?
>
> Thanks,
>
> _____________________________________________
> Brad Wyman, Ph.D. Insightful Corp.
> 1700 Westlake Ave. N (206)802-2256
> Seattle, WA 98109 Fax: (206)283-6310
> bwyman@insightful.com
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
--
===============================================
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