ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTransformToDeformationFieldSource.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkTransformToDeformationFieldSource_h
19 #define itkTransformToDeformationFieldSource_h
20 
21 #include "itkTransform.h"
22 #include "itkImageSource.h"
23 
24 #ifndef ITKV3_COMPATIBILITY
25 #error "This file is only valid when ITKV3_COMPATIBILITY is turned on. Users are encouraged to convert to itk::TransformToDisplacementFieldSource in ITKv4"
26 #endif
27 
28 namespace itk
29 {
62 template< typename TOutputImage,
63  typename TTransformPrecisionType = double >
64 class ITK_TEMPLATE_EXPORT TransformToDeformationFieldSource:
65  public ImageSource< TOutputImage >
66 {
67 public:
73 
74  typedef TOutputImage OutputImageType;
75  typedef typename OutputImageType::Pointer OutputImagePointer;
76  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
77  typedef typename OutputImageType::RegionType OutputImageRegionType;
78 
80  itkNewMacro(Self);
81 
84 
86  itkStaticConstMacro(ImageDimension, unsigned int,
87  TOutputImage::ImageDimension);
88 
90  typedef Transform< TTransformPrecisionType,
91  itkGetStaticConstMacro(ImageDimension),
92  itkGetStaticConstMacro(ImageDimension) > TransformType;
95 
97  typedef typename OutputImageType::PixelType PixelType;
98  typedef typename PixelType::ValueType PixelValueType;
99  typedef typename OutputImageType::RegionType RegionType;
100  typedef typename RegionType::SizeType SizeType;
103  typedef typename OutputImageType::SpacingType SpacingType;
106 
109 
117  itkSetConstObjectMacro(Transform, TransformType);
118 
120  itkGetConstObjectMacro(Transform, TransformType);
121 
123  virtual void SetOutputSize(const SizeType & size);
124 
126  virtual const SizeType & GetOutputSize();
127 
130  virtual void SetOutputIndex(const IndexType & index);
131 
133  virtual const IndexType & GetOutputIndex();
134 
136  itkSetMacro(OutputRegion, OutputImageRegionType);
137 
139  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
140 
142  itkSetMacro(OutputSpacing, SpacingType);
143  virtual void SetOutputSpacing(const double *values);
145 
147  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
148 
150  itkSetMacro(OutputOrigin, OriginType);
151  virtual void SetOutputOrigin(const double *values);
153 
155  itkGetConstReferenceMacro(OutputOrigin, OriginType);
156 
158  itkSetMacro(OutputDirection, DirectionType);
159  itkGetConstReferenceMacro(OutputDirection, DirectionType);
161 
163  void SetOutputParametersFromImage(const ImageBaseType *image);
164 
166  virtual void GenerateOutputInformation() ITK_OVERRIDE;
167 
169  virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
170 
172  ModifiedTimeType GetMTime() const ITK_OVERRIDE;
173 
174 #ifdef ITK_USE_CONCEPT_CHECKING
175  // Begin concept checking
176  itkStaticConstMacro(PixelDimension, unsigned int,
178  itkConceptMacro( SameDimensionCheck,
180  // End concept checking
181 #endif
182 
183 protected:
186 
187  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
188 
192  void ThreadedGenerateData(
193  const OutputImageRegionType & outputRegionForThread,
194  ThreadIdType threadId) ITK_OVERRIDE;
195 
199  void NonlinearThreadedGenerateData(
200  const OutputImageRegionType & outputRegionForThread,
201  ThreadIdType threadId);
202 
206  void LinearThreadedGenerateData(
207  const OutputImageRegionType & outputRegionForThread,
208  ThreadIdType threadId);
209 
210 private:
211 
212  ITK_DISALLOW_COPY_AND_ASSIGN(TransformToDeformationFieldSource);
213 
215  RegionType m_OutputRegion; // region of the output image
216  TransformPointerType m_Transform; // Coordinate transform to use
217  SpacingType m_OutputSpacing; // output image spacing
218  OriginType m_OutputOrigin; // output image origin
219  DirectionType m_OutputDirection; // output image direction cosines
220 }; // end class
221  // TransformToDeformationFieldSource
222 } // end namespace itk
223 
224 #ifndef ITK_MANUAL_INSTANTIATION
225 #include "itkTransformToDeformationFieldSource.hxx"
226 #endif
227 
228 #endif // end #ifndef itkTransformToDeformationFieldSource_h
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
Base class for all process objects that output image data.
ImageBase< itkGetStaticConstMacro(ImageDimension) > ImageBaseType
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Base class for templated image classes.
Definition: itkImageBase.h:114
Generate a deformation field from a coordinate transform.
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Transform< TTransformPrecisionType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension) > TransformType
#define itkConceptMacro(name, concept)