7 #include <itkImageToImageMetric.h> 9 #include <itkLinearInterpolateImageFunction.h> 14 template <
typename TInputImageType>
19 m_DefaultBackgroundValue = 0.0;
22 template <
typename TInputImageType>
33 template <
typename TInputImageType>
40 switch(m_SimilarityType)
47 typename LocalMetricType::Pointer tmpMetric = LocalMetricType::New();
49 tmpMetric->SetDefaultBackgroundValue(m_DefaultBackgroundValue);
59 typename LocalMetricType::Pointer tmpMetric = LocalMetricType::New();
60 tmpMetric->SetDefaultBackgroundValue(m_DefaultBackgroundValue);
67 typedef itk::ImageToImageMetric <InputImageType,InputImageType> BaseMetricType;
68 BaseMetricType *baseMetric = dynamic_cast <BaseMetricType *> (metric.GetPointer());
70 typedef itk::LinearInterpolateImageFunction<InputImageType,double> LocalInterpolatorType;
71 typename LocalInterpolatorType::Pointer interpolator = LocalInterpolatorType::New();
73 baseMetric->SetInterpolator(interpolator);
74 baseMetric->ComputeGradientOff();
76 baseMetric->SetFixedImage(this->GetReferenceImage());
77 baseMetric->SetMovingImage(this->GetMovingImage());
78 interpolator->SetInputImage(this->GetMovingImage());
83 template <
typename TInputImageType>
88 switch (m_SimilarityType)
94 return (val + 1) / 2.0;
102 template <
typename TInputImageType>
108 this->Superclass::BlockMatchingSetup(metric,block);
111 typedef itk::ImageToImageMetric <InputImageType, InputImageType> InternalMetricType;
112 InternalMetricType *tmpMetric = dynamic_cast <InternalMetricType *> (metric.GetPointer());
113 tmpMetric->SetFixedImageRegion(this->GetBlockRegion(block));
114 tmpMetric->SetTransform(this->GetBlockTransformPointer(block));
115 tmpMetric->Initialize();
Superclass::MetricPointer MetricPointer
virtual MetricPointer SetupMetric()
bool GetMaximizedMetric()
virtual double ComputeBlockWeight(double val, unsigned int block)
virtual void BlockMatchingSetup(MetricPointer &metric, unsigned int block)