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"
+++ /dev/null
-/*=========================================================================
- 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 InputImageType, class OutputImageType>
- class ITK_EXPORT NVectorImageTo4DImageFilter :
- public itk::ImageToImageFilter<InputImageType, OutputImageType>
- {
- public:
- //----------------------------------------
- // ITK
- //----------------------------------------
- typedef NVectorImageTo4DImageFilter Self;
- typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
- typedef itk::SmartPointer<Self> Pointer;
- typedef itk::SmartPointer<const Self> 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
-
-
+++ /dev/null
-/*=========================================================================
- 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<class InputImageType, class OutputImageType>
- NVectorImageTo4DImageFilter<InputImageType, OutputImageType>::NVectorImageTo4DImageFilter()
- {
- m_Verbose=false;
- m_ComponentIndex=0;
- }
-
-
- //-------------------------------------------------------------------
- // Generate Data
- //-------------------------------------------------------------------
- template<class InputImageType, class OutputImageType>
- void NVectorImageTo4DImageFilter<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, itk::ThreadIdType threadId)
- {
- // Iterators
- typename OutputImageType::Pointer output=this->GetOutput();
- typename InputImageType::ConstPointer input=this->GetInput();
-
- typedef itk::ImageRegionConstIterator<InputImageType> InputIteratorType;
- InputIteratorType inputIt (input, outputRegionForThread);
-
- typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType;
- OutputIteratorType outputIt (output, outputRegionForThread);
-
- while(! inputIt.IsAtEnd() )
- {
- //outputIt.Set(inputIt.Get()[m_ComponentIndex]);
- ++outputIt;
- ++inputIt;
- }
- }
-
-
-}//end clitk
-
-#endif //#define clitkNVectorImageTo4DImageFilter_txx
#include "clitkCommon.h"
#include "clitkImageCommon.h"
#include "clitkNVectorImageTo4DImage_ggo.h"
-#include "clitkNVectorImageTo4DImageFilter.h"
//itk include
#include "itkLightObject.h"
{
if (m_Verbose) std::cout << "Image was detected to be "<<Dimension<<"D and "<< PixelType<<"..."<<std::endl;
- if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float..." << std::endl;
- UpdateWithDimAndPixelType<Dimension, float >();
+ if (PixelType == "short") {
+ UpdateWithDimAndPixelType<Dimension, short>();
+ } else if (PixelType == "unsigned short") {
+ UpdateWithDimAndPixelType<Dimension, unsigned short>();
+ } else if (PixelType == "unsigned_short") {
+ UpdateWithDimAndPixelType<Dimension, unsigned short>();
+ } else if (PixelType == "char") {
+ UpdateWithDimAndPixelType<Dimension, char>();
+ } else if (PixelType == "unsigned_char") {
+ UpdateWithDimAndPixelType<Dimension, unsigned char>();
+ } else if (PixelType == "int") {
+ UpdateWithDimAndPixelType<Dimension, int>();
+ } else if (PixelType == "unsigned_int") {
+ UpdateWithDimAndPixelType<Dimension, unsigned int>();
+ } else if (PixelType == "double") {
+ UpdateWithDimAndPixelType<Dimension, double>();
+ } else if (PixelType == "float") {
+ UpdateWithDimAndPixelType<Dimension, float>();
+ } else {
+ std::cerr << "Error, pixel type : \"" << PixelType << "\" unknown !" << std::endl;
+ }
}