From e6add2e56013846bcf4368013c4aaf4eb36991ec Mon Sep 17 00:00:00 2001 From: srit Date: Fri, 23 Apr 2010 15:30:36 +0000 Subject: [PATCH] Corrected bug: the image to image filter type was always displayed as available in the generic filter --- common/clitkImageToImageGenericFilter.txx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/clitkImageToImageGenericFilter.txx b/common/clitkImageToImageGenericFilter.txx index f4d6906..2592c98 100644 --- a/common/clitkImageToImageGenericFilter.txx +++ b/common/clitkImageToImageGenericFilter.txx @@ -44,9 +44,13 @@ bool clitk::ImageToImageGenericFilter::Update() { //-------------------------------------------------------------------- template -bool clitk::ImageToImageGenericFilter::CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) -{ - return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]); +bool clitk::ImageToImageGenericFilter::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(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]); + typename ImageTypesManager::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::CheckImageType(unsigned int d template bool clitk::ImageToImageGenericFilter::CheckImageType() { - return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]); + return CheckImageType(mDim, mNbOfComponents, mPixelTypeName); } //-------------------------------------------------------------------- -- 2.47.1