/*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv Authors belong to: - University of LYON http://www.universite-lyon.fr/ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the copyright notices for more information. It is distributed under dual licence - 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), mImageTypesManager(static_cast(this)) { } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template bool clitk::ImageToImageGenericFilter::Update() { GetInputImageDimensionAndPixelType(mDim,mPixelTypeName,mNbOfComponents); // Check ImageType if (!CheckImageType()) { if (mFailOnImageTypeError) ImageTypeError(); else SetImageTypeError(); return false; } // Go ! Call the right templatized function mImageTypesManager.DoIt(mDim, mNbOfComponents, mPixelTypeName); return true; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template bool clitk::ImageToImageGenericFilter::CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype) { return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[dim][ncomp][pixeltype]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template bool clitk::ImageToImageGenericFilter::CheckImageType() { return static_cast(mImageTypesManager.mMapOfImageTypeToFunction[mDim][mNbOfComponents][mPixelTypeName]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- template std::string clitk::ImageToImageGenericFilter::GetAvailableImageTypes() { std::ostringstream oss; oss << "The filter <" << mFilterName << "> manages:" << std::endl; typedef typename ImageTypesManager::MapOfImageComponentsToFunctionType::const_iterator MCompItType; typedef typename ImageTypesManager::MapOfImageDimensionToFunctionType::const_iterator MDimItType; typedef typename ImageTypesManager::MapOfPixelTypeToFunctionType::const_iterator MPixelItType; 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++) { oss << "Dim: " << (*i).first; if ((*j).first != 1) oss << ", Components: " << (*j).first; oss << ", Type: " << (*k).first << std::endl; } } } return oss.str(); } //--------------------------------------------------------------------