X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImageToImageGenericFilter.txx;h=2592c98c9a5e1fb64ae5bfe619a6dc898611e923;hb=6149d78df3e94ca789aaba50133d5277afe6ab5e;hp=fe34518262ca3cecc4e738494d5018ef022c7f69;hpb=ec98e4a8aed11c9daa9bd7e2439d1ac489c933c7;p=clitk.git diff --git a/common/clitkImageToImageGenericFilter.txx b/common/clitkImageToImageGenericFilter.txx index fe34518..2592c98 100644 --- a/common/clitkImageToImageGenericFilter.txx +++ b/common/clitkImageToImageGenericFilter.txx @@ -1,63 +1,20 @@ /*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Program: vv - Module: $RCSfile: clitkImageToImageGenericFilter.txx,v $ - Language: C++ - Date: $Date: 2010/03/24 20:35:08 $ - Version: $Revision: 1.9 $ - Author : Joel Schaerer - David Sarrut + 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 - Copyright (C) 2008 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS-LRMN 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. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, version 3 of the License. + It is distributed under dual licence - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - =========================================================================*/ - -// //-------------------------------------------------------------------- -// template -// void clitk::ImageToImageGenericFilterBase::SetNextOutput(typename ImageType::Pointer output) { -// if (mOutputFilenames.size()) -// { -// clitk::writeImage(output, mOutputFilenames.front(), mIOVerbose); -// mOutputFilenames.pop_front(); -// } -// if (mInputVVImages.size()) //We assume that if a vv image is set as input, we want one as the output -// mOutputVVImages.push_back(vvImageFromITK(output)); -// } -// //-------------------------------------------------------------------- - - -// //-------------------------------------------------------------------- -// template -// typename ImageType::Pointer clitk::ImageToImageGenericFilterBase::GetInput(unsigned int n) { -// if (mInputFilenames.size() > n) { -// return clitk::readImage(mInputFilenames[n], mIOVerbose); -// } -// else if (mInputVVImages.size() > n) -// return typename ImageType::Pointer(const_cast(vvImageToITK(mInputVVImages[n]).GetPointer())); -// else -// { -// assert(false); //No input, this shouldn't happen -// return typename ImageType::Pointer(NULL); -// } -// } -// //-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- + - 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), @@ -87,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()); } //-------------------------------------------------------------------- @@ -98,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); } //--------------------------------------------------------------------