DICOMImage reader has inappropriate buffer size
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I modified the MFC SDI example to show a single DICOM file.
When the window size is small (h<512), and the DICOM file is 512*512, it blows up at the following code in vtkDICOMImageReader: for (int i=0; i < this->AppHelper->GetHeight(); ++i) { memcpy(b, iData, rowLength); b += rowLength; iData -= rowLength; }
This code is to reverse the image data so that it is compatible with VTK.
The essential reason of the problem seems to be that the following code allocates buffer (*b) size by the size of displaying window.
Line #280 void* buffer = data->GetScalarPointer();