[Insight-users] Image reader problem
Charles Knox
knoxcharles at qwest.net
Mon May 5 12:59:29 EDT 2008
The function ReadDICOMImage() gets called to test for/read a DICOM image
file.
It has worked consistently for me through ITK versions 1.x through 3.4
when compiled
with MS Visual C++ 6.0. But now, when compiling with MS Visual Studio
v9.0 for
x86 and under Windows Vista, the debugger traps an access violation from the
destructor ~ImageSource() (located in file itkImageSource.h).
-----------------------------------------------------------------------------------
BOOL CImageData::ReadDICOMImage( CString &csFileName, IMAGEPARAMS &iParam )
{
// First check for a DICOM file.
itk::GDCMImageIO::Pointer gdcmIO = itk::GDCMImageIO::New();
// This works but commented out to get to 'reader'
//if (!gdcmIO->CanReadFile((LPCTSTR)csFileName)
// return FALSE;
typedef signed short PixelType;
// Set dimensions to 3 to have reader return z-value
const UINT Dimension = 3;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( (LPCTSTR)csFileName);
reader->SetImageIO( gdcmIO );
// Return prematurely to invoke 'reader' destructor
// when going out of scope.
return FALSE;
try {
reader->Update();
} catch (std::exception &err) {
string msg = err.what();
AfxMessageBox(msg.c_str());
return FALSE;
}
...
---------------------------------------------------------------------------
Debugger stops at the destructor ~ImageSource()
...
* SmartPointer to a DataObject. If a subclass of ImageSource has
* multiple outputs of different types, then that class must provide
* an implementation of MakeOutput(). */
virtual DataObjectPointer MakeOutput(unsigned int idx);
protected:
ImageSource();
virtual ~ImageSource() {} <- Debugger stops here
/** A version of GenerateData() specific for image processing
* filters. This implementation will split the processing across
* multiple threads. The buffer is allocated by this method. Then
...
More information about the Insight-users
mailing list