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 __clitkConeBeamProjectImageFilter_h
19 #define __clitkConeBeamProjectImageFilter_h
20 #include "clitkImageCommon.h"
21 #include "clitkImageCommon.h"
22 #include "clitkTransformUtilities.h"
23 #include "clitkExtractImageFilter.h"
24 #include "itkRayCastInterpolateImageFunctionWithOrigin.h"
27 #include "itkLightObject.h"
28 #include "itkResampleImageFilter.h"
29 #include "itkEuler3DTransform.h"
30 #include "itkExtractImageFilter.h"
31 #include "itkFlipImageFilter.h"
36 template <class InputImageType, class OutputImageType >
37 class ITK_EXPORT ConeBeamProjectImageFilter : public itk::LightObject
42 typedef ConeBeamProjectImageFilter Self;
43 typedef itk::LightObject Superclass;
44 typedef itk::SmartPointer<Self> Pointer;
45 typedef itk::SmartPointer<const Self> ConstPointer;
47 /** Method for creation through the object factory. */
50 /** Determine the image dimension. */
51 itkStaticConstMacro(InputImageDimension, unsigned int,
52 InputImageType::ImageDimension );
54 itkStaticConstMacro(OutputImageDimension, unsigned int,
55 OutputImageType::ImageDimension );
58 //========================================================================================
60 typedef typename InputImageType::Pointer InputImagePointer;
61 typedef typename InputImageType::ConstPointer InputImageConstPointer;
62 typedef typename InputImageType::PixelType InputPixelType;
63 typedef typename InputImageType::SizeType InputSizeType;
64 typedef typename InputImageType::SpacingType InputSpacingType;
65 typedef typename InputImageType::DirectionType InputDirectionType;
66 typedef typename InputImageType::IndexType InputIndexType;
67 typedef typename InputImageType::PointType InputPointType;
69 typedef typename OutputImageType::Pointer OutputImagePointer;
70 typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
71 typedef typename OutputImageType::PixelType OutputPixelType;
72 typedef typename OutputImageType::SizeType OutputSizeType;
73 typedef typename OutputImageType::SpacingType OutputSpacingType;
74 typedef typename OutputImageType::DirectionType OutputDirectionType;
75 typedef typename OutputImageType::IndexType OutputIndexType;
76 typedef typename OutputImageType::PointType OutputPointType;
78 typedef itk::Image<OutputPixelType, InputImageDimension> InternalImageType;
81 typedef itk::Euler3DTransform <double> TransformType;
82 typedef itk::ResampleImageFilter<InputImageType, InternalImageType > ResampleImageFilterType;
83 typedef itk::RayCastInterpolateImageFunctionWithOrigin<InputImageType,double> InterpolatorType;
84 typedef clitk::ExtractImageFilter<InternalImageType, OutputImageType> ExtractImageFilterType;
85 typedef itk::FlipImageFilter<OutputImageType> FlipImageFilterType;
86 typedef itk::Matrix<double,4,4> MatrixType;
88 //========================================================================================
90 //========================================================================================
92 void SetVerbose(const bool m){m_Verbose=m;}
93 void SetNumberOfThreads(const unsigned int v)
95 m_NumberOfThreadsIsGiven=true;
99 void SetInput(const InputImagePointer m) {m_Input=m;} //no reinitialize
101 //=================================================================================
102 //Geometry (reinitialize)
103 void SetIsoCenter( const InputPointType & i )
108 m_IsInitialized=false;
112 void SetSourceToScreen(const double& s)
114 if( m_SourceToScreen!=s)
117 m_IsInitialized=false;
121 void SetSourceToAxis( const double& s)
123 if( m_SourceToAxis!=s)
126 m_IsInitialized=false;
130 void SetProjectionAngle( const double& s)
132 if( m_SourceToScreen!=s)
135 m_IsInitialized=false;
139 void SetRigidTransformMatrix(const MatrixType& m)
141 if(m_RigidTransformMatrix != m)
143 m_RigidTransformMatrix=m;
144 m_IsInitialized=false;
148 void SetEdgePaddingValue(const OutputPixelType& p)
150 if (m_EdgePaddingValue!=p)
152 m_EdgePaddingValue=p;
153 m_IsInitialized=false;
158 //========================================================================================
159 //Output image properties
160 /** Get the size of the output image. */
161 void SetOutputSize(const OutputSizeType& p)
166 m_IsInitialized=false;
170 /** Set the output image spacing. */
171 void SetOutputSpacing(const OutputSpacingType& p)
173 if (m_OutputSpacing!=p)
176 m_IsInitialized=false;
180 /** Set the output image origin. */
181 void SetOutputOrigin(const OutputPointType& p)
183 if (m_OutputOrigin!=p)
186 m_IsInitialized=false;
190 /** Set the panelshift. */
191 void SetPanelShift(double x, double y)
193 if (m_PanelShift[0] != x)
196 m_IsInitialized=false;
198 if (m_PanelShift[1] != y)
201 m_IsInitialized=false;
205 /** Helper method to set the output parameters based on this image */
206 void SetOutputParametersFromImage( const OutputImagePointer image );
208 /** Helper method to set the output parameters based on this image */
209 void SetOutputParametersFromImage( const OutputImageConstPointer image );
211 //========================================================================================
213 void Initialize(void)throw (itk::ExceptionObject);
215 OutputImagePointer GetOutput(void);
218 ConeBeamProjectImageFilter();
219 ~ConeBeamProjectImageFilter() {};
223 bool m_NumberOfThreadsIsGiven;
224 unsigned int m_NumberOfThreads;
225 bool m_IsInitialized;
226 //std::string m_Mask;
229 InputImageConstPointer m_Input;
230 OutputImagePointer m_Output;
233 InputPointType m_IsoCenter;
234 double m_SourceToScreen;
235 double m_SourceToAxis;
236 double m_ProjectionAngle;
237 double m_PanelShift[2];
238 MatrixType m_RigidTransformMatrix;
239 OutputPixelType m_EdgePaddingValue;
242 TransformType::Pointer m_Transform;
243 typename ResampleImageFilterType::Pointer m_Resampler;
244 typename InterpolatorType::Pointer m_Interpolator;
245 typename ExtractImageFilterType::Pointer m_ExtractImageFilter;
246 typename FlipImageFilterType::Pointer m_FlipImageFilter;
249 OutputSizeType m_OutputSize; // Size of the output image
250 OutputSpacingType m_OutputSpacing; // output image spacing
251 OutputPointType m_OutputOrigin; // output image origin
255 } // end namespace clitk
256 #ifndef ITK_MANUAL_INSTANTIATION
257 #include "clitkConeBeamProjectImageFilter.txx"
260 #endif // #define __clitkConeBeamProjectImageFilter_h