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 #include "itkSimpleFastMutexLock.h"
33 template < class InputImageType, class OutputImageType, class DeformationFieldType >
34 class ForwardWarpImageFilter : public itk::ImageToImageFilter<InputImageType, OutputImageType>
38 typedef ForwardWarpImageFilter Self;
39 typedef itk::ImageToImageFilter<InputImageType,OutputImageType> Superclass;
40 typedef itk::SmartPointer<Self> Pointer;
41 typedef itk::SmartPointer<const Self> ConstPointer;
44 /** Method for creation through the object factory. */
47 /** Determine the image dimension. */
48 itkStaticConstMacro(ImageDimension, unsigned int,
49 InputImageType::ImageDimension );
50 itkStaticConstMacro(InputImageDimension, unsigned int,
51 OutputImageType::ImageDimension );
52 itkStaticConstMacro(DeformationFieldDimension, unsigned int,
53 DeformationFieldType::ImageDimension );
57 typedef double CoordRepType;
58 typedef itk::Image<double, ImageDimension> WeightsImageType;
59 typedef itk::Image<itk::SimpleFastMutexLock, ImageDimension> MutexImageType;
62 typedef itk::Point<CoordRepType,itkGetStaticConstMacro(ImageDimension)> PointType;
64 /** Inherit some types from the superclass. */
65 typedef typename OutputImageType::IndexType IndexType;
66 typedef typename OutputImageType::SizeType SizeType;
67 typedef typename OutputImageType::PixelType PixelType;
68 typedef typename OutputImageType::SpacingType SpacingType;
70 //Set & Get Methods (inline)
71 itkSetMacro( Verbose, bool);
72 itkSetMacro( EdgePaddingValue, PixelType );
73 itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
74 #if ITK_VERSION_MAJOR <= 4
75 void SetNumberOfThreads(unsigned int r )
77 void SetNumberOfWorkUnits(unsigned int r )
80 m_NumberOfThreadsIsGiven=true;
81 #if ITK_VERSION_MAJOR <= 4
84 m_NumberOfWorkUnits=r;
87 itkSetMacro(ThreadSafe, bool);
90 //ITK concept checking, why not?
91 #ifdef ITK_USE_CONCEPT_CHECKING
92 /** Begin concept checking */
93 itkConceptMacro(SameDimensionCheck1,
94 (itk::Concept::SameDimension<ImageDimension, InputImageDimension>));
95 itkConceptMacro(SameDimensionCheck2,
96 (itk::Concept::SameDimension<ImageDimension, DeformationFieldDimension>));
97 itkConceptMacro(InputHasNumericTraitsCheck,
98 (itk::Concept::HasNumericTraits<typename InputImageType::PixelType>));
99 itkConceptMacro(DeformationFieldHasNumericTraitsCheck,
100 (itk::Concept::HasNumericTraits<typename DeformationFieldType::PixelType::ValueType>));
101 /** End concept checking */
105 ForwardWarpImageFilter();
106 ~ForwardWarpImageFilter() {};
107 void GenerateData( );
112 bool m_NumberOfThreadsIsGiven;
113 #if ITK_VERSION_MAJOR <= 4
114 unsigned int m_NumberOfThreads;
116 unsigned int m_NumberOfWorkUnits;
118 PixelType m_EdgePaddingValue;
119 typename DeformationFieldType::Pointer m_DeformationField;
128 } // end namespace clitk
129 #ifndef ITK_MANUAL_INSTANTIATION
130 #include "clitkForwardWarpImageFilter.txx"
133 #endif // #define __clitkForwardWarpImageFilter_h