[Insight-users] itkImageSeriesReader crashes

van Bruggen Thomas t.vanbruggen at dkfz-heidelberg.de
Wed Oct 7 12:30:35 EDT 2009


Hello,

 

I am experiencing a problem with the ImageSeriesReader when trying to
load DICOM data consisting of one file only. I am suspecting that it is
a bug. When the dataset consists of multiple files the member variable
m_NumberOfDimensionsInImage is decreased by one (line 160 of
itkImageSeriesReader.txx, using itk 3.12). When there is only one file
the following code block is executed, the result of which gives
m_NumberOfDimensionsInImage the value 3:

 

if (m_FileNames.size() == 1)

      {

      // ----------------------------

      // there is only one file need to copy all of it's meta data

      spacing = reader->GetOutput()->GetSpacing();

      origin = reader->GetOutput()->GetOrigin();

      direction = reader->GetOutput()->GetDirection();

      largestRegion = reader->GetOutput()->GetLargestPossibleRegion();

 

      m_NumberOfDimensionsInImage =
reader->GetImageIO()->GetNumberOfDimensions();

      }

 

Later in Generate data m_NumberOfDimensionsInImage is used as an index
to access the last element of sliceStartIndex:

sliceStartIndex[m_NumberOfDimensionsInImage] = i;

 

sliceStartIndex has length 3 so it writes outside the bounds of the
array, resulting in a crash, because the stack around the variable

sliceStartIndex[] is corrupted.

 

 

Is this a known bug/does anybody else ever experienced the same problem?
The solution to this problem could be to set m_NumberOfDimensionsInImage
= reader->GetImageIO()->GetNumberOfDimensions() - 1

 

Kind regards,

 

Thomas 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091007/8f4cc689/attachment.htm>


More information about the Insight-users mailing list