ITK  4.2.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 {
54 template< class TOutputImage,
55  class TTransformPrecisionType = double >
57  public ImageSource< TOutputImage >
58 {
59 public:
65 
66  typedef TOutputImage OutputImageType;
67  typedef typename OutputImageType::Pointer OutputImagePointer;
68  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
69  typedef typename OutputImageType::RegionType OutputImageRegionType;
70 
72  itkNewMacro(Self);
73 
76 
78  itkStaticConstMacro(ImageDimension, unsigned int,
79  TOutputImage::ImageDimension);
80 
82  typedef Transform< TTransformPrecisionType,
83  itkGetStaticConstMacro(ImageDimension),
84  itkGetStaticConstMacro(ImageDimension) > TransformType;
87 
89  typedef typename OutputImageType::PixelType PixelType;
90  typedef typename PixelType::ValueType PixelValueType;
91  typedef typename OutputImageType::RegionType RegionType;
92  typedef typename RegionType::SizeType SizeType;
93  typedef typename OutputImageType::IndexType IndexType;
94  typedef typename OutputImageType::PointType PointType;
95  typedef typename OutputImageType::SpacingType SpacingType;
96  typedef typename OutputImageType::PointType OriginType;
97  typedef typename OutputImageType::DirectionType DirectionType;
98 
101 
109  itkSetConstObjectMacro(Transform, TransformType);
110 
112  itkGetConstObjectMacro(Transform, TransformType);
113 
115  virtual void SetOutputSize(const SizeType & size);
116 
118  virtual const SizeType & GetOutputSize();
119 
122  virtual void SetOutputIndex(const IndexType & index);
123 
125  virtual const IndexType & GetOutputIndex();
126 
128  itkSetMacro(OutputRegion, OutputImageRegionType);
129 
131  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
132 
134  itkSetMacro(OutputSpacing, SpacingType);
135  virtual void SetOutputSpacing(const double *values);
137 
139  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
140 
142  itkSetMacro(OutputOrigin, OriginType);
143  virtual void SetOutputOrigin(const double *values);
145 
147  itkGetConstReferenceMacro(OutputOrigin, OriginType);
148 
150  itkSetMacro(OutputDirection, DirectionType);
151  itkGetConstReferenceMacro(OutputDirection, DirectionType);
153 
155  void SetOutputParametersFromImage(const ImageBaseType *image);
156 
158  virtual void GenerateOutputInformation(void);
159 
161  virtual void BeforeThreadedGenerateData(void);
162 
164  unsigned long GetMTime(void) const;
165 
166 #ifdef ITK_USE_CONCEPT_CHECKING
167 
168  itkStaticConstMacro(PixelDimension, unsigned int,
169  PixelType::Dimension);
170  itkConceptMacro( SameDimensionCheck,
172 
174 #endif
175 protected:
178 
179  void PrintSelf(std::ostream & os, Indent indent) const;
180 
184  void ThreadedGenerateData(
185  const OutputImageRegionType & outputRegionForThread,
186  ThreadIdType threadId);
187 
191  void NonlinearThreadedGenerateData(
192  const OutputImageRegionType & outputRegionForThread,
193  ThreadIdType threadId);
194 
198  void LinearThreadedGenerateData(
199  const OutputImageRegionType & outputRegionForThread,
200  ThreadIdType threadId);
201 
202 private:
203 
204  TransformToDisplacementFieldSource(const Self &); //purposely not implemented
205  void operator=(const Self &); //purposely not implemented
206 
208  RegionType m_OutputRegion; // region of the output image
209  TransformPointerType m_Transform; // Coordinate transform to use
210  SpacingType m_OutputSpacing; // output image spacing
211  OriginType m_OutputOrigin; // output image origin
212  DirectionType m_OutputDirection; // output image direction cosines
213 }; // end class
214  // TransformToDisplacementFieldSource
215 } // end namespace itk
216 
217 #ifndef ITK_MANUAL_INSTANTIATION
218 #include "itkTransformToDisplacementFieldSource.hxx"
219 #endif
220 
221 #endif // end #ifndef __itkTransformToDisplacementFieldSource_h
222