From: tbaudier Date: Wed, 14 Sep 2016 07:46:51 +0000 (+0200) Subject: Finalize the creation of clitkNVectorImageTo4DImage tool X-Git-Tag: v1.4.0~6 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9da81e50823a00f78efb8de1740773fd0a347389;p=clitk.git Finalize the creation of clitkNVectorImageTo4DImage tool --- diff --git a/tools/clitkNVectorImageTo4DImage.ggo b/tools/clitkNVectorImageTo4DImage.ggo index d72a700..32fcef3 100644 --- a/tools/clitkNVectorImageTo4DImage.ggo +++ b/tools/clitkNVectorImageTo4DImage.ggo @@ -8,5 +8,4 @@ option "verbose" v "Verbose" flag off option "input" i "Input image filename" string yes option "output" o "Output image filename" string yes -option "componentIndex" c "Component index to extract" int no default="0" diff --git a/tools/clitkNVectorImageTo4DImageFilter.h b/tools/clitkNVectorImageTo4DImageFilter.h deleted file mode 100644 index f76eb9c..0000000 --- a/tools/clitkNVectorImageTo4DImageFilter.h +++ /dev/null @@ -1,108 +0,0 @@ -/*========================================================================= - 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://www.centreleonberard.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 -===========================================================================**/ -#ifndef clitkNVectorImageTo4DImageFilter_h -#define clitkNVectorImageTo4DImageFilter_h - -/* ================================================= - * @file clitkNVectorImageTo4DImageFilter.h - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk include -#include "clitkIO.h" -#include "clitkCommon.h" - -//itk include -#include "itkImageToImageFilter.h" - -namespace clitk -{ - - template - class ITK_EXPORT NVectorImageTo4DImageFilter : - public itk::ImageToImageFilter - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef NVectorImageTo4DImageFilter Self; - typedef itk::ImageToImageFilter Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( NVectorImageTo4DImageFilter, ImageToImageFilter ); - - /** Dimension of the domain space. */ - itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension); - - //---------------------------------------- - // Typedefs - //---------------------------------------- - typedef typename OutputImageType::RegionType OutputImageRegionType; - - //---------------------------------------- - // Set & Get - //---------------------------------------- - itkBooleanMacro(Verbose); - itkSetMacro( Verbose, bool); - itkGetConstReferenceMacro( Verbose, bool); - itkSetMacro(ComponentIndex, unsigned int); - itkGetConstMacro(ComponentIndex, unsigned int); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - NVectorImageTo4DImageFilter(); - ~NVectorImageTo4DImageFilter() {}; - - //---------------------------------------- - // Update - //---------------------------------------- - void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadId ); - - //---------------------------------------- - // Data members - //---------------------------------------- - bool m_Verbose; - unsigned int m_ComponentIndex; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkNVectorImageTo4DImageFilter.txx" -#endif - -#endif // #define clitkNVectorImageTo4DImageFilter_h - - diff --git a/tools/clitkNVectorImageTo4DImageFilter.txx b/tools/clitkNVectorImageTo4DImageFilter.txx deleted file mode 100644 index f5570cd..0000000 --- a/tools/clitkNVectorImageTo4DImageFilter.txx +++ /dev/null @@ -1,72 +0,0 @@ -/*========================================================================= - 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://www.centreleonberard.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 -===========================================================================**/ -#ifndef clitkNVectorImageTo4DImageFilter_txx -#define clitkNVectorImageTo4DImageFilter_txx - -/* ================================================= - * @file clitkNVectorImageTo4DImageFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Constructor - //------------------------------------------------------------------- - template - NVectorImageTo4DImageFilter::NVectorImageTo4DImageFilter() - { - m_Verbose=false; - m_ComponentIndex=0; - } - - - //------------------------------------------------------------------- - // Generate Data - //------------------------------------------------------------------- - template - void NVectorImageTo4DImageFilter::ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadId) - { - // Iterators - typename OutputImageType::Pointer output=this->GetOutput(); - typename InputImageType::ConstPointer input=this->GetInput(); - - typedef itk::ImageRegionConstIterator InputIteratorType; - InputIteratorType inputIt (input, outputRegionForThread); - - typedef itk::ImageRegionIterator OutputIteratorType; - OutputIteratorType outputIt (output, outputRegionForThread); - - while(! inputIt.IsAtEnd() ) - { - //outputIt.Set(inputIt.Get()[m_ComponentIndex]); - ++outputIt; - ++inputIt; - } - } - - -}//end clitk - -#endif //#define clitkNVectorImageTo4DImageFilter_txx diff --git a/tools/clitkNVectorImageTo4DImageGenericFilter.h b/tools/clitkNVectorImageTo4DImageGenericFilter.h index 7b6c074..14774ae 100644 --- a/tools/clitkNVectorImageTo4DImageGenericFilter.h +++ b/tools/clitkNVectorImageTo4DImageGenericFilter.h @@ -33,7 +33,6 @@ #include "clitkCommon.h" #include "clitkImageCommon.h" #include "clitkNVectorImageTo4DImage_ggo.h" -#include "clitkNVectorImageTo4DImageFilter.h" //itk include #include "itkLightObject.h" diff --git a/tools/clitkNVectorImageTo4DImageGenericFilter.txx b/tools/clitkNVectorImageTo4DImageGenericFilter.txx index 0c2d429..f85b374 100644 --- a/tools/clitkNVectorImageTo4DImageGenericFilter.txx +++ b/tools/clitkNVectorImageTo4DImageGenericFilter.txx @@ -42,8 +42,27 @@ namespace clitk { if (m_Verbose) std::cout << "Image was detected to be "<(); + if (PixelType == "short") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "unsigned short") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "unsigned_short") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "char") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "unsigned_char") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "int") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "unsigned_int") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "double") { + UpdateWithDimAndPixelType(); + } else if (PixelType == "float") { + UpdateWithDimAndPixelType(); + } else { + std::cerr << "Error, pixel type : \"" << PixelType << "\" unknown !" << std::endl; + } }