ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkComposeDisplacementFieldsImageFilter.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 __itkComposeDisplacementFieldsImageFilter_h
19 #define __itkComposeDisplacementFieldsImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
26 
39 template <class TInputImage, class TOutputImage = TInputImage>
41  : public ImageToImageFilter<TInputImage, TOutputImage>
42 {
43 public:
48 
50  itkNewMacro( Self );
51 
53  itkStaticConstMacro( ImageDimension, unsigned int,
54  TInputImage::ImageDimension );
55 
56  typedef TInputImage InputFieldType;
57  typedef TOutputImage OutputFieldType;
58 
60  typedef typename OutputFieldType::PixelType PixelType;
61  typedef typename OutputFieldType::PixelType VectorType;
62  typedef typename OutputFieldType::RegionType RegionType;
63  typedef typename OutputFieldType::IndexType IndexType;
64 
65  typedef typename OutputFieldType::PointType PointType;
66  typedef typename OutputFieldType::SpacingType SpacingType;
67  typedef typename OutputFieldType::PointType OriginType;
68  typedef typename OutputFieldType::SizeType SizeType;
69  typedef typename OutputFieldType::DirectionType DirectionType;
70 
72  typedef typename VectorType::ComponentType RealType;
75 
77  itkGetModifiableObjectMacro( Interpolator, InterpolatorType );
78 
80  void SetDisplacementField( const InputFieldType *field )
81  {
82  itkDebugMacro( "setting displacement field to " << field );
83  if ( field != this->GetInput( 0 ) )
84  {
85  this->SetInput( 0, field );
86  this->Modified();
87  if( !this->m_Interpolator.IsNull() )
88  {
89  this->m_Interpolator->SetInputImage( field );
90  }
91  }
92  }
94 
99  {
100  return this->GetInput( 0 );
101  }
102 
104  void SetWarpingField( const InputFieldType *field )
105  {
106  itkDebugMacro( "setting warping field to " << field );
107  if ( field != this->GetInput( 1 ) )
108  {
109  this->SetInput( 1, field );
110  }
111  }
113 
118  {
119  return this->GetInput( 1 );
120  }
121 
122  /* Set the interpolator. */
123  virtual void SetInterpolator( InterpolatorType* interpolator );
124 
125 protected:
126 
129 
132 
134  void PrintSelf( std::ostream& os, Indent indent ) const;
135 
138 
141 
142 private:
143  ComposeDisplacementFieldsImageFilter( const Self& ); //purposely not implemented
144  void operator=( const Self& ); //purposely not implemented
145 
148 
149 };
150 
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkComposeDisplacementFieldsImageFilter.hxx"
155 #endif
156 
157 #endif
158