MantisBT - ITK
View Issue Details
0009766ITKpublic2009-10-22 13:542011-01-13 17:00
Kevin H. Hobbs 
Bradley Lowekamp 
normalmajorsometimes
closedfixed 
 
 
0009766: Extract after UpdateOutputInformation produces junk
I would like to extract an image region from a MetaImage (.mhd) file without ever loading the entire image into memory.

In order to do this I set up a reader and call reader->UpdateOutputInformation();

Then I GetLargestPossibleRegion() from the reader's output and compute the sub-region I would like to extract.

I give this sub-region to an ExtractImageFilter and write the output to a file.

The resulting image looks like the wrong region was read and reshaped into my extracted region.

I mentioned this along with code and a picture on the ITK-users list here :
http://www.itk.org/pipermail/insight-users/2009-October/033310.html [^]

The image I used is:
http://crab-lab.zool.ohiou.edu/kevin/input.mhd [^]
http://crab-lab.zool.ohiou.edu/kevin/input.raw [^]

I have seen this issue on two computers( murron and gargon ) both running the nightly dashboard build of ITK. Both use 64-bit linux. murron uses Fedora 11, gargon uses Fedora 10.

This issue does not occur if I call Update instead of UpdateOutputInformation on the reader.

This issue does not occur if I convert the input image to VTK or Analyse format.
No tags attached.
cxx ExtractBug.cxx (1,584) 2009-10-22 13:54
https://public.kitware.com/Bug/file/2592/ExtractBug.cxx
png slices.png (20,390) 2009-10-22 13:56
https://public.kitware.com/Bug/file/2593/slices.png
png

patch bug9766.patch (4,855) 2009-11-02 15:10
https://public.kitware.com/Bug/file/2622/bug9766.patch
Issue History
2009-10-22 13:54Kevin H. HobbsNew Issue
2009-10-22 13:54Kevin H. HobbsFile Added: ExtractBug.cxx
2009-10-22 13:56Kevin H. HobbsFile Added: slices.png
2009-10-22 14:03Kevin H. HobbsNote Added: 0018196
2009-10-26 14:18Luis IbanezStatusnew => assigned
2009-10-26 14:18Luis IbanezAssigned To => Luis Ibanez
2009-10-28 14:14Bradley LowekampAssigned ToLuis Ibanez => Bradley Lowekamp
2009-10-29 16:32Bradley LowekampNote Added: 0018287
2009-10-29 16:32Bradley LowekampStatusassigned => confirmed
2009-11-02 15:10Bradley LowekampFile Added: bug9766.patch
2009-11-02 15:52Bradley LowekampNote Added: 0018321
2009-11-03 19:16Julien JomierStatusconfirmed => assigned
2009-11-03 19:16Julien JomierAssigned ToBradley Lowekamp => Julien Jomier
2009-11-03 20:32Julien JomierAssigned ToJulien Jomier => Bradley Lowekamp
2009-11-04 11:14Bradley LowekampNote Added: 0018342
2009-11-09 15:40Bradley LowekampNote Added: 0018377
2009-11-09 15:40Bradley LowekampStatusassigned => resolved
2009-11-09 15:40Bradley LowekampResolutionopen => fixed
2010-10-21 12:31Gabe HartStatusresolved => closed
2011-01-13 17:00Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00Source_changeset_attached => VTK master 020ef709

Notes
(0018196)
Kevin H. Hobbs   
2009-10-22 14:03   
The left side of slices.png shows a slice of the image produced with Update called on the reader before the piece was extracted.

The right side shows the same slice of the image produced with UpdateOutputInformation called on the reader.
(0018287)
Bradley Lowekamp   
2009-10-29 16:32   
I have been able to reproduce the problem with my own code.
(0018321)
Bradley Lowekamp   
2009-11-02 15:52   
Submitted experimental build with attached patch.
http://www.cdash.org/CDash/buildSummary.php?buildid=462277 [^]

Committed new test:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/IO/CMakeLists.txt.diff?cvsroot=Insight&r1=1.235&r2=1.236 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/IO/itkIOTests.cxx.diff?cvsroot=Insight&r1=1.83&r2=1.84 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/IO/itkImageFileReaderStreamingTest2.cxx?cvsroot=Insight&rev=1.1&view=markup [^]

Which can be manually run with:
itkIOTests itkImageFileReaderStreamingTest2 Insight/Testing/Data/Input/HeadMRVolume.mha

Once the patch is committed this test will be added to cmake's test.
(0018342)
Bradley Lowekamp   
2009-11-04 11:14   
Julien committed the patch:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Utilities/MetaIO/metaImage.cxx.diff?cvsroot=Insight&r1=1.119&r2=1.120 [^]
(0018377)
Bradley Lowekamp   
2009-11-09 15:40   
The test appears to be passing with the metaIO patch.