ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkDeformationFieldSource.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 __itkDeformationFieldSource_h
19 #define __itkDeformationFieldSource_h
20 
21 #include "itkImageSource.h"
22 #include "itkKernelTransform.h"
24 
25 #ifndef ITKV3_COMPATIBILITY
26 #error "This file is only valid when ITKV3_COMPATIBILITY is turned on. Users are encouraged to convert to itkLandmarkDisplacementFieldSource.h in ITKv4"
27 #endif
28 
29 namespace itk
30 {
53 template< class TOutputImage >
54 class ITK_EXPORT DeformationFieldSource:
55  public ImageSource< TOutputImage >
56 {
57 public:
63 
64  typedef TOutputImage OutputImageType;
65  typedef typename OutputImageType::Pointer OutputImagePointer;
66  typedef typename OutputImageType::RegionType OutputImageRegionType;
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(DeformationFieldSource, ImageSource);
73 
75  itkStaticConstMacro(ImageDimension, unsigned int,
76  TOutputImage::ImageDimension);
77 
87  typedef typename LandmarkContainer::ConstPointer LandmarkContainerPointer;
88 
90  typedef typename OutputImageType::SizeType OutputSizeType;
91 
93  typedef typename OutputImageType::IndexType OutputIndexType;
94 
96  typedef typename TOutputImage::PixelType OutputPixelType;
97  typedef typename OutputPixelType::ValueType OutputPixelComponentType;
98 
100  typedef typename TOutputImage::SpacingType SpacingType;
101  typedef typename TOutputImage::PointType OriginPointType;
102  typedef typename TOutputImage::DirectionType DirectionType;
103 
107  itkSetObjectMacro(KernelTransform, KernelTransformType);
108  itkGetModifiableObjectMacro(KernelTransform, KernelTransformType);
110 
112  itkSetMacro(OutputRegion, OutputImageRegionType);
113 
115  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
116 
118  itkSetMacro(OutputSpacing, SpacingType);
119  virtual void SetOutputSpacing(const double *values);
121 
123  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
124 
126  itkSetMacro(OutputOrigin, OriginPointType);
127  virtual void SetOutputOrigin(const double *values);
129 
131  itkSetMacro(OutputDirection, DirectionType);
132  itkGetConstReferenceMacro(OutputDirection, DirectionType);
134 
136  itkGetConstReferenceMacro(OutputOrigin, OriginPointType);
137 
139  itkSetConstObjectMacro(SourceLandmarks, LandmarkContainer);
140  itkSetConstObjectMacro(TargetLandmarks, LandmarkContainer);
142 
148  virtual void GenerateOutputInformation();
149 
151  unsigned long GetMTime(void) const;
152 
153 protected:
156  void PrintSelf(std::ostream & os, Indent indent) const;
157 
162  void GenerateData();
163 
167  void PrepareKernelBaseSpline();
168 
169 private:
170  DeformationFieldSource(const Self &); //purposely not implemented
171  void operator=(const Self &); //purposely not implemented
172 
173  KernelTransformPointerType m_KernelTransform; // Coordinate transform to
174  // use
175 
176  OutputImageRegionType m_OutputRegion; // Region of the output
177  // image
178  SpacingType m_OutputSpacing; // output image spacing
179  OriginPointType m_OutputOrigin; // output image origin
180  DirectionType m_OutputDirection; // output image direction
181  // cosines
182 
183  LandmarkContainerPointer m_SourceLandmarks; // List of source landmarks
184  LandmarkContainerPointer m_TargetLandmarks; // List of target landmarks
185 };
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkDeformationFieldSource.hxx"
190 #endif
191 
192 #endif
193