1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef clitkResampleBSplineDeformableTransformImageFilter_h
19 #define clitkResampleBSplineDeformableTransformImageFilter_h
21 /* =================================================
22 * @file clitkResampleBSplineDeformableTransformImageFilter.h
28 ===================================================*/
33 #include "clitkCommon.h"
34 #include "clitkVectorBSplineDecompositionImageFilterWithOBD.h"
35 #include "clitkVectorBSplineResampleImageFunction.h"
38 #include "itkImageToImageFilter.h"
39 #include "itkVectorResampleImageFilter.h"
40 #include "itkCastImageFilter.h"
46 template <class InputImageType, class OutputImageType>
47 class ITK_EXPORT ResampleBSplineDeformableTransformImageFilter :
48 public itk::ImageToImageFilter<InputImageType, OutputImageType>
51 //----------------------------------------
53 //----------------------------------------
54 typedef ResampleBSplineDeformableTransformImageFilter Self;
55 typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
56 typedef itk::SmartPointer<Self> Pointer;
57 typedef itk::SmartPointer<const Self> ConstPointer;
59 // Method for creation through the object factory
62 // Run-time type information (and related methods)
63 itkTypeMacro( ResampleBSplineDeformableTransformImageFilter, ImageToImageFilter );
65 /** Dimension of the domain space. */
66 itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension);
68 //----------------------------------------
70 //----------------------------------------
71 typedef typename InputImageType::PointType InputPointType;
72 typedef typename InputImageType::IndexType IndexType;
74 typedef typename OutputImageType::RegionType OutputImageRegionType;
75 typedef typename OutputImageType::PointType OutputPointType;
76 typedef typename OutputImageType::SpacingType OutputSpacingType;
77 typedef typename OutputImageType::DirectionType OutputDirectionType;
78 typedef typename OutputImageType::IndexType OutputIndexType;
79 typedef typename OutputImageType::SizeType OutputSizeType;
82 //----------------------------------------
84 //----------------------------------------
85 itkBooleanMacro(Verbose);
86 itkSetMacro( Verbose, bool);
87 itkGetConstReferenceMacro( Verbose, bool);
89 // Properties of the output
90 itkSetMacro( Size, OutputSizeType );
91 itkGetConstReferenceMacro( Size, OutputSizeType );
92 itkSetMacro(OutputSpacing, OutputSpacingType);
93 virtual void SetOutputSpacing( const double* values);
94 itkGetConstReferenceMacro( OutputSpacing, OutputSpacingType );
95 itkSetMacro(OutputOrigin, OutputPointType);
96 virtual void SetOutputOrigin( const double* values);
97 itkGetConstReferenceMacro( OutputOrigin, OutputPointType );
98 itkSetMacro(OutputDirection, OutputDirectionType);
99 itkGetConstReferenceMacro(OutputDirection, OutputDirectionType);
100 itkSetMacro( OutputStartIndex, OutputIndexType );
101 itkGetConstReferenceMacro( OutputStartIndex, OutputIndexType );
102 void SetOutputParametersFromImage ( typename OutputImageType::Pointer Image )
104 this->SetOutputOrigin ( Image->GetOrigin() );
105 this->SetOutputSpacing ( Image->GetSpacing() );
106 this->SetOutputDirection ( Image->GetDirection() );
107 this->SetSize ( Image->GetLargestPossibleRegion().GetSize() );
108 this->SetOutputStartIndex(Image->GetLargestPossibleRegion().GetIndex());
111 void SetOutputParametersFromConstImage ( typename OutputImageType::ConstPointer Image )
113 this->SetOutputOrigin ( Image->GetOrigin() );
114 this->SetOutputSpacing ( Image->GetSpacing() );
115 this->SetOutputDirection ( Image->GetDirection() );
116 this->SetSize ( Image->GetLargestPossibleRegion().GetSize() );
117 this->SetOutputStartIndex(Image->GetLargestPossibleRegion().GetIndex());
123 //----------------------------------------
124 // Constructor & Destructor
125 //----------------------------------------
126 ResampleBSplineDeformableTransformImageFilter();
127 ~ResampleBSplineDeformableTransformImageFilter() {};
129 //----------------------------------------
131 //----------------------------------------
133 void GenerateData(void);
134 // // Threaded Generate Data
135 // void BeforeThreadedGenerateData(void );
136 // void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId );
137 // void AfterThreadedGenerateData(void );
138 // // Override defaults
139 // virtual void GenerateInputRequestedRegion();
140 // virtual void GenerateOutputInformation (void);
141 // virtual void EnlargeOutputRequestedRegion(DataObject *data);
142 void AllocateOutputs(){};
144 //----------------------------------------
146 //----------------------------------------
148 OutputSizeType m_Size; // Size of the output image
149 OutputSpacingType m_OutputSpacing; // output image spacing
150 OutputPointType m_OutputOrigin; // output image origin
151 OutputDirectionType m_OutputDirection; // output image direction cosines
152 OutputIndexType m_OutputStartIndex; // output image start index
153 OutputSizeType m_SplineOrders;
155 //----------------------------------------
157 //----------------------------------------
158 typedef itk::VectorResampleImageFilter<InputImageType, OutputImageType> ResamplerType;
159 typedef VectorBSplineResampleImageFunction<InputImageType, double> FunctionType;
160 typedef itk::IdentityTransform<double,InputImageDimension> IdentityTransformType;
161 typedef VectorBSplineDecompositionImageFilterWithOBD<OutputImageType, OutputImageType> DecompositionType;
162 typename ResamplerType::Pointer m_Resampler;
163 typename FunctionType::Pointer m_Function;
164 typename IdentityTransformType::Pointer m_Identity;
165 typename DecompositionType::Pointer m_Decomposition;
171 } // end namespace clitk
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "clitkResampleBSplineDeformableTransformImageFilter.txx"
177 #endif // #define clitkResampleBSplineDeformableTransformImageFilter_h