]> Creatis software - clitk.git/commitdiff
attempt to fix some leaks. Note that vv still leaks: memory is never given back to...
authorschaerer <schaerer>
Wed, 4 Aug 2010 16:15:51 +0000 (16:15 +0000)
committerschaerer <schaerer>
Wed, 4 Aug 2010 16:15:51 +0000 (16:15 +0000)
common/vvFromITK.h
common/vvImage.cxx
itk/itkImageToVTKImageFilter.txx
vv/vvImageReader.txx

index 818705176e5f2d4701af011aed6cef7f5f216669..fb1e8827c2c6b25d5719c96cc2ca5bde385ebc16 100644 (file)
@@ -80,7 +80,7 @@ template<unsigned int Dim, class PixelType> vvImage::Pointer vvImageFromITK(type
                 return vv_image;
             }
             vtkImageData *image = vtkImageData::New();
-            image->DeepCopy(connector->GetOutput());
+            image->ShallowCopy(connector->GetOutput());
             vv_image->AddImage(image);
         }
         vv_image->SetTimeSpacing(input->GetSpacing()[Dim-1]);
@@ -102,7 +102,7 @@ template<unsigned int Dim, class PixelType> vvImage::Pointer vvImageFromITK(type
             return vv_image;
         }
         vtkImageData *image = vtkImageData::New();
-        image->DeepCopy(connector->GetOutput());
+        image->ShallowCopy(connector->GetOutput());
         vv_image->AddImage(image);
     }
     return vv_image;
index 55a56ef2f3e75cd3351b28b3bd475f6afafbace0..4675cf5b661453428bd561d81bbc623c75be092c 100644 (file)
@@ -50,6 +50,7 @@ void vvImage::Init()
 //--------------------------------------------------------------------
 vvImage::~vvImage()
 {
+  DD("vvImage got deleted!");
   Reset();
 }
 //--------------------------------------------------------------------
index 5bce5062ff428d6253576f330ce267d8d81ca6f0..25fcf7c5d808d48f74471bcfd8a766261f8aa898 100644 (file)
@@ -65,6 +65,10 @@ ImageToVTKImageFilter<TInputImage>
     m_Importer->Delete();
     m_Importer = 0;
   }
+  if ( m_Exporter ) {
+    m_Exporter->Delete();
+    m_Exporter = 0;
+  }
 }
 
 
index fd1c5755c6670b805c6da83f650768d732f0fab2..d0247fe7d072ea11c255dc6be98a3e543b287d08 100644 (file)
@@ -100,8 +100,9 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
         std::cerr << "Error while setting vvImage from ITK (MERGEDWITHTIME)"
                   << " " << err << std::endl;
       }
-      vtkImageData *image = vtkImageData::New();
-      image->DeepCopy(connector->GetOutput());
+      //vtkImageData *image = vtkImageData::New();
+      //image->ShallowCopy(connector->GetOutput());
+      vtkImageData *image = connector->GetOutput();
       mImage->AddImage(image);
     }
   } else {