template<typename TFixedImage, typename TMovingImage, typename TVirtualImage = TFixedImage, typename TInternalComputationValueType = double, typename TMetricTraits = DefaultImageToImageMetricTraitsv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType>>
class itk::ANTSNeighborhoodCorrelationImageToImageMetricv4< TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits >
Computes normalized cross correlation using a small neighborhood for each voxel between two images, with speed optimizations for dense registration.
Please see [6] for more details.
Around each voxel, the neighborhood is defined as a N-Dimensional rectangle centered at the voxel. The size of the rectangle is 2*radius+1. The normalized correlation between neighborhoods of fixed image and moving image are averaged over the whole image as the final metric.
- Note
- A radius less than 2 can be unstable. 2 is the default.
This class uses a specific fast implementation that is described in the above paper. There are two particular speed-ups:
1) It is assumed that the derivative is only affected by changes in the transform at the center of the window. This is obviously not true but speeds the evaluation up considerably and works well in practice. This assumption is the main differentiation of this approach from a more generic one.
2) The evaluation uses on-the-fly queues with multi-threading and a sliding neighborhood window. This is described in the above paper and specifically optimized for dense registration.
Example of usage:
using MetricType = itk::ANTSNeighborhoodCorrelationImageToImageMetricv4 <ImageType, ImageType>; using MetricTypePointer = MetricType::Pointer; MetricTypePointer metric = MetricType::New();
// set all parameters Size<Dimension> neighborhoodRadius; neighborhoodRadius.Fill(2); metric->SetRadius(neighborhood_radius); metric->SetFixedImage(fixedImage); metric->SetMovingImage(movingImage); metric->SetFixedTransform(transformFix); metric->SetMovingTransform(transformMov);
// initialization after parameters are set. metric->Initialize();
// getting derivative and metric value metric->GetValueAndDerivative(valueReturn, derivativeReturn);
This class is templated over the type of the two input objects. This is the base class for a hierarchy of similarity metrics that may, in derived classes, operate on meshes, images, etc. This class computes a value that measures the similarity between the two objects.
Definition at line 89 of file itkANTSNeighborhoodCorrelationImageToImageMetricv4.h.
|
virtual::itk::LightObject::Pointer | CreateAnother () const |
|
const char * | GetNameOfClass () const override |
|
virtual RadiusType | GetRadius () |
|
virtual RadiusType | GetRadius () const |
|
void | Initialize () override |
|
virtual void | SetRadius (RadiusType _arg) |
|
virtual void | FinalizeThread (const ThreadIdType) |
|
void | GetDerivative (DerivativeType &) const override |
|
virtual const FixedImageType * | GetFixedImage () const |
|
virtual const FixedImageGradientImageType * | GetFixedImageGradientImage () const |
|
virtual const FixedInterpolatorType * | GetFixedInterpolator () const |
|
MetricCategoryType | GetMetricCategory () const override |
|
virtual FixedImageGradientImageType * | GetModifiableFixedImageGradientImage () |
|
virtual FixedInterpolatorType * | GetModifiableFixedInterpolator () |
|
virtual MovingImageGradientImageType * | GetModifiableMovingImageGradientImage () |
|
virtual MovingInterpolatorType * | GetModifiableMovingInterpolator () |
|
virtual const MovingImageGradientImageType * | GetMovingImageGradientImage () const |
|
virtual const MovingInterpolatorType * | GetMovingInterpolator () const |
|
const char * | GetNameOfClass () const override |
|
SizeValueType | GetNumberOfDomainPoints () const |
|
virtual const SizeValueType & | GetNumberOfSkippedFixedSampledPoints () const |
|
virtual ThreadIdType | GetNumberOfWorkUnitsUsed () const |
|
MeasureType | GetValue () const override |
|
void | GetValueAndDerivative (MeasureType &value, DerivativeType &derivative) const override |
|
void | Initialize () override |
|
virtual void | SetFixedImage (const FixedImageType *_arg) |
|
virtual void | SetFixedInterpolator (FixedInterpolatorType *_arg) |
|
virtual void | SetMovingInterpolator (MovingInterpolatorType *_arg) |
|
bool | SupportsArbitraryVirtualDomainSamples () const override |
|
void | SetFixedObject (const ObjectType *object) override |
|
void | SetMovingObject (const ObjectType *object) override |
|
virtual void | SetMovingImage (const MovingImageType *_arg) |
|
virtual const MovingImageType * | GetMovingImage () const |
|
virtual void | SetMovingImageMask (const MovingImageMaskType *_arg) |
|
virtual const MovingImageMaskType * | GetMovingImageMask () const |
|
virtual void | SetFixedImageMask (const FixedImageMaskType *_arg) |
|
virtual const FixedImageMaskType * | GetFixedImageMask () const |
|
virtual void | SetFixedSampledPointSet (const FixedSampledPointSetType *_arg) |
|
virtual const FixedSampledPointSetType * | GetFixedSampledPointSet () const |
|
virtual void | SetVirtualSampledPointSet (VirtualPointSetType *_arg) |
|
virtual const VirtualPointSetType * | GetVirtualSampledPointSet () const |
|
virtual void | SetUseSampledPointSet (bool _arg) |
|
virtual const bool & | GetUseSampledPointSet () const |
|
virtual void | UseSampledPointSetOn () |
|
virtual void | UseSampledPointSetOff () |
|
virtual void | SetUseVirtualSampledPointSet (bool _arg) |
|
virtual const bool & | GetUseVirtualSampledPointSet () const |
|
virtual void | UseVirtualSampledPointSetOn () |
|
virtual void | UseVirtualSampledPointSetOff () |
|
virtual void | SetFixedImageGradientFilter (FixedImageGradientFilterType *_arg) |
|
virtual FixedImageGradientFilterType * | GetModifiableFixedImageGradientFilter () |
|
virtual const FixedImageGradientFilterType * | GetFixedImageGradientFilter () const |
|
virtual void | SetMovingImageGradientFilter (MovingImageGradientFilterType *_arg) |
|
virtual MovingImageGradientFilterType * | GetModifiableMovingImageGradientFilter () |
|
virtual const MovingImageGradientFilterType * | GetMovingImageGradientFilter () const |
|
virtual void | SetFixedImageGradientCalculator (FixedImageGradientCalculatorType *_arg) |
|
virtual FixedImageGradientCalculatorType * | GetModifiableFixedImageGradientCalculator () |
|
virtual const FixedImageGradientCalculatorType * | GetFixedImageGradientCalculator () const |
|
virtual void | SetMovingImageGradientCalculator (MovingImageGradientCalculatorType *_arg) |
|
virtual MovingImageGradientCalculatorType * | GetModifiableMovingImageGradientCalculator () |
|
virtual const MovingImageGradientCalculatorType * | GetMovingImageGradientCalculator () const |
|
virtual void | SetUseFixedImageGradientFilter (bool _arg) |
|
virtual const bool & | GetUseFixedImageGradientFilter () const |
|
virtual void | UseFixedImageGradientFilterOn () |
|
virtual void | UseFixedImageGradientFilterOff () |
|
virtual void | SetUseMovingImageGradientFilter (bool _arg) |
|
virtual const bool & | GetUseMovingImageGradientFilter () const |
|
virtual void | UseMovingImageGradientFilterOn () |
|
virtual void | UseMovingImageGradientFilterOff () |
|
virtual void | SetMaximumNumberOfWorkUnits (const ThreadIdType number) |
|
virtual ThreadIdType | GetMaximumNumberOfWorkUnits () const |
|
virtual void | SetUseFloatingPointCorrection (bool _arg) |
|
virtual const bool & | GetUseFloatingPointCorrection () const |
|
virtual void | UseFloatingPointCorrectionOn () |
|
virtual void | UseFloatingPointCorrectionOff () |
|
virtual void | SetFloatingPointCorrectionResolution (DerivativeValueType _arg) |
|
virtual DerivativeValueType | GetFloatingPointCorrectionResolution () const |
|
OffsetValueType | ComputeParameterOffsetFromVirtualIndex (const VirtualIndexType &index, const NumberOfParametersType &numberOfLocalParameters) const |
|
OffsetValueType | ComputeParameterOffsetFromVirtualPoint (const VirtualPointType &point, const NumberOfParametersType &numberOfLocalParameters) const |
|
virtual const FixedTransformType * | GetFixedTransform () const |
|
MetricCategoryType | GetMetricCategory () const override |
|
virtual FixedTransformType * | GetModifiableFixedTransform () |
|
virtual MovingTransformType * | GetModifiableMovingTransform () |
|
virtual VirtualImageType * | GetModifiableVirtualImage () |
|
virtual const MovingTransformType * | GetMovingTransform () const |
|
const char * | GetNameOfClass () const override |
|
NumberOfParametersType | GetNumberOfLocalParameters () const override |
|
NumberOfParametersType | GetNumberOfParameters () const override |
|
virtual SizeValueType | GetNumberOfValidPoints () const |
|
const ParametersType & | GetParameters () const override |
|
const MovingTransformType * | GetTransform () |
|
VirtualDirectionType | GetVirtualDirection () const |
|
virtual const TimeStamp & | GetVirtualDomainTimeStamp () const |
|
virtual const VirtualImageType * | GetVirtualImage () const |
|
VirtualOriginType | GetVirtualOrigin () const |
|
const VirtualRegionType & | GetVirtualRegion () const |
|
VirtualSpacingType | GetVirtualSpacing () const |
|
bool | HasLocalSupport () const override |
|
void | Initialize () override |
|
virtual void | SetFixedTransform (FixedTransformType *_arg) |
|
virtual void | SetMovingTransform (MovingTransformType *_arg) |
|
void | SetParameters (ParametersType ¶ms) override |
|
void | SetTransform (MovingTransformType *transform) |
|
void | SetVirtualDomain (const VirtualSpacingType &spacing, const VirtualOriginType &origin, const VirtualDirectionType &direction, const VirtualRegionType ®ion) |
|
void | SetVirtualDomainFromImage (const VirtualImageType *virtualImage) |
|
void | UpdateTransformParameters (const DerivativeType &derivative, double factor) override |
|
bool | IsInsideVirtualDomain (const VirtualPointType &point) const |
|
bool | IsInsideVirtualDomain (const VirtualIndexType &index) const |
|
MeasureType | GetCurrentValue () const |
|
MeasureType | GetCurrentValue () const |
|
virtual GradientSourceEnum | GetGradientSource () const |
|
virtual GradientSourceEnum | GetGradientSource () const |
|
bool | GetGradientSourceIncludesFixed () const |
|
bool | GetGradientSourceIncludesFixed () const |
|
bool | GetGradientSourceIncludesMoving () const |
|
bool | GetGradientSourceIncludesMoving () const |
|
const char * | GetNameOfClass () const override |
|
const char * | GetNameOfClass () const override |
|
virtual void | SetGradientSource (GradientSourceEnum _arg) |
|
virtual void | SetGradientSource (GradientSourceEnum _arg) |
|
virtual void | SetFixedObject (const ObjectType *_arg) |
|
virtual const ObjectType * | GetFixedObject () const |
|
virtual void | SetFixedObject (const ObjectType *_arg) |
|
virtual const ObjectType * | GetFixedObject () const |
|
virtual void | SetMovingObject (const ObjectType *_arg) |
|
virtual const ObjectType * | GetMovingObject () const |
|
virtual void | SetMovingObject (const ObjectType *_arg) |
|
virtual const ObjectType * | GetMovingObject () const |
|
const char * | GetNameOfClass () const override |
|
const char * | GetNameOfClass () const override |
|
unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
|
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
|
LightObject::Pointer | CreateAnother () const override |
|
virtual void | DebugOff () const |
|
virtual void | DebugOn () const |
|
Command * | GetCommand (unsigned long tag) |
|
bool | GetDebug () const |
|
MetaDataDictionary & | GetMetaDataDictionary () |
|
const MetaDataDictionary & | GetMetaDataDictionary () const |
|
virtual ModifiedTimeType | GetMTime () const |
|
virtual const TimeStamp & | GetTimeStamp () const |
|
bool | HasObserver (const EventObject &event) const |
|
void | InvokeEvent (const EventObject &) |
|
void | InvokeEvent (const EventObject &) const |
|
virtual void | Modified () const |
|
void | Register () const override |
|
void | RemoveAllObservers () |
|
void | RemoveObserver (unsigned long tag) const |
|
void | SetDebug (bool debugFlag) const |
|
void | SetReferenceCount (int) override |
|
void | UnRegister () const noexcept override |
|
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
|
void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
|
virtual void | SetObjectName (std::string _arg) |
|
virtual const std::string & | GetObjectName () const |
|
Pointer | Clone () const |
|
virtual void | Delete () |
|
virtual int | GetReferenceCount () const |
|
void | Print (std::ostream &os, Indent indent=0) const |
|
|
| ANTSNeighborhoodCorrelationImageToImageMetricv4 () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ~ANTSNeighborhoodCorrelationImageToImageMetricv4 () override=default |
|
virtual void | ComputeFixedImageGradientAtPoint (const FixedImagePointType &mappedPoint, FixedImageGradientType &gradient) const |
|
virtual void | ComputeFixedImageGradientFilterImage () |
|
virtual void | ComputeMovingImageGradientAtPoint (const MovingImagePointType &mappedPoint, MovingImageGradientType &gradient) const |
|
virtual void | ComputeMovingImageGradientFilterImage () const |
|
virtual bool | GetComputeDerivative () const |
|
virtual void | GetValueAndDerivativeExecute () const |
|
| ImageToImageMetricv4 () |
|
virtual void | InitializeForIteration () const |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
bool | TransformAndEvaluateFixedPoint (const VirtualPointType &virtualPoint, FixedImagePointType &mappedFixedPoint, FixedImagePixelType &mappedFixedPixelValue) const |
|
bool | TransformAndEvaluateMovingPoint (const VirtualPointType &virtualPoint, MovingImagePointType &mappedMovingPoint, MovingImagePixelType &mappedMovingPixelValue) const |
|
| ~ImageToImageMetricv4 () override=default |
|
virtual void | InitializeDefaultFixedImageGradientFilter () |
|
virtual void | InitializeDefaultMovingImageGradientFilter () |
|
const MovingDisplacementFieldTransformType * | GetMovingDisplacementFieldTransform () const |
|
| ObjectToObjectMetric () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
bool | TransformPhysicalPointToVirtualIndex (const VirtualPointType &, VirtualIndexType &) const |
|
void | TransformVirtualIndexToPhysicalPoint (const VirtualIndexType &, VirtualPointType &) const |
|
virtual void | VerifyDisplacementFieldSizeAndPhysicalSpace () |
|
bool | VerifyNumberOfValidPoints (MeasureType &value, DerivativeType &derivative) const |
|
| ~ObjectToObjectMetric () override=default |
|
| ObjectToObjectMetricBaseTemplate () |
|
| ObjectToObjectMetricBaseTemplate () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ~ObjectToObjectMetricBaseTemplate () override=default |
|
| ~ObjectToObjectMetricBaseTemplate () override=default |
|
| SingleValuedCostFunctionv4Template ()=default |
|
| SingleValuedCostFunctionv4Template ()=default |
|
| ~SingleValuedCostFunctionv4Template () override=default |
|
| ~SingleValuedCostFunctionv4Template () override=default |
|
| CostFunctionTemplate ()=default |
|
| CostFunctionTemplate ()=default |
|
| ~CostFunctionTemplate () override=default |
|
| ~CostFunctionTemplate () override=default |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
|
| ~Object () override |
|
virtual LightObject::Pointer | InternalClone () const |
|
| LightObject () |
|
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
|
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
|
virtual | ~LightObject () |
|