ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkWarpVectorImageFilter.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 __itkWarpVectorImageFilter_h
19 #define __itkWarpVectorImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 #include "itkPoint.h"
24 #include "itkFixedArray.h"
25 
26 namespace itk
27 {
87 template<
88  class TInputImage,
89  class TOutputImage,
90  class TDisplacementField
91  >
92 class ITK_EXPORT WarpVectorImageFilter:
93  public ImageToImageFilter< TInputImage, TOutputImage >
94 {
95 public:
101 
103  itkNewMacro(Self);
104 
107 
109  typedef typename TOutputImage::RegionType OutputImageRegionType;
110 
112  typedef typename Superclass::InputImageType InputImageType;
113  typedef typename Superclass::InputImagePointer InputImagePointer;
114  typedef typename Superclass::OutputImageType OutputImageType;
115  typedef typename Superclass::OutputImagePointer OutputImagePointer;
116  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
117 
118  typedef typename OutputImageType::IndexType IndexType;
119  typedef typename OutputImageType::SizeType SizeType;
120  typedef typename OutputImageType::PixelType PixelType;
121  typedef typename OutputImageType::SpacingType SpacingType;
122  typedef typename OutputImageType::PixelType::ValueType ValueType;
123 
125  itkStaticConstMacro(ImageDimension, unsigned int,
126  TOutputImage::ImageDimension);
127 
129  itkStaticConstMacro(PixelDimension, unsigned int,
130  PixelType::Dimension);
131 
133  typedef TDisplacementField DisplacementFieldType;
134  typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
135  typedef typename DisplacementFieldType::PixelType DisplacementType;
136 
137 #ifdef ITKV3_COMPATIBILITY
138  typedef TDisplacementField DeformationFieldType;
139  typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
140  typedef typename DeformationFieldType::PixelType DeformationType;
141 #endif
142 
144  typedef double CoordRepType;
149 
152 
154  typedef typename TOutputImage::DirectionType DirectionType;
155 
157  void SetDisplacementField(const DisplacementFieldType *field);
158 
160  void SetDisplacementField(DisplacementFieldType *field);
161 
163  DisplacementFieldType * GetDisplacementField(void);
164 
165 #ifdef ITKV3_COMPATIBILITY
166  void SetDeformationField(const DeformationFieldType *field)
167  {
168  this->SetDisplacementField(field);
169  }
170 
171  void SetDeformationField(DeformationFieldType *field)
172  {
173  this->SetDisplacementField(field);
174  }
175 
176  DeformationFieldType * GetDeformationField(void)
177  {
178  return static_cast<DeformationFieldType *> (GetDisplacementField());
179  }
180 #endif
181 
183  itkSetObjectMacro(Interpolator, InterpolatorType);
184  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
186 
188  itkSetMacro(OutputSpacing, SpacingType);
189  virtual void SetOutputSpacing(const double *values);
191 
193  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
194 
196  itkSetMacro(OutputOrigin, PointType);
197  virtual void SetOutputOrigin(const double *values);
199 
201  itkGetConstReferenceMacro(OutputOrigin, PointType);
202 
204  itkSetMacro(OutputDirection, DirectionType);
205  itkGetConstReferenceMacro(OutputDirection, DirectionType);
207 
209  itkSetMacro(EdgePaddingValue, PixelType);
210 
212  itkGetConstMacro(EdgePaddingValue, PixelType);
213 
219  virtual void GenerateOutputInformation();
220 
227  virtual void GenerateInputRequestedRegion();
228 
231  virtual void BeforeThreadedGenerateData();
232 
233 #ifdef ITK_USE_CONCEPT_CHECKING
234 
235  itkConceptMacro( InputHasNumericTraitsCheck,
236  ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
237  itkConceptMacro( OutputHasNumericTraitsCheck,
238  ( Concept::HasNumericTraits< ValueType > ) );
239  itkConceptMacro( DisplacementFieldHasNumericTraitsCheck,
240  ( Concept::HasNumericTraits< typename TDisplacementField::PixelType::ValueType > ) );
241 
243 #endif
244 
245 protected:
246  WarpVectorImageFilter();
248  void PrintSelf(std::ostream & os, Indent indent) const;
249 
253  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
254  ThreadIdType threadId);
255 
256 private:
257  WarpVectorImageFilter(const Self &); //purposely not implemented
258  void operator=(const Self &); //purposely not implemented
259 
264 
266 };
267 } // end namespace itk
268 
269 #ifndef ITK_MANUAL_INSTANTIATION
270 #include "itkWarpVectorImageFilter.hxx"
271 #endif
272 
273 #endif
274