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 __clitkForwardWarpImageFilter_h
19 #define __clitkForwardWarpImageFilter_h
20 #include "clitkImageCommon.h"
23 #include "itkImageToImageFilter.h"
25 #include "itkImageRegionIterator.h"
26 #include "itkImageRegionIteratorWithIndex.h"
27 #include "itkNumericTraits.h"
28 #if ITK_VERSION_MAJOR <= 4
29 #include "itkSimpleFastMutexLock.h"
37 template < class InputImageType, class OutputImageType, class DeformationFieldType >
38 class ForwardWarpImageFilter : public itk::ImageToImageFilter<InputImageType, OutputImageType>
42 typedef ForwardWarpImageFilter Self;
43 typedef itk::ImageToImageFilter<InputImageType,OutputImageType> Superclass;
44 typedef itk::SmartPointer<Self> Pointer;
45 typedef itk::SmartPointer<const Self> ConstPointer;
48 /** Method for creation through the object factory. */
51 /** Determine the image dimension. */
52 itkStaticConstMacro(ImageDimension, unsigned int,
53 InputImageType::ImageDimension );
54 itkStaticConstMacro(InputImageDimension, unsigned int,
55 OutputImageType::ImageDimension );
56 itkStaticConstMacro(DeformationFieldDimension, unsigned int,
57 DeformationFieldType::ImageDimension );
61 typedef double CoordRepType;
62 typedef itk::Image<double, ImageDimension> WeightsImageType;
63 #if ITK_VERSION_MAJOR <= 4
64 typedef itk::Image<itk::SimpleFastMutexLock, ImageDimension> MutexImageType;
68 typedef itk::Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
70 /** Inherit some types from the superclass. */
71 typedef typename OutputImageType::IndexType IndexType;
72 typedef typename OutputImageType::SizeType SizeType;
73 typedef typename OutputImageType::PixelType PixelType;
74 typedef typename OutputImageType::SpacingType SpacingType;
76 //Set & Get Methods (inline)
77 itkSetMacro( Verbose, bool);
78 itkSetMacro( EdgePaddingValue, PixelType );
79 itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
80 #if ITK_VERSION_MAJOR <= 4
81 void SetNumberOfThreads(unsigned int r )
83 void SetNumberOfWorkUnits(unsigned int r )
86 m_NumberOfThreadsIsGiven=true;
87 #if ITK_VERSION_MAJOR <= 4
90 m_NumberOfWorkUnits=r;
93 itkSetMacro(ThreadSafe, bool);
96 //ITK concept checking, why not?
97 #ifdef ITK_USE_CONCEPT_CHECKING
98 /** Begin concept checking */
99 itkConceptMacro(SameDimensionCheck1,
100 (itk::Concept::SameDimension<ImageDimension, InputImageDimension>));
101 itkConceptMacro(SameDimensionCheck2,
102 (itk::Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
103 itkConceptMacro(InputHasNumericTraitsCheck,
104 (itk::Concept::HasNumericTraits<typename InputImageType::PixelType>));
105 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
106 (itk::Concept::HasNumericTraits<typename DeformationFieldType::PixelType::ValueType>));
107 /** End concept checking */
111 ForwardWarpImageFilter();
112 ~ForwardWarpImageFilter() {};
113 void GenerateData( );
118 bool m_NumberOfThreadsIsGiven;
119 #if ITK_VERSION_MAJOR <= 4
120 unsigned int m_NumberOfThreads;
122 unsigned int m_NumberOfWorkUnits;
124 PixelType m_EdgePaddingValue;
125 typename DeformationFieldType::Pointer m_DeformationField;
134 } // end namespace clitk
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "clitkForwardWarpImageFilter.txx"
139 #endif // #define __clitkForwardWarpImageFilter_h