ITK  4.4.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 itkTransformToDisplacementFieldSource.h in ITKv4"
26 #endif
27 
28 namespace itk
29 {
62 template< class TOutputImage,
63  class TTransformPrecisionType = double >
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;
101  typedef typename OutputImageType::IndexType IndexType;
102  typedef typename OutputImageType::PointType PointType;
103  typedef typename OutputImageType::SpacingType SpacingType;
104  typedef typename OutputImageType::PointType OriginType;
105  typedef typename OutputImageType::DirectionType DirectionType;
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(void);
167 
169  virtual void BeforeThreadedGenerateData(void);
170 
172  unsigned long GetMTime(void) const;
173 
174 #ifdef ITK_USE_CONCEPT_CHECKING
175 
176  itkStaticConstMacro(PixelDimension, unsigned int,
177  PixelType::Dimension);
178  itkConceptMacro( SameDimensionCheck,
180 
182 #endif
183 
184 protected:
187 
188  void PrintSelf(std::ostream & os, Indent indent) const;
189 
193  void ThreadedGenerateData(
194  const OutputImageRegionType & outputRegionForThread,
195  ThreadIdType threadId);
196 
200  void NonlinearThreadedGenerateData(
201  const OutputImageRegionType & outputRegionForThread,
202  ThreadIdType threadId);
203 
207  void LinearThreadedGenerateData(
208  const OutputImageRegionType & outputRegionForThread,
209  ThreadIdType threadId);
210 
211 private:
212 
213  TransformToDeformationFieldSource(const Self &); //purposely not implemented
214  void operator=(const Self &); //purposely not implemented
215 
217  RegionType m_OutputRegion; // region of the output image
218  TransformPointerType m_Transform; // Coordinate transform to use
219  SpacingType m_OutputSpacing; // output image spacing
220  OriginType m_OutputOrigin; // output image origin
221  DirectionType m_OutputDirection; // output image direction cosines
222 }; // end class
223  // TransformToDeformationFieldSource
224 } // end namespace itk
225 
226 #ifndef ITK_MANUAL_INSTANTIATION
227 #include "itkTransformToDeformationFieldSource.hxx"
228 #endif
229 
230 #endif // end #ifndef __itkTransformToDeformationFieldSource_h
231