X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkImageToImageGenericFilter.h;h=07ba4928cc7121ceab7173301f0e5eacbd149004;hb=8d51bd1cb7e9ca416b46677dcd73ba76d107a587;hp=c065fc921ff3041c00fc6e9041dd584d7fa7bda7;hpb=9bcf64b7f7c5a7f0a39843df634c05b5d9e4e237;p=clitk.git diff --git a/common/clitkImageToImageGenericFilter.h b/common/clitkImageToImageGenericFilter.h index c065fc9..07ba492 100644 --- a/common/clitkImageToImageGenericFilter.h +++ b/common/clitkImageToImageGenericFilter.h @@ -1,132 +1,29 @@ /*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Program: clitk - Module: $RCSfile: clitkImageToImageGenericFilter.h,v $ - Language: C++ - Date: $Date: 2010/01/29 07:27:31 $ - Version: $Revision: 1.2 $ - Author : Joel Schaerer - David Sarrut + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.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 . - - =========================================================================*/ + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================**/ #ifndef CLITKIMAGETOIMAGEGENERICFILTER_H #define CLITKIMAGETOIMAGEGENERICFILTER_H -// clitk include -#include "clitkCommon.h" -#include "clitkImageCommon.h" -#include "clitkCommonGenericFilter.h" -#include - -// vv include -#include -#include -#include -#include +#include "clitkImageToImageGenericFilterBase.h" namespace clitk { - //-------------------------------------------------------------------- - class ImageToImageGenericFilterBase: public itk::Object { - - public: - // constructor - destructor - ImageToImageGenericFilterBase(std::string filterName); - virtual ~ImageToImageGenericFilterBase() {} - - // Types - typedef ImageToImageGenericFilterBase Self; - typedef Object Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Filters information - const std::string & GetFilterName() { return mFilterName; } - void SetFilterName(std::string & n) { mFilterName = n; } - - // Generic IO - /// Returns the dimension and pixel type of the *first* input - void GetInputImageDimensionAndPixelType(unsigned int& dim, std::string& pixeltype,unsigned int & components); - - // File IO - void SetInputFilename(const std::string & filename); - void AddInputFilename(const std::string & filename); - void SetInputFilenames(const std::vector & filenames); - void SetOutputFilename(const std::string & filename); - void AddOutputFilename(const std::string & filename); - void SetOutputFilenames(const std::vector & filenames); - std::string GetOutputFilename(); - void SetIOVerbose(bool b) { mIOVerbose = b; } - - // VVImage IO - void SetInputVVImage (vvImage::Pointer input); - void SetInputVVImages (std::vector input); - void AddInputVVImage (vvImage::Pointer input); - vvImage::Pointer GetOutputVVImage (); - std::vector GetOutputVVImages (); - - // Information on available image types - void PrintAvailableImageTypes(); - bool CheckDimension(unsigned int d); - bool CheckPixelType(std::string pt); - - // Main function to call for using the filter. - virtual bool Update() = 0; - - // Use internally only (TO PUT PROTECTED !!!) - void AddImageType(unsigned int d, std::string p); - - protected: - /// Call this function to dispatch an output towards the correct sink - template - void SetNextOutput(typename ImageType::Pointer output); - - /// Call this function to get the nth itk input image, regardless of input source - template - typename ImageType::Pointer GetInput(unsigned int n); - - std::vector mInputFilenames; - std::list mOutputFilenames; - - bool mIOVerbose; - unsigned int mDim; - std::string mPixelTypeName; - unsigned int mNbOfComponents; - std::string mFilterName; - - std::vector mInputVVImages; - std::vector mOutputVVImages; - - std::vector mListOfAllowedPixelType; - std::vector mListOfAllowedDimension; - bool CheckImageType(); - bool CheckDimension(); - bool CheckPixelType(); - void ImageTypeError(); - void SetImageTypeError(); - bool mFailOnImageTypeError; - - }; // end class clitk::ImageToImageGenericFilter - - - //-------------------------------------------------------------------- +//-------------------------------------------------------------------- template class ImageToImageGenericFilter: public ImageToImageGenericFilterBase { @@ -136,24 +33,21 @@ namespace clitk { // constructor - destructor ImageToImageGenericFilter(std::string filterName); - virtual ~ImageToImageGenericFilter() { delete mImageTypesManager; } // Main function to call for using the filter. virtual bool Update(); + virtual bool CheckImageType(unsigned int dim,unsigned int ncomp, std::string pixeltype); + virtual bool CheckImageType(); + virtual std::string GetAvailableImageTypes(); protected: // Object that will manage the list of templatized function for // each image type. - ImageTypesManager * mImageTypesManager; + ImageTypesManager mImageTypesManager; }; // end class clitk::ImageToImageGenericFilter - // #define ADD_IMAGE_DIMENSION(DIM) Initialize(); - -#define ADD_IMAGE_TYPE(DIM, PT) this->mImageTypesManager->template AddNewDimensionAndPixelType(); - - -#include "clitkImageToImageGenericFilter.txx" +#include "clitkImageToImageGenericFilter.txx" } // end namespace