X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImageToImageGenericFilter.txx;h=a13dca9f9d25eea604c2da79fc66306cc1e878d1;hb=d55f025b18f68066a52b8f33c2dc6481e82c2580;hp=2592c98c9a5e1fb64ae5bfe619a6dc898611e923;hpb=e6add2e56013846bcf4368013c4aaf4eb36991ec;p=clitk.git diff --git a/common/clitkImageToImageGenericFilter.txx b/common/clitkImageToImageGenericFilter.txx index 2592c98..a13dca9 100644 --- a/common/clitkImageToImageGenericFilter.txx +++ b/common/clitkImageToImageGenericFilter.txx @@ -1,9 +1,9 @@ /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Authors belong to: + Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,10 +14,10 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ template clitk::ImageToImageGenericFilter::ImageToImageGenericFilter(std::string filterName) : - ImageToImageGenericFilterBase(filterName), + ImageToImageGenericFilterBase(filterName), mImageTypesManager(static_cast(this)) { } @@ -26,18 +26,19 @@ clitk::ImageToImageGenericFilter::ImageToImageGenericFilter(std::str //-------------------------------------------------------------------- template -bool clitk::ImageToImageGenericFilter::Update() { - GetInputImageDimensionAndPixelType(mDim,mPixelTypeName,mNbOfComponents); - +bool clitk::ImageToImageGenericFilter::Update() +{ + GetInputImageDimensionAndPixelType(m_Dim,m_PixelTypeName,m_NbOfComponents); + // Check ImageType if (!CheckImageType()) { - if (mFailOnImageTypeError) ImageTypeError(); + if (m_FailOnImageTypeError) ImageTypeError(); else SetImageTypeError(); return false; } // Go ! Call the right templatized function - mImageTypesManager.DoIt(mDim, mNbOfComponents, mPixelTypeName); + mImageTypesManager.DoIt(m_Dim, m_NbOfComponents, m_PixelTypeName); return true; } //-------------------------------------------------------------------- @@ -45,7 +46,8 @@ bool clitk::ImageToImageGenericFilter::Update() { //-------------------------------------------------------------------- template 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 +{ + //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() && @@ -59,17 +61,18 @@ bool clitk::ImageToImageGenericFilter::CheckImageType(unsigned int d template bool clitk::ImageToImageGenericFilter::CheckImageType() { - return CheckImageType(mDim, mNbOfComponents, mPixelTypeName); + return CheckImageType(m_Dim, m_NbOfComponents, m_PixelTypeName); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template -std::string clitk::ImageToImageGenericFilter::GetAvailableImageTypes() { +std::string clitk::ImageToImageGenericFilter::GetAvailableImageTypes() +{ std::ostringstream oss; - oss << "The filter <" << mFilterName << "> manages:" << std::endl; - + oss << "The filter <" << m_FilterName << "> manages:" << std::endl; + typedef typename ImageTypesManager::MapOfImageComponentsToFunctionType::const_iterator MCompItType; typedef typename ImageTypesManager::MapOfImageDimensionToFunctionType::const_iterator MDimItType; typedef typename ImageTypesManager::MapOfPixelTypeToFunctionType::const_iterator MPixelItType; @@ -79,8 +82,8 @@ std::string clitk::ImageToImageGenericFilter::GetAvailableImageTypes for (MCompItType j=(*i).second.begin(); j!= (*i).second.end(); j++) { for (MPixelItType k=(*j).second.begin(); k!= (*j).second.end(); k++) { oss << "Dim: " << (*i).first; - if ((*j).first != 1) oss << ", Components: " << (*j).first; - oss << ", Type: " << (*k).first << std::endl; + if ((*j).first != 1) oss << ", Components: " << (*j).first; + oss << ", Type: " << (*k).first << std::endl; } } }