MantisBT - ITK
View Issue Details
0009149ITKpublic2009-06-12 19:212010-10-21 12:31
Carlos Barrales Ruiz 
Luis Ibanez 
normalmajoralways
closedfixed 
ITK-3-14 
 
0009149: Little overflow while setting bounds in itkImageSeriesReader causes reader to fail with 2D Images.
itkImageSeriesReader.txx has a wrong pointer aritmetic confussion in method ImageSeriesReader<TOutputImage>::GenerateData() that causes my system (Mac OS X) not to load any kind of 2D images loaded from DICOM.
Ex:

File: /usr/local/include/InsightToolkit-3.14.0/IO/itkImageSeriesReader.cxx
Line: 353
Description: itk::ERROR: ImageSeriesReader(0x19163620): Size mismatch! The size of /Users/cbruiz/data/breast.dcm is [2048, 1536, 1] and does not match the required size [0, 1536, 1] from file /Users/cbruiz/data/breast.dcm

In my compiled code, the line:
sliceStartIndex[m_NumberOfDimensionsInImage] = i;
overwrites the nearest aligned integer position in stack. That is: validSize. Because m_NumberOfDimensionsInImage = 3;

I'm sure that, as you know, any other compiler may hide or override this behaviour.

I attach the patch solving the issue.

Thank you.
I'm not sure, but I believe that this piece of code:

if (TOutputImage::ImageDimension != m_NumberOfDimensionsInImage)
{
   validSize[m_NumberOfDimensionsInImage] = 1;
   sliceRequestedRegion.SetSize( m_NumberOfDimensionsInImage, 1 );
   sliceRequestedRegion.SetIndex( m_NumberOfDimensionsInImage, 0 );
}

may be problematic too.
No tags attached.
duplicate of 0009205closed Luis Ibanez Stack corruption while reading an image series with a single file 
diff itkImageSeriesReader_overflow_patch.diff (534) 2009-06-12 19:21
https://public.kitware.com/Bug/file/2322/itkImageSeriesReader_overflow_patch.diff
Issue History
2009-06-12 19:21Carlos Barrales RuizNew Issue
2009-06-12 19:21Carlos Barrales RuizFile Added: itkImageSeriesReader_overflow_patch.diff
2009-07-06 16:23Bradley LowekampStatusnew => assigned
2009-07-06 16:23Bradley LowekampAssigned To => Bradley Lowekamp
2009-07-28 18:04Luis IbanezRelationship addedduplicate of 0009205
2009-07-28 18:16Luis IbanezNote Added: 0016992
2009-07-28 18:17Luis IbanezAssigned ToBradley Lowekamp => Luis Ibanez
2009-07-28 18:17Luis IbanezNote Added: 0016994
2009-07-28 18:17Luis IbanezStatusassigned => confirmed
2009-07-28 18:50Luis IbanezNote Added: 0016998
2009-07-28 18:51Luis IbanezNote Added: 0016999
2009-07-28 18:51Luis IbanezStatusconfirmed => resolved
2009-07-28 18:51Luis IbanezResolutionopen => fixed
2009-07-31 09:02Bradley LowekampNote Added: 0017028
2009-07-31 09:02Bradley LowekampStatusresolved => feedback
2009-07-31 09:02Bradley LowekampResolutionfixed => reopened
2009-07-31 09:04Bradley LowekampNote Added: 0017029
2009-07-31 09:04Bradley LowekampStatusfeedback => resolved
2009-07-31 09:04Bradley LowekampResolutionreopened => fixed
2010-10-21 12:31Gabe HartStatusresolved => closed

Notes
(0016992)
Luis Ibanez   
2009-07-28 18:16   
Added test
Testing/Code/IO/itkDICOMImageSeriesTest2.cxx
to exercise this condition.
(0016994)
Luis Ibanez   
2009-07-28 18:17   
We verified this problem by using the new test:
Testing/Code/IO/itkDICOMImageSeriesTest2.cxx
(0016998)
Luis Ibanez   
2009-07-28 18:50   
Added a method for collapsing dimensions when necessary

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageSeriesReader.h?root=Insight&r1=1.16&r2=1.17 [^] [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageSeriesReader.txx?root=Insight&r1=1.36&r2=1.37 [^] [^]

According to Sebastian Steger advice.


See further information in bug: 9205
which is a duplicate of this one.
(0016999)
Luis Ibanez   
2009-07-28 18:51   
We believe the problem is fixed.

Will wait to see a green dashboard tomorrow, before closing the bug.

Confirmation from the bug reporter will also be nice...
(0017028)
Bradley Lowekamp   
2009-07-31 09:02   
Added test to read single image into series reader of different dimension:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/IO/itkImageSeriesReaderDimensionsTest.cxx?cvsroot=Insight&rev=1.1&view=markup [^]

Committed fix:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageSeriesReader.h?root=Insight&r1=1.17&r2=1.18 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageSeriesReader.txx?root=Insight&r1=1.37&r2=1.38 [^]
(0017029)
Bradley Lowekamp   
2009-07-31 09:04   
New test seems to be passing on the dash board.