]> Creatis software - clitk.git/commitdiff
Corrected bug: the image to image filter type was always displayed as available in...
authorsrit <srit>
Fri, 23 Apr 2010 15:30:36 +0000 (15:30 +0000)
committersrit <srit>
Fri, 23 Apr 2010 15:30:36 +0000 (15:30 +0000)
common/clitkImageToImageGenericFilter.txx

index f4d690654a96ba4727c68da8f2a34a3536b07baf..2592c98c9a5e1fb64ae5bfe619a6dc898611e923 100644 (file)
@@ -44,9 +44,13 @@ bool clitk::ImageToImageGenericFilter<FilterType>::Update() {
 
 //--------------------------------------------------------------------
 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]);
+bool clitk::ImageToImageGenericFilter<FilterType>::CheckImageType(unsigned int dim, unsigned int ncomp, std::string pixeltype)
+{ //SR: commented line creates an element in mMapOfImageTypeToFunction which, even if 0, is confusing, e.g. for GetAvailableImageTypes
+  //return static_cast<bool>(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]);
+  typename ImageTypesManager<FilterType>::MapOfImageDimensionToFunctionType &m = mImageTypesManager.mMapOfImageTypeToFunction;
+  return (m            .find(dim)       != m.end()      &&
+          m[dim]       .find(ncomp)     != m[dim].end() &&
+          m[dim][ncomp].find(pixeltype) != m[dim][ncomp].end());
 }
 //--------------------------------------------------------------------
 
@@ -55,7 +59,7 @@ bool clitk::ImageToImageGenericFilter<FilterType>::CheckImageType(unsigned int d
 template<class FilterType>
 bool clitk::ImageToImageGenericFilter<FilterType>::CheckImageType()
 {
-  return static_cast<bool>(mImageTypesManager.mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]);
+  return CheckImageType(mDim, mNbOfComponents, mPixelTypeName);
 }
 //--------------------------------------------------------------------