<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&#39;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&#39;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&lt;PixelType, Dimension&gt; <br>ImageType;<br>typedef itk::<br>ImageSeriesReader&lt;ImageType&gt; 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>&gt;SetFileNameSortingOrderToSortByImageNumber();<br>seriesSort-<br>&gt;SetDirectory<br>(dicomDirectory);<br><br>if (seriesSort-&gt;GetFileNames().size())<br>{<br><br>itkReader-&gt;SetFileNames(seriesSort-&gt;GetFileNames()); 
<br>itkReader-<br>&gt;SetImageIO(itkDicomIO); <br><br>try {<br>itkReader-<br>&gt;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>