ITK  4.8.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 <typename TInputImage, typename 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 ITK_OVERRIDE;
135 
137  void BeforeThreadedGenerateData() ITK_OVERRIDE;
138 
140  void ThreadedGenerateData( const RegionType &, ThreadIdType ) ITK_OVERRIDE;
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
virtual void SetInterpolator(InterpolatorType *interpolator)
void PrintSelf(std::ostream &os, Indent indent) const override
void ThreadedGenerateData(const RegionType &, ThreadIdType) override
Base class for all process objects that output image data.
virtual void SetInput(const InputImageType *image)
const InputImageType * GetInput() const
virtual void Modified() const
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
bool IsNull() const
VectorInterpolateImageFunction< InputFieldType, RealType > InterpolatorType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for all vector image interpolaters.
ImageToImageFilter< TInputImage, TOutputImage > Superclass