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