ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkPDEDeformableRegistrationFilter_h 00019 #define __itkPDEDeformableRegistrationFilter_h 00020 00021 #include "itkDenseFiniteDifferenceImageFilter.h" 00022 #include "itkPDEDeformableRegistrationFunction.h" 00023 00024 namespace itk 00025 { 00072 template< class TFixedImage, class TMovingImage, class TDisplacementField > 00073 class ITK_EXPORT PDEDeformableRegistrationFilter: 00074 public DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField > 00075 { 00076 public: 00077 00079 typedef PDEDeformableRegistrationFilter Self; 00080 typedef DenseFiniteDifferenceImageFilter< TDisplacementField, TDisplacementField > Superclass; 00081 typedef SmartPointer< Self > Pointer; 00082 typedef SmartPointer< const Self > ConstPointer; 00083 00085 itkNewMacro(Self); 00086 00088 itkTypeMacro(PDEDeformableRegistrationFilter, 00089 DenseFiniteDifferenceImageFilter); 00090 00092 typedef TFixedImage FixedImageType; 00093 typedef typename FixedImageType::Pointer FixedImagePointer; 00094 typedef typename FixedImageType::ConstPointer FixedImageConstPointer; 00095 00097 typedef TMovingImage MovingImageType; 00098 typedef typename MovingImageType::Pointer MovingImagePointer; 00099 typedef typename MovingImageType::ConstPointer MovingImageConstPointer; 00100 00102 typedef TDisplacementField DisplacementFieldType; 00103 typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer; 00104 00105 #ifdef ITKV3_COMPATIBILITY 00106 typedef TDisplacementField DeformationFieldType; 00107 typedef typename DeformationFieldType::Pointer DeformationFieldPointer; 00108 #endif 00109 00111 typedef typename Superclass::OutputImageType OutputImageType; 00112 00114 typedef typename Superclass::FiniteDifferenceFunctionType 00115 FiniteDifferenceFunctionType; 00116 00118 typedef PDEDeformableRegistrationFunction< FixedImageType, MovingImageType, 00119 DisplacementFieldType > PDEDeformableRegistrationFunctionType; 00120 00122 itkStaticConstMacro(ImageDimension, unsigned int, 00123 Superclass::ImageDimension); 00124 00126 void SetFixedImage(const FixedImageType *ptr); 00127 00129 const FixedImageType * GetFixedImage(void) const; 00130 00132 void SetMovingImage(const MovingImageType *ptr); 00133 00135 const MovingImageType * GetMovingImage(void) const; 00136 00138 void SetInitialDisplacementField(const DisplacementFieldType *ptr) 00139 { this->SetInput(ptr); } 00140 00142 DisplacementFieldType * GetDisplacementField() 00143 { return this->GetOutput(); } 00144 00145 #ifdef ITKV3_COMPATIBILITY 00146 virtual void SetInitialDeformationField(DeformationFieldType *ptr) 00147 { 00148 this->SetInitialDisplacementField(ptr); 00149 } 00150 00152 DeformationFieldType * GetDeformationField(void) 00153 { 00154 return static_cast<DeformationFieldType *> (this->GetDisplacementField()); 00155 } 00156 #endif 00157 00163 virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const; 00164 00170 itkSetMacro(SmoothDisplacementField, bool); 00171 itkGetConstMacro(SmoothDisplacementField, bool); 00172 itkBooleanMacro(SmoothDisplacementField); 00174 00175 #ifdef ITKV3_COMPATIBILITY 00176 virtual void SetSmoothDeformationField(bool val) 00177 { 00178 SetSmoothDisplacementField(val); 00179 } 00180 virtual bool GetSmoothDeformationField() 00181 { 00182 return this->GetSmoothDisplacementField(); 00183 } 00184 virtual void SmoothDeformationFieldOn() 00185 { 00186 this->SmoothDisplacementFieldOn(); 00187 } 00188 virtual void SmoothDeformationFieldOff() 00189 { 00190 this->SmoothDisplacementFieldOff(); 00191 } 00192 #endif 00193 00194 typedef FixedArray< double, ImageDimension > StandardDeviationsType; 00195 00199 itkSetMacro(StandardDeviations, StandardDeviationsType); 00200 virtual void SetStandardDeviations(double value); 00202 00205 itkGetConstReferenceMacro(StandardDeviations, StandardDeviationsType); 00206 00212 itkSetMacro(SmoothUpdateField, bool); 00213 itkGetConstMacro(SmoothUpdateField, bool); 00214 itkBooleanMacro(SmoothUpdateField); 00216 00219 itkSetMacro(UpdateFieldStandardDeviations, StandardDeviationsType); 00220 virtual void SetUpdateFieldStandardDeviations(double value); 00222 00225 itkGetConstReferenceMacro(UpdateFieldStandardDeviations, StandardDeviationsType); 00226 00228 virtual void StopRegistration() 00229 { m_StopRegistrationFlag = true; } 00230 00233 itkSetMacro(MaximumError, double); 00234 itkGetConstMacro(MaximumError, double); 00236 00239 itkSetMacro(MaximumKernelWidth, unsigned int); 00240 itkGetConstMacro(MaximumKernelWidth, unsigned int); 00241 protected: 00242 PDEDeformableRegistrationFilter(); 00243 ~PDEDeformableRegistrationFilter() {} 00244 void PrintSelf(std::ostream & os, Indent indent) const; 00246 00249 virtual bool Halt() 00250 { 00251 if ( m_StopRegistrationFlag ) 00252 { 00253 return true; 00254 } 00255 00256 return this->Superclass::Halt(); 00257 } 00258 00261 virtual void CopyInputToOutput(); 00262 00265 virtual void InitializeIteration(); 00266 00270 virtual void SmoothDisplacementField(); 00271 #ifdef ITKV3_COMPATIBILITY 00272 virtual void SmoothDeformationField() 00273 { 00274 this->SmoothDisplacementField(); 00275 } 00276 #endif 00277 00281 virtual void SmoothUpdateField(); 00282 00285 virtual void PostProcessOutput(); 00286 00288 virtual void Initialize(); 00289 00294 virtual void GenerateOutputInformation(); 00295 00302 virtual void GenerateInputRequestedRegion(); 00303 00304 private: 00305 PDEDeformableRegistrationFilter(const Self &); //purposely not implemented 00306 void operator=(const Self &); //purposely not implemented 00307 00309 StandardDeviationsType m_StandardDeviations; 00310 StandardDeviationsType m_UpdateFieldStandardDeviations; 00311 00313 bool m_SmoothDisplacementField; 00314 bool m_SmoothUpdateField; 00315 00318 DisplacementFieldPointer m_TempField; 00319 private: 00320 00322 double m_MaximumError; 00323 00325 unsigned int m_MaximumKernelWidth; 00326 00328 bool m_StopRegistrationFlag; 00329 }; 00330 } // end namespace itk 00331 00332 #ifndef ITK_MANUAL_INSTANTIATION 00333 #include "itkPDEDeformableRegistrationFilter.hxx" 00334 #endif 00335 00336 #endif 00337