ITK  4.3.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 
110  itkGetObjectMacro(KernelTransform, KernelTransformType);
111 
113  itkSetMacro(OutputRegion, OutputImageRegionType);
114 
116  itkGetConstReferenceMacro(OutputRegion, OutputImageRegionType);
117 
119  itkSetMacro(OutputSpacing, SpacingType);
120  virtual void SetOutputSpacing(const double *values);
122 
124  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
125 
127  itkSetMacro(OutputOrigin, OriginPointType);
128  virtual void SetOutputOrigin(const double *values);
130 
132  itkSetMacro(OutputDirection, DirectionType);
133  itkGetConstReferenceMacro(OutputDirection, DirectionType);
135 
137  itkGetConstReferenceMacro(OutputOrigin, OriginPointType);
138 
140  itkSetConstObjectMacro(SourceLandmarks, LandmarkContainer);
141  itkSetConstObjectMacro(TargetLandmarks, LandmarkContainer);
143 
149  virtual void GenerateOutputInformation();
150 
152  unsigned long GetMTime(void) const;
153 
154 protected:
157  void PrintSelf(std::ostream & os, Indent indent) const;
158 
163  void GenerateData();
164 
168  void PrepareKernelBaseSpline();
169 
170 private:
171  DeformationFieldSource(const Self &); //purposely not implemented
172  void operator=(const Self &); //purposely not implemented
173 
174  KernelTransformPointerType m_KernelTransform; // Coordinate transform to
175  // use
176 
177  OutputImageRegionType m_OutputRegion; // Region of the output
178  // image
179  SpacingType m_OutputSpacing; // output image spacing
180  OriginPointType m_OutputOrigin; // output image origin
181  DirectionType m_OutputDirection; // output image direction
182  // cosines
183 
184  LandmarkContainerPointer m_SourceLandmarks; // List of source landmarks
185  LandmarkContainerPointer m_TargetLandmarks; // List of target landmarks
186 };
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkDeformationFieldSource.hxx"
191 #endif
192 
193 #endif
194