ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationFilter.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 itkVariationalRegistrationFilter_h
19 #define itkVariationalRegistrationFilter_h
20 
22 
27 
28 namespace itk {
29 
100 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
102  : public DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField >
103 {
104 public:
105  ITK_DISALLOW_COPY_AND_ASSIGN(VariationalRegistrationFilter);
106 
110  TDisplacementField, TDisplacementField >;
113 
115  itkNewMacro(Self);
116 
119 
121  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
122 
124  using FixedImageType = TFixedImage;
125  using FixedImagePointer = typename FixedImageType::Pointer;
126  using FixedImageConstPointer = typename FixedImageType::ConstPointer;
127 
129  using MovingImageType = TMovingImage;
130  using MovingImagePointer = typename MovingImageType::Pointer;
131  using MovingImageConstPointer = typename MovingImageType::ConstPointer;
132 
134  using DisplacementFieldType = TDisplacementField;
135  using DisplacementFieldPointer = typename DisplacementFieldType::Pointer;
136 
138  using MaskImagePixelType = unsigned char;
142 
145 
148 
152 
157 
159  itkSetObjectMacro( Regularizer, RegularizerType );
160 
162  itkGetConstReferenceObjectMacro( Regularizer, RegularizerType );
163 
165  virtual void SetFixedImage( const FixedImageType * ptr );
166 
168  virtual const FixedImageType * GetFixedImage(void) const;
169 
171  virtual void SetMovingImage( const MovingImageType * ptr );
172 
174  virtual const MovingImageType * GetMovingImage(void) const;
175 
177  virtual void SetMaskImage( const MaskImageType * ptr );
178 
180  virtual const MaskImageType * GetMaskImage(void) const;
181 
184  { this->SetInput( ptr ); }
185 
188  { return this->GetOutput(); }
189 
194  std::vector<SmartPointer<DataObject> >::size_type GetNumberOfValidRequiredInputs() const override;
195 
200  itkBooleanMacro( SmoothDisplacementField );
201 
206  itkSetMacro( SmoothDisplacementField, bool );
207 
211  itkGetConstMacro( SmoothDisplacementField, bool );
212 
216  itkSetMacro( SmoothUpdateField, bool );
217 
222  itkGetConstMacro( SmoothUpdateField, bool );
223 
227  itkBooleanMacro( SmoothUpdateField );
228 
233  virtual double GetMetric() const;
234 
236  virtual void StopRegistration()
237  { m_StopRegistrationFlag = true; }
238 
239 protected:
242 
244  void PrintSelf(std::ostream& os, Indent indent) const override;
245 
252  void GenerateInputRequestedRegion() override;
253 
258  void GenerateOutputInformation() override;
259 
262  void CopyInputToOutput() override;
263 
265  void Initialize() override;
266 
269  void InitializeIteration() override;
270 
272  void ApplyUpdate( const TimeStepType& dt ) override;
273 
279  void VerifyInputInformation() const override {}
280 
283  bool Halt() override
284  { return (Superclass::Halt() || m_StopRegistrationFlag); }
285 
292 
293 private:
296 
299 
303 
304 };
305 
306 }// end namespace itk
307 
308 #ifndef ITK_MANUAL_INSTANTIATION
309 # include "itkVariationalRegistrationFilter.hxx"
310 #endif
311 
312 #endif
virtual void SetMovingImage(const MovingImageType *ptr)
virtual void SetMaskImage(const MaskImageType *ptr)
Base class for force calculation in the variational registration framework.
Light weight base class for most itk classes.
typename FixedImageType::Pointer FixedImagePointer
typename RegularizerType::Pointer RegularizerPointer
Flexible framework for deformable registration of two images using PDE-based variational registration...
virtual const MaskImageType * GetMaskImage(void) const
typename Superclass::OutputImageType OutputImageType
void GenerateOutputInformation() override
Base class for regularization component in the variational registration framework.
typename FixedImageType::ConstPointer FixedImageConstPointer
typename DisplacementFieldType::Pointer DisplacementFieldPointer
typename MaskImageType::Pointer MaskImagePointer
virtual const MovingImageType * GetMovingImage(void) const
typename MaskImageType::ConstPointer MaskImageConstPointer
virtual DisplacementFieldType * GetDisplacementField()
virtual void SetInput(const InputImageType *image)
virtual double GetMetric() const
RegistrationFunctionType * DownCastDifferenceFunctionType()
void PrintSelf(std::ostream &os, Indent indent) const override
void ApplyUpdate(const TimeStepType &dt) override
VariationalRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > RegistrationFunctionType
virtual void SetInitialDisplacementField(DisplacementFieldType *ptr)
SmartPointer< const Self > ConstPointer
Definition: itkImage.h:84
typename Superclass::TimeStepType TimeStepType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
This class performs diffusive regularization of a vector field.
typename MovingImageType::ConstPointer MovingImageConstPointer
SmartPointer< Self > Pointer
Definition: itkImage.h:83
virtual const FixedImageType * GetFixedImage(void) const
std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const override
void GenerateInputRequestedRegion() override
This class computes different Demon forces in the variational registration framework.
virtual void SetFixedImage(const FixedImageType *ptr)
Templated n-dimensional image class.
Definition: itkImage.h:75
typename MovingImageType::Pointer MovingImagePointer