ITK  4.4.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  itkGetConstObjectMacro(Transform, TransformType);
112 
114  virtual void SetOutputSize(const SizeType & size);
115 
117  virtual const SizeType & GetOutputSize();
118 
121  virtual void SetOutputIndex(const IndexType & index);
122 
124  virtual const IndexType & GetOutputIndex();
125 
127  itkSetMacro(OutputRegion, OutputImageRegionType);
128 
130  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
131 
133  itkSetMacro(OutputSpacing, SpacingType);
134  virtual void SetOutputSpacing(const double *values);
136 
138  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
139 
141  itkSetMacro(OutputOrigin, OriginType);
142  virtual void SetOutputOrigin(const double *values);
144 
146  itkGetConstReferenceMacro(OutputOrigin, OriginType);
147 
149  itkSetMacro(OutputDirection, DirectionType);
150  itkGetConstReferenceMacro(OutputDirection, DirectionType);
152 
154  void SetOutputParametersFromImage(const ImageBaseType *image);
155 
157  virtual void GenerateOutputInformation(void);
158 
160  virtual void BeforeThreadedGenerateData(void);
161 
163  ModifiedTimeType GetMTime(void) const;
164 
165 #ifdef ITK_USE_CONCEPT_CHECKING
166 
167  itkStaticConstMacro(PixelDimension, unsigned int,
168  PixelType::Dimension);
169  itkConceptMacro( SameDimensionCheck,
171 
173 #endif
174 
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