<span class="gmail_quote"></span>
<div><span class="e" id="q_111516be856a1568_0">Hi, <br>i have some problems to port my code form itk 2.4 to itk 3.0 or <br>higher. My code simply reads a dicom series by using the class <br>itkGDCMImageIO. It is part of a class of an MFC application.
<br>I am <br>using <br>visual stuidio .Net 2003. I have compiled the version 3.0.1 of <br>itk and <br>linked it in my project. I don't have compilation or execution <br>problem, <br>but after closing my MFC application many memory leaks are
<br>detected. I <br>executed my application in debug mode. The strange thing <br>is that when i <br>open some dicom series no memory leaks are generated <br>whereas in other <br>cases a number of memory leaks appears. This number
<br>is the same of the <br>dicom slices i try to open. But using itk 2.4 i <br>didn't have any <br>problems!! <br>My code is reported below:<br><br>typedef short <br>PixelType;<br>const <br>unsigned int Dimension = 3;
<br>typedef itk::<br>Image<PixelType, Dimension> <br>ImageType;<br>typedef itk::<br>ImageSeriesReader<ImageType> SeriesReaderType;<br><br>typedef itk::<br>GDCMImageIO ImageIOType;<br>typedef itk::DICOMSeriesFileNames
<br>DicomNamesGeneratorType;<br><br>SeriesReaderType::Pointer itkReader = <br>SeriesReaderType::New();<br>ImageIOType::Pointer itkDicomIO = <br>ImageIOType::New();<br><br>DicomNamesGeneratorType::Pointer seriesSort = <br>
DicomNamesGeneratorType::New();<br>seriesSort-<br>>SetFileNameSortingOrderToSortByImageNumber();<br>seriesSort-<br>>SetDirectory<br>(dicomDirectory);<br><br>if (seriesSort->GetFileNames().size())<br>{<br><br>itkReader->SetFileNames(seriesSort->GetFileNames());
<br>itkReader-<br>>SetImageIO(itkDicomIO); <br><br>try {<br>itkReader-<br>>UpdateLargestPossibleRegion();<br>}<br>catch (itk::ExceptionObject) {<br><br><br>return false;<br>}<br>}<br><br>I have tried to use GDCMSeriesFileNames instead
<br>of DICOMSeriesFileNames but the result is the same. If i use <br>DICOMImageIO2 no memory leaks are generated but the header dicom is <br>not <br>fully read (only a part of it can be accessed by using members of <br>this
<br>class).<br>If i call updateoutputinformation instead of <br>UpdateLargestPossibleRegion the number of memory leack gets lower.<br>Can <br>someone help me?<br><br>Thanks in advance,<br><span>Massimo<br></span></span></div>