ITK  4.2.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 
186  itkGetObjectMacro(Interpolator, InterpolatorType);
187 
189  itkSetMacro(OutputSpacing, SpacingType);
190  virtual void SetOutputSpacing(const double *values);
192 
194  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
195 
197  itkSetMacro(OutputOrigin, PointType);
198  virtual void SetOutputOrigin(const double *values);
200 
202  itkGetConstReferenceMacro(OutputOrigin, PointType);
203 
205  itkSetMacro(OutputDirection, DirectionType);
206  itkGetConstReferenceMacro(OutputDirection, DirectionType);
208 
210  itkSetMacro(EdgePaddingValue, PixelType);
211 
213  itkGetConstMacro(EdgePaddingValue, PixelType);
214 
220  virtual void GenerateOutputInformation();
221 
228  virtual void GenerateInputRequestedRegion();
229 
232  virtual void BeforeThreadedGenerateData();
233 
234 #ifdef ITK_USE_CONCEPT_CHECKING
235 
236  itkConceptMacro( InputHasNumericTraitsCheck,
237  ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
238  itkConceptMacro( OutputHasNumericTraitsCheck,
239  ( Concept::HasNumericTraits< ValueType > ) );
240  itkConceptMacro( DisplacementFieldHasNumericTraitsCheck,
241  ( Concept::HasNumericTraits< typename TDisplacementField::PixelType::ValueType > ) );
242 
244 #endif
245 protected:
246  WarpVectorImageFilter();
248  void PrintSelf(std::ostream & os, Indent indent) const;
250 
254  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
255  ThreadIdType threadId);
256 
257 private:
258  WarpVectorImageFilter(const Self &); //purposely not implemented
259  void operator=(const Self &); //purposely not implemented
260 
265 
267 };
268 } // end namespace itk
269 
270 #ifndef ITK_MANUAL_INSTANTIATION
271 #include "itkWarpVectorImageFilter.hxx"
272 #endif
273 
274 #endif
275