Commit de1c43ec authored by seryc's avatar seryc
Browse files

UPDATE: Try to resolve some memory leak.

There are still problems (but less) on Standard Gaussian Filter. I try to solve it later

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@2120 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 356a66e9
...@@ -119,16 +119,17 @@ void GaussianFilter::process(ImageComponent * comp) { ...@@ -119,16 +119,17 @@ void GaussianFilter::process(ImageComponent * comp) {
// ITK filter implementation // ITK filter implementation
template <class InputPixelType, class OutputPixelType, const int dim> template <class InputPixelType, class OutputPixelType, const int dim>
vtkSmartPointer<vtkImageData> GaussianFilter::itkProcess(vtkSmartPointer<vtkImageData> img) { vtkSmartPointer<vtkImageData> GaussianFilter::itkProcess(vtkSmartPointer<vtkImageData> img) {
vtkSmartPointer<vtkImageData> outputImage = vtkSmartPointer<vtkImageData>::New(); vtkSmartPointer<vtkImageData> outputImage = NULL;
switch (this->getType()) { switch (this->getType()) {
default:
case GaussianFilter::STANDARD: case GaussianFilter::STANDARD:
outputImage = itkProcessStandardGaussian<InputPixelType, OutputPixelType, dim>(img); outputImage = itkProcessStandardGaussian<InputPixelType, OutputPixelType, dim>(img);
break; break;
case GaussianFilter::RECURSIVE_IIR: case GaussianFilter::RECURSIVE_IIR:
outputImage = itkProcessIIRGaussian<InputPixelType, OutputPixelType, dim>(img); outputImage = itkProcessIIRGaussian<InputPixelType, OutputPixelType, dim>(img);
break; break;
default:
break;
} }
return outputImage; return outputImage;
...@@ -202,7 +203,6 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessStandardGaussian(vtkSmar ...@@ -202,7 +203,6 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessStandardGaussian(vtkSmar
// --------------------- Create and return a copy (the filters will be deleted)-- // --------------------- Create and return a copy (the filters will be deleted)--
vtkSmartPointer<vtkImageData> resultImage = itkToVtkFilter->GetOutput(); vtkSmartPointer<vtkImageData> resultImage = itkToVtkFilter->GetOutput();
vtkSmartPointer<vtkImageData> result = vtkSmartPointer<vtkImageData>::New(); vtkSmartPointer<vtkImageData> result = vtkSmartPointer<vtkImageData>::New();
result = vtkImageData::New();
int extent[6]; int extent[6];
resultImage->GetExtent(extent); resultImage->GetExtent(extent);
result->SetExtent(extent); result->SetExtent(extent);
...@@ -213,6 +213,10 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessStandardGaussian(vtkSmar ...@@ -213,6 +213,10 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessStandardGaussian(vtkSmar
observerBlur->Reset(); observerBlur->Reset();
observerRescale->Reset(); observerRescale->Reset();
observerBlur = NULL;
observerCast = NULL;
observerRescale = NULL;
return result; return result;
} }
...@@ -223,7 +227,7 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessIIRGaussian(vtkSmartPoin ...@@ -223,7 +227,7 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessIIRGaussian(vtkSmartPoin
typedef itk::Image< InputPixelType, dim > InputImageType; typedef itk::Image< InputPixelType, dim > InputImageType;
typedef itk::Image< OutputPixelType, dim > OutputImageType; typedef itk::Image< OutputPixelType, dim > OutputImageType;
// Convert the VTK image given by UMP to an ITK image // Convert the VTK image given by IMP to an ITK image
typedef itk::VTKImageToImageFilter<InputImageType> vtkToItkFilterType; typedef itk::VTKImageToImageFilter<InputImageType> vtkToItkFilterType;
typename vtkToItkFilterType::Pointer vtkToItkFilter = vtkToItkFilterType::New(); typename vtkToItkFilterType::Pointer vtkToItkFilter = vtkToItkFilterType::New();
...@@ -314,6 +318,11 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessIIRGaussian(vtkSmartPoin ...@@ -314,6 +318,11 @@ vtkSmartPointer<vtkImageData> GaussianFilter::itkProcessIIRGaussian(vtkSmartPoin
observerY->Reset(); observerY->Reset();
observerZ->Reset(); observerZ->Reset();
// Set CamiTK progress bar back to zero (the processing filter is over)
observerX = NULL;
observerY = NULL;
observerZ = NULL;
return imageCopy; return imageCopy;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment