ITK  4.3.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  ModifiedTimeType 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 
176 protected:
179 
180  void PrintSelf(std::ostream & os, Indent indent) const;
181 
185  void ThreadedGenerateData(
186  const OutputImageRegionType & outputRegionForThread,
187  ThreadIdType threadId);
188 
192  void NonlinearThreadedGenerateData(
193  const OutputImageRegionType & outputRegionForThread,
194  ThreadIdType threadId);
195 
199  void LinearThreadedGenerateData(
200  const OutputImageRegionType & outputRegionForThread,
201  ThreadIdType threadId);
202 
203 private:
204 
205  TransformToDisplacementFieldSource(const Self &); //purposely not implemented
206  void operator=(const Self &); //purposely not implemented
207 
209  RegionType m_OutputRegion; // region of the output image
210  TransformPointerType m_Transform; // Coordinate transform to use
211  SpacingType m_OutputSpacing; // output image spacing
212  OriginType m_OutputOrigin; // output image origin
213  DirectionType m_OutputDirection; // output image direction cosines
214 }; // end class
215  // TransformToDisplacementFieldSource
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkTransformToDisplacementFieldSource.hxx"
220 #endif
221 
222 #endif // end #ifndef __itkTransformToDisplacementFieldSource_h
223