]> Creatis software - clitk.git/commitdiff
move the ImageTypeManager on the stack, warning still there
authorschaerer <schaerer>
Tue, 9 Feb 2010 14:40:55 +0000 (14:40 +0000)
committerschaerer <schaerer>
Tue, 9 Feb 2010 14:40:55 +0000 (14:40 +0000)
common/clitkImageToImageGenericFilter.h
common/clitkImageToImageGenericFilter.txx

index caf25f6ec931596ff6a56c721b1dca201131f524..eb244b8e5bdf724060a3ef2ba64c25f2a6ede9e9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   clitk
   Module:    $RCSfile: clitkImageToImageGenericFilter.h,v $
   Language:  C++
-  Date:      $Date: 2010/02/09 14:19:28 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2010/02/09 14:40:55 $
+  Version:   $Revision: 1.7 $
   Author :   Joel Schaerer <joel.schaerer@creatis.insa-lyon.fr>
              David Sarrut <david.sarrut@creatis.insa-lyon.fr>
 
@@ -131,7 +131,6 @@ namespace clitk {
 
     // constructor - destructor
     ImageToImageGenericFilter(std::string filterName);
-    virtual ~ImageToImageGenericFilter() { delete mImageTypesManager; }
 
     // Main function to call for using the filter. 
     virtual bool Update();
@@ -142,14 +141,14 @@ namespace clitk {
   protected:
     // Object that will manage the list of templatized function for
     // each image type.
-    ImageTypesManager<FilterType> mImageTypesManager;
+    ImageTypesManager<FilterType> mImageTypesManager;
     
   }; // end class clitk::ImageToImageGenericFilter
 
   // #define ADD_IMAGE_DIMENSION(DIM) Initialize<DIM>();
 
-#define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager->template AddNewDimensionAndPixelType<DIM,COMP, PT>();
-#define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager->template AddNewDimensionAndPixelType<DIM, PT>();
+#define ADD_VEC_IMAGE_TYPE(DIM, COMP, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM,COMP, PT>();
+#define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager.template AddNewDimensionAndPixelType<DIM, PT>();
 
 
 #include "clitkImageToImageGenericFilter.txx"
index f68ff21ee9ed6525e27e01095ca320644b44c442..93f486f22d9ac86eb18730978f985469ebe8a84d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   vv
   Module:    $RCSfile: clitkImageToImageGenericFilter.txx,v $
   Language:  C++
-  Date:      $Date: 2010/02/09 14:19:28 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/02/09 14:40:55 $
+  Version:   $Revision: 1.4 $
   Author :   Joel Schaerer <joel.schaerer@creatis.insa-lyon.fr>
              David Sarrut <david.sarrut@creatis.insa-lyon.fr>
 
@@ -56,11 +56,10 @@ typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsig
 
 //--------------------------------------------------------------------
 template<class FilterType>
-clitk::ImageToImageGenericFilter<FilterType>::ImageToImageGenericFilter(std::string filterName)
- :ImageToImageGenericFilterBase(filterName){
-  // Create main function manager
-  this->mImageTypesManager = new
- ImageTypesManager<FilterType>(static_cast<FilterType*>(this));
+clitk::ImageToImageGenericFilter<FilterType>::ImageToImageGenericFilter(std::string filterName) :
+    ImageToImageGenericFilterBase(filterName), 
+    mImageTypesManager(static_cast<FilterType*>(this))
+{
 }
 //--------------------------------------------------------------------
 
@@ -78,20 +77,20 @@ bool clitk::ImageToImageGenericFilter<FilterType>::Update() {
   }
 
   // Go ! Call the right templatized function
-  mImageTypesManager->DoIt(mDim, mNbOfComponents, mPixelTypeName);
+  mImageTypesManager.DoIt(mDim, mNbOfComponents, mPixelTypeName);
   return true;
 }
 //--------------------------------------------------------------------
 template<class FilterType>
 bool clitk::ImageToImageGenericFilter<FilterType>::CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype)
 {
-    return static_cast<bool>(mImageTypesManager->mMapOfImageTypeToFunction[dim][ncomp][pixeltype]);
+    return static_cast<bool>(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]);
 }
 
 template<class FilterType>
 bool clitk::ImageToImageGenericFilter<FilterType>::CheckImageType()
 {
-    return static_cast<bool>(mImageTypesManager->mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]);
+    return static_cast<bool>(mImageTypesManager.mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]);
 }
 
 template<class FilterType>
@@ -102,8 +101,8 @@ std::string clitk::ImageToImageGenericFilter<FilterType>::GetAvailableImageTypes
     typedef typename ImageTypesManager<FilterType>::MapOfImageComponentsToFunctionType::const_iterator MCompItType;
     typedef typename ImageTypesManager<FilterType>::MapOfImageDimensionToFunctionType::const_iterator MDimItType;
     typedef typename ImageTypesManager<FilterType>::MapOfPixelTypeToFunctionType::const_iterator MPixelItType;
-    for (MDimItType i=mImageTypesManager->mMapOfImageTypeToFunction.begin();
-            i!=mImageTypesManager->mMapOfImageTypeToFunction.end();
+    for (MDimItType i=mImageTypesManager.mMapOfImageTypeToFunction.begin();
+            i!=mImageTypesManager.mMapOfImageTypeToFunction.end();
             i++) {
         for (MCompItType j=(*i).second.begin(); j!= (*i).second.end(); j++) {
             for (MPixelItType k=(*j).second.begin(); k!= (*j).second.end(); k++) {