18 #ifndef __otbNCCRegistrationFilter_txx
19 #define __otbNCCRegistrationFilter_txx
28 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
34 drfp = NCCRegistrationFunctionType::New();
36 drfp->SetDeformationField(this->GetDeformationField());
38 this->SetDifferenceFunction(static_cast<FiniteDifferenceFunctionType *>(
43 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
48 Superclass::PrintSelf(os, indent);
49 os << indent <<
"NCC Radius: " <<
50 this->GetNCCRadius() << std::endl;
56 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
63 Superclass::InitializeIteration();
68 (this->GetDifferenceFunction().GetPointer());
73 "Could not cast difference function to NCCRegistrationFunction");
89 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
97 (this->GetDifferenceFunction().GetPointer());
102 "Could not cast difference function to NCCRegistrationFunction");
112 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
120 (this->GetDifferenceFunction().GetPointer());
125 "Could not cast difference function to NCCRegistrationFunction");
135 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
143 (this->GetDifferenceFunction().GetPointer());
148 "Could not cast difference function to NCCRegistrationFunction");
156 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
163 const_cast<TFixedImage *
>(this->GetFixedImage());
165 const_cast<TMovingImage *
>(this->GetMovingImage());
166 typename TDeformationField::Pointer outputPtr = this->GetOutput();
168 if (!fixedPtr || !movingPtr || !outputPtr)
175 typename TDeformationField::RegionType requestedRegion;
176 requestedRegion = outputPtr->GetRequestedRegion();
179 requestedRegion.PadByRadius(this->GetNCCRadius());
182 if (requestedRegion.Crop(fixedPtr->GetLargestPossibleRegion()))
184 if (requestedRegion.Crop(movingPtr->GetLargestPossibleRegion()))
186 fixedPtr->SetRequestedRegion(requestedRegion);
187 movingPtr->SetRequestedRegion(requestedRegion);
196 movingPtr->SetRequestedRegion(requestedRegion);
202 "Requested region is (at least partially) outside the largest possible region of the moving image.");
214 fixedPtr->SetRequestedRegion(requestedRegion);
219 e.
SetDescription(
"Requested region is (at least partially) outside the largest possible region of the fixed image.");
228 template <
class TFixedImage,
class TMovingImage,
class TDeformationField>
240 this->Superclass::ApplyUpdate(dt);
244 (this->GetDifferenceFunction().GetPointer());
249 "Could not cast difference function to NCCRegistrationFunction");