[Insight-developers] RE: Question about ImageIO and re-ordering dimensions

Miller, James V (Research) millerjv@crd.ge.com
Mon, 3 Feb 2003 09:56:34 -0500


Simple question first.

There is a spot for data in Insight/Testing/Data 

In the (near?) future, this data will probably be moved to a separate
download so the casual user doesn't need to wait for the test data to 
download.

Just try to keep the data small.  If you can live with just a few 
slices of data, try to.  If you can live with low resolution data, 
try to.  What we found with VTK, is that if the data for testing takes
too much disk space, people will not keep it on their machines and 
hence they will not test often.

For the first question:

The pipeline update mechanism takes multiple passes up the pipeline to 
calculate modified times, region requests, and finally execution of 
filters.  So the data that is calculated by ReadImageInformation()
is probably sent down stream during pipeline negotiations.  So if during
reading of the data, you reshuffle (permute) the data, the pipeline 
integrity will be breached.  

Option 1: Have the ReadImageInformation() store the image information
with the values of how the data will organized when the data exits
the Read() method.  So if the data on disk is stored as 10x10x30 
but you plan to have the "output" of the ImageIO be 30x10x10 then
store 30x10x10 in the Dimensions ivar. 

I am guessing here, that your data always has to be permuted in 
this manner.  If the permutation type needs to specified by the 
user, then the user will have to create the Analyze ImageIO object
manually and set the permutation type.  This means they will not be 
able to use the IO factories.

Option 2: Have the ReadImageInformation() and Read() methods always
read the data into a buffer exactly how it is organized on disk.  When
you need to permute the data, run the output of the ImageFileReader through
a itk::PermuteAxesImageFilter() to change the data from 10x10x30 to 30x10x10
(or whatever).









> -----Original Message-----
> From: Kent Williams [mailto:kent@mail.psychiatry.uiowa.edu]
> Sent: Friday, January 31, 2003 6:14 PM
> To: Miller, James V (Research); Insight-developers (E-mail)
> Subject: Question about ImageIO and re-ordering dimensions
> 
> 
> Hi!
> 
> I'm in charge of getting the Mayo-Analyze file reader/writer 
> fully functional, 
> and I had a question about ImageIO internals. 
> 
> One of our requirements is that once loaded into ITK, the 
> Analyze data be in
> Coronal scan order -- i.e. vertical brain slices, from 
> back/posterior to 
> front/anterior.  This is easy enough for the case where the 
> scan volume is a 
> cube, but the images are more likely to be rectangular prism.
> 
> The existing Analyze reader gets the dimensions from the 
> Analyze header in the 
> ReadInformation method.  Then later, the AnalyzeIO::Read 
> method reads in the 
> pixel data from the image file.
> 
> I guess my question is this: After the image data is read in, 
> can I change the 
> dimensions of the image? In other words, let ImageIOBase 
> figure out the image 
> size and strides of the old configuration, then change the 
> dimensions, 
> re-compute the strides, and then re-order the image buffer.? 
> Or is there some
> really elegant way to do this in ITK that I've not yet found?
> 
> Question 2 -- I'd like to check in a test for the analyze 
> file IO, but I'll 
> need to check in a pair of Analyze-format data files.  Where 
> in the testing 
> tree would be the logical place to park them, and when the 
> tests are run, how 
> would my test find its data files?
> 
> thanks!
>