17 template <
typename TInputImageType>
27 template <
typename TInputImageType>
35 template <
typename TInputImageType>
41 interpolator->SetReferenceOutputModel(this->GetReferenceImage()->GetDescriptionModel());
43 interpolator->Register();
47 template <
typename TInputImageType>
52 typedef typename TInputImageType::IOPixelType InputPixelType;
54 typedef typename InitializerType::Pointer InitializerPointer;
56 InitializerPointer initPtr = InitializerType::New();
57 initPtr->AddReferenceImage(this->GetReferenceImage());
59 if (this->GetNumberOfWorkUnits() != 0)
60 initPtr->SetNumberOfThreads(this->GetNumberOfWorkUnits());
62 initPtr->SetPercentageKept(this->GetBlockPercentageKept());
63 initPtr->SetBlockSize(this->GetBlockSize());
64 initPtr->SetBlockSpacing(this->GetBlockSpacing());
65 initPtr->SetOrientedModelVarianceThreshold(this->GetBlockVarianceThreshold());
67 initPtr->SetRequestedRegion(this->GetReferenceImage()->GetLargestPossibleRegion());
69 this->SetBlockRegions(initPtr->GetOutput());
70 this->SetBlockPositions(initPtr->GetOutputPositions());
72 std::cout <<
"Generated " << this->GetBlockRegions().size() <<
" blocks..." << std::endl;
74 this->GetBlockTransformPointers().resize(this->GetBlockRegions().size());
75 std::vector <double> newBlockWeights(this->GetBlockRegions().size(),0);
76 this->SetBlockWeights(newBlockWeights);
77 for (
unsigned int i = 0;i < this->GetBlockRegions().size();++i)
78 this->GetBlockTransformPointer(i) = this->GetNewBlockTransform(this->GetBlockPositions()[i]);
81 template <
typename TInputImageType>
88 switch(m_SimilarityType)
96 typename MetricType::Pointer tmpMetric = MetricType::New();
107 typename MetricType::Pointer tmpMetric = MetricType::New();
117 typename MetricType::Pointer tmpMetric = MetricType::New();
118 tmpMetric->SetSmallDelta(m_SmallDelta);
119 tmpMetric->SetBigDelta(m_BigDelta);
120 tmpMetric->SetGradientStrengths(m_GradientStrengths);
121 tmpMetric->SetGradientDirections(m_GradientDirections);
122 if ((m_GradientStrengths.size() > 0)&&(m_GradientDirections.size() > 0))
123 tmpMetric->SetForceApproximation(
true);
135 typename MetricType::Pointer tmpMetric = MetricType::New();
136 tmpMetric->SetSmallDelta(m_SmallDelta);
137 tmpMetric->SetBigDelta(m_BigDelta);
138 tmpMetric->SetGradientStrengths(m_GradientStrengths);
139 tmpMetric->SetGradientDirections(m_GradientDirections);
140 if ((m_GradientStrengths.size() > 0)&&(m_GradientDirections.size() > 0))
141 tmpMetric->SetForceApproximation(
true);
149 BaseMetricType *baseMetric = dynamic_cast <BaseMetricType *> (metric.GetPointer());
154 baseMetric->SetModelRotation((
typename BaseMetricType::ModelReorientationType)m_ModelRotationType);
158 baseMetric->SetInterpolator(interpolator);
160 baseMetric->SetFixedImage(this->GetReferenceImage());
161 baseMetric->SetMovingImage(this->GetMovingImage());
166 template <
typename TInputImageType>
174 template <
typename TInputImageType>
180 this->Superclass::BlockMatchingSetup(metric,block);
184 InternalMetricType *tmpMetric = dynamic_cast <InternalMetricType *> (metric.GetPointer());
186 tmpMetric->SetTransform(this->GetBlockTransformPointer(block));
187 tmpMetric->Initialize();
190 typename InputImageType::IOPixelType,
191 InputImageType::ImageDimension > MCMBasicMeanSquaresMetricType;
194 typename InputImageType::IOPixelType,
195 InputImageType::ImageDimension > MTPairingCorrelationMetricType;
198 typename InputImageType::IOPixelType,
199 InputImageType::ImageDimension > MCMMeanSquaresMetricType;
202 typename InputImageType::IOPixelType,
203 InputImageType::ImageDimension > MCMCorrelationMetricType;
205 switch(m_SimilarityType)
208 ((MCMMeanSquaresMetricType *)metric.GetPointer())->PreComputeFixedValues();
211 ((MTPairingCorrelationMetricType *)metric.GetPointer())->PreComputeFixedValues();
214 ((MCMCorrelationMetricType *)metric.GetPointer())->PreComputeFixedValues();
219 ((MCMBasicMeanSquaresMetricType *)metric.GetPointer())->PreComputeFixedValues();
virtual MetricPointer SetupMetric()
bool GetMaximizedMetric()
virtual void SetFixedImageRegion(FixedImageRegionType _arg)
Superclass::MetricPointer MetricPointer
itk::SingleValuedCostFunction MetricType
virtual void SetModelRotation(ModelReorientationType _arg)
const double DiffusionBigDelta
Default big delta value (classical values)
const double DiffusionSmallDelta
Default small delta value (classical values)
itk::SmartPointer< Self > Pointer
Superclass::MetricPointer MetricPointer
virtual void BlockMatchingSetup(MetricPointer &metric, unsigned int block)
virtual double ComputeBlockWeight(double val, unsigned int block)
Multi-tensor correlation similarity measure as defined by Taquet et al, based on pairing of the indiv...
virtual MCMInterpolatorType * CreateInterpolator()