[Insight-users] Porting from itk 2.4 to itk 3.0

Bill Lorensen bill.lorensen at gmail.com
Wed Mar 14 12:18:15 EST 2007


Massimo
Can you provide the locations of the leaks that you are getting?

Bill


On 3/14/07, Massimo Esposito <mass.esposito at gmail.com> wrote:
>
> Hi,
> i have some problems to port my code form itk 2.4 to itk 3.0 or
> higher. My code simply reads a dicom series by using the class
> itkGDCMImageIO. It is part of a class of an MFC application.
> I am
> using
> visual stuidio .Net 2003. I have compiled the version 3.0.1 of
> itk and
> linked it in my project. I don't have compilation or execution
> problem,
> but after closing my MFC application many memory leaks are
> detected. I
> executed my application in debug mode. The strange thing
> is that when i
> open some dicom series no memory leaks are generated
> whereas in other
> cases a number of memory leaks appears. This number
> is the same of the
> dicom slices i try to open. But using itk 2.4 i
> didn't have any
> problems!!
> My code is reported below:
>
> typedef short
> PixelType;
> const
> unsigned int Dimension = 3;
> typedef itk::
> Image<PixelType, Dimension>
> ImageType;
> typedef itk::
> ImageSeriesReader<ImageType> SeriesReaderType;
>
> typedef itk::
> GDCMImageIO ImageIOType;
> typedef itk::DICOMSeriesFileNames
> DicomNamesGeneratorType;
>
> SeriesReaderType::Pointer itkReader =
> SeriesReaderType::New();
> ImageIOType::Pointer itkDicomIO =
> ImageIOType::New();
>
> DicomNamesGeneratorType::Pointer seriesSort =
> DicomNamesGeneratorType::New();
> seriesSort-
> >SetFileNameSortingOrderToSortByImageNumber();
> seriesSort-
> >SetDirectory
> (dicomDirectory);
>
> if (seriesSort->GetFileNames().size())
> {
>
> itkReader->SetFileNames(seriesSort->GetFileNames());
> itkReader-
> >SetImageIO(itkDicomIO);
>
> try {
> itkReader-
> >UpdateLargestPossibleRegion();
> }
> catch (itk::ExceptionObject) {
>
>
> return false;
> }
> }
>
> I have tried to use GDCMSeriesFileNames instead
> of DICOMSeriesFileNames but the result is the same. If i use
> DICOMImageIO2 no memory leaks are generated but the header dicom is
> not
> fully read (only a part of it can be accessed by using members of
> this
> class).
> If i call updateoutputinformation instead of
> UpdateLargestPossibleRegion the number of memory leack gets lower.
> Can
> someone help me?
>
> Thanks in advance,
> Massimo
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070314/43cb8b0f/attachment.html


More information about the Insight-users mailing list