ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkTransformToDisplacementFieldSource.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 itkTransformToDisplacementFieldSource_h
19 #define itkTransformToDisplacementFieldSource_h
20 
21 #include "itkTransform.h"
22 #include "itkImageSource.h"
23 
24 namespace itk
25 {
58 template< typename TOutputImage,
59  typename TTransformPrecisionType = double >
60 class ITK_TEMPLATE_EXPORT TransformToDisplacementFieldSource:
61  public ImageSource< TOutputImage >
62 {
63 public:
69 
70  typedef TOutputImage OutputImageType;
71  typedef typename OutputImageType::Pointer OutputImagePointer;
72  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
73  typedef typename OutputImageType::RegionType OutputImageRegionType;
74 
76  itkNewMacro(Self);
77 
80 
82  itkStaticConstMacro(ImageDimension, unsigned int,
83  TOutputImage::ImageDimension);
84 
86  typedef Transform< TTransformPrecisionType,
87  itkGetStaticConstMacro(ImageDimension),
88  itkGetStaticConstMacro(ImageDimension) > TransformType;
91 
93  typedef typename OutputImageType::PixelType PixelType;
94  typedef typename PixelType::ValueType PixelValueType;
95  typedef typename OutputImageType::RegionType RegionType;
96  typedef typename RegionType::SizeType SizeType;
99  typedef typename OutputImageType::SpacingType SpacingType;
102 
105 
113  itkSetConstObjectMacro(Transform, TransformType);
114  itkGetConstObjectMacro(Transform, TransformType);
116 
118  virtual void SetOutputSize(const SizeType & size);
119 
121  virtual const SizeType & GetOutputSize();
122 
125  virtual void SetOutputIndex(const IndexType & index);
126 
128  virtual const IndexType & GetOutputIndex();
129 
131  itkSetMacro(OutputRegion, OutputImageRegionType);
132 
134  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
135 
137  itkSetMacro(OutputSpacing, SpacingType);
138  virtual void SetOutputSpacing(const double *values);
140 
142  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
143 
145  itkSetMacro(OutputOrigin, OriginType);
146  virtual void SetOutputOrigin(const double *values);
148 
150  itkGetConstReferenceMacro(OutputOrigin, OriginType);
151 
153  itkSetMacro(OutputDirection, DirectionType);
154  itkGetConstReferenceMacro(OutputDirection, DirectionType);
156 
158  void SetOutputParametersFromImage(const ImageBaseType *image);
159 
161  virtual void GenerateOutputInformation() ITK_OVERRIDE;
162 
164  virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
165 
167  ModifiedTimeType GetMTime() const ITK_OVERRIDE;
168 
169 #ifdef ITK_USE_CONCEPT_CHECKING
170  // Begin concept checking
171  itkStaticConstMacro(PixelDimension, unsigned int,
173  itkConceptMacro( SameDimensionCheck,
175  // End concept checking
176 #endif
177 
178 protected:
181 
182  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
183 
187  void ThreadedGenerateData(
188  const OutputImageRegionType & outputRegionForThread,
189  ThreadIdType threadId) ITK_OVERRIDE;
190 
194  void NonlinearThreadedGenerateData(
195  const OutputImageRegionType & outputRegionForThread,
196  ThreadIdType threadId);
197 
201  void LinearThreadedGenerateData(
202  const OutputImageRegionType & outputRegionForThread,
203  ThreadIdType threadId);
204 
205 private:
206 
207  ITK_DISALLOW_COPY_AND_ASSIGN(TransformToDisplacementFieldSource);
208 
210  RegionType m_OutputRegion; // region of the output image
211  TransformPointerType m_Transform; // Coordinate transform to use
212  SpacingType m_OutputSpacing; // output image spacing
213  OriginType m_OutputOrigin; // output image origin
214  DirectionType m_OutputDirection; // output image direction cosines
215 }; // end class
216  // TransformToDisplacementFieldSource
217 } // end namespace itk
218 
219 #ifndef ITK_MANUAL_INSTANTIATION
220 #include "itkTransformToDisplacementFieldSource.hxx"
221 #endif
222 
223 #endif // end #ifndef itkTransformToDisplacementFieldSource_h
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
Transform< TTransformPrecisionType, itkGetStaticConstMacro(ImageDimension), itkGetStaticConstMacro(ImageDimension) > TransformType
Base class for all process objects that output image data.
Generate a displacement field from a coordinate transform.
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
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
ImageBase< itkGetStaticConstMacro(ImageDimension) > ImageBaseType