15 #ifndef itkBlockMatchingMethod_h
16 #define itkBlockMatchingMethod_h
20 #include <itkResampleImageFilter.h>
22 #include <itkPointSet.h>
23 #include <itkRegionOfInterestImageFilter.h>
24 #include <itkNearestNeighborInterpolateImageFunction.h>
26 #include <itkDefaultStaticMeshTraits.h>
28 #include <itkCovarianceSampleFilter.h>
29 #include <itkImageToListSampleAdaptor.h>
30 #include <itkGradientMagnitudeImageFilter.h>
31 #include <itkMinimumMaximumImageCalculator.h>
66 template <
typename TImageType,
class TScalarType>
85 itkStaticConstMacro(
Dimension,
unsigned int, TImageType::ImageDimension);
116 typedef NearestNeighborInterpolateImageFunction< TImageType,
120 typedef PointSet< TScalarType,
121 TImageType::ImageDimension,
122 DefaultStaticMeshTraits
125 TImageType::ImageDimension,
126 TImageType::ImageDimension,
132 typedef typename PointSetType::PointsContainer::ConstIterator
PointIterator;
145 itkSetObjectMacro(PointSetMetric, PointSetMetricType);
146 itkGetObjectMacro(PointSetMetric, PointSetMetricType);
149 itkSetMacro(MaximumNumberOfIterationsRoundMainLoop,
unsigned int);
150 itkGetMacro(MaximumNumberOfIterationsRoundMainLoop,
unsigned int);
167 void SetBlockParameters(
169 double blockHalfWidth,
171 double blockSubSampling);
176 itkGetMacro(BlockSize,
double);
181 itkGetMacro(BlockHalfWidth,
double);
186 itkGetMacro(BlockSpacing,
double);
191 itkGetMacro(BlockSubSampling,
double);
194 itkSetMacro(TransformedMovingImageFileName,
std::string);
195 itkGetMacro(TransformedMovingImageFileName,
std::string);
198 itkSetMacro(TransformedMovingImageFileExt,
std::string);
199 itkGetMacro(TransformedMovingImageFileExt,
std::string);
202 itkSetMacro(WriteTransformedMovingImage,
bool);
203 itkGetMacro(WriteTransformedMovingImage,
bool);
209 itkSetMacro(Epsilon,
double);
210 itkGetMacro(Epsilon,
double);
216 itkSetMacro(ParameterReductionFactor,
double);
217 itkGetMacro(ParameterReductionFactor,
double);
220 itkSetMacro(MinimumBlockSize,
double);
221 itkGetMacro(MinimumBlockSize,
double);
231 itkSetMacro(PercentageOfPointsToKeep,
int);
232 itkGetMacro(PercentageOfPointsToKeep,
int);
241 itkSetMacro(PercentageOfPointsInLeastTrimmedSquares,
int);
242 itkGetMacro(PercentageOfPointsInLeastTrimmedSquares,
int);
248 itkSetMacro(UseGradientMagnitudeVariance,
bool);
249 itkGetMacro(UseGradientMagnitudeVariance,
bool);
252 itkSetMacro(ScaleByMillimetres,
bool);
253 itkGetMacro(ScaleByMillimetres,
bool);
256 itkSetMacro(PointSetFileNameWithoutExtension,
std::string);
257 itkGetMacro(PointSetFileNameWithoutExtension,
std::string);
260 itkSetMacro(WritePointSet,
bool);
261 itkGetMacro(WritePointSet,
bool);
264 itkSetMacro(NoZero,
bool);
265 itkGetMacro(NoZero,
bool);
268 itkSetMacro(TransformedMovingImagePadValue, ImagePixelType);
269 itkGetMacro(TransformedMovingImagePadValue, ImagePixelType);
275 void PrintSelf(std::ostream& os, Indent indent)
const;
278 virtual void Initialize() throw (ExceptionObject);
281 virtual
void DoRegistration() throw (ExceptionObject);
284 virtual
void WritePointSet(const PointsContainerPointer& fixedPointContainer,
285 const PointsContainerPointer& movingPointContainer);
288 virtual
void GetPointCorrespondencies2D(
291 ImageSizeType& bigOmega,
292 ImageSizeType& bigDeltaOne,
293 ImageSizeType& bigDeltaTwo,
294 PointsContainerPointer& fixedPointContainer,
295 PointsContainerPointer& movingPointContainer
299 virtual
void GetPointCorrespondencies3D(
302 ImageSizeType& bigOmega,
303 ImageSizeType& bigDeltaOne,
304 ImageSizeType& bigDeltaTwo,
305 PointsContainerPointer& fixedPointContainer,
306 PointsContainerPointer& movingPointContainer
310 virtual
bool CheckEpsilon(ParametersType& previousParameters, ParametersType& currentParameters);
313 virtual
double CheckSinglePoint(ParametersType& previousParameters, ParametersType& currentParameters, ImageIndexType&
index);
316 virtual
void TrimPoints(const TransformType*
transform,
317 const PointsContainerType* fixedPoints,
318 const PointsContainerType* movingPoints,
319 PointsContainerType* trimmedFixedPoints,
320 PointsContainerType* trimmedMovingPoints);
332 this->index = anIndex;
337 this->key = another.key;
338 this->index = another.index;
342 const VarianceHeapDataType&
x,
const VarianceHeapDataType&
y)
350 void SetKey(
const TScalarType& aKey) { this->key = aKey; }
351 TScalarType
GetKey()
const {
return this->key; }
353 void SetIndex(
const ImageIndexType& anIndex) { this->index = anIndex; }
358 ImageIndexType
index;
371 ResidualHeapDataType(
const TScalarType& aResidual,
const PointType& aFixedPoint,
const PointType& aMovingPoint)
373 this->residual = aResidual;
374 this->fixed = aFixedPoint;
375 this->moving = aMovingPoint;
380 this->residual = another.residual;
381 this->fixed = another.fixed;
382 this->moving = another.moving;
394 void SetResidual(
const TScalarType& aResidual) { this->residual = aResidual; }
397 void SetFixed(
const PointType& aFixedPoint) { this->fixed = aFixedPoint; }
400 void SetMoving(
const PointType& aMovingPoint) { this->moving = aMovingPoint; }
404 TScalarType residual;
414 void operator=(
const Self&);
416 ResampleFilterPointer m_MovingImageResampler;
418 RegionOfInterestFilterPointer m_FixedImageRegionFilter;
420 ImageTypeListAdaptorPointer m_FixedImageListAdaptor;
421 ImageTypeCovarianceSampleFilterPointer m_FixedImageCovarianceSampleFilter;
423 GradientMagnitudeFilterPointer m_GradientMagnitudeImageFilter;
424 GradientImageTypeListAdaptorPointer m_GradientMagnitudeListAdaptor;
425 GradientImageTypeCovarianceSampleFilterPointer m_GradientMagnitudeCovarianceSampleFilter;
427 DummyInterpolatorPointer m_DummyInterpolator;
429 PointSetPointer m_FixedPointSet;
430 PointsContainerPointer m_FixedPointSetContainer;
432 PointSetPointer m_MovingPointSet;
433 PointsContainerPointer m_MovingPointSetContainer;
435 PointSetMetricPointer m_PointSetMetric;
437 unsigned int m_MaximumNumberOfIterationsRoundMainLoop;
441 double m_BlockHalfWidth;
443 double m_BlockSpacing;
445 double m_BlockSubSampling;
449 double m_ParameterReductionFactor;
451 double m_MinimumBlockSize;
453 int m_PercentageOfPointsToKeep;
455 int m_PercentageOfPointsInLeastTrimmedSquares;
461 bool m_WriteTransformedMovingImage;
465 bool m_WritePointSet;
467 bool m_ScaleByMillimetres;
469 bool m_UseGradientMagnitudeVariance;
473 ImagePixelType m_TransformedMovingImagePadValue;
475 MinimumMaximumImageCalculatorPointer m_MinMaxCalculator;
480 #ifndef ITK_MANUAL_INSTANTIATION
481 #include "itkBlockMatchingMethod.txx"
PointSet< TScalarType, TImageType::ImageDimension, DefaultStaticMeshTraits< TScalarType, TImageType::ImageDimension, TImageType::ImageDimension, TScalarType, TScalarType > > PointSetType
Definition: itkBlockMatchingMethod.h:130
PointSetType::Pointer PointSetPointer
Definition: itkBlockMatchingMethod.h:133
VarianceHeapDataType(const TScalarType &aKey, const ImageIndexType &anIndex)
Definition: itkBlockMatchingMethod.h:329
TScalarType GetKey() const
Definition: itkBlockMatchingMethod.h:351
itk::Statistics::ImageToListSampleAdaptor< ImageType > ImageTypeListAdaptorType
Definition: itkBlockMatchingMethod.h:100
friend bool operator<(const VarianceHeapDataType &x, const VarianceHeapDataType &y)
Definition: itkBlockMatchingMethod.h:341
GradientImageTypeCovarianceSampleFilterType::Pointer GradientImageTypeCovarianceSampleFilterPointer
Definition: itkBlockMatchingMethod.h:112
Superclass::ParametersType ParametersType
Definition: itkSingleResolutionImageRegistrationMethod.h:52
Abstract base class, implementing TemplateMethod [2] for similarity measures.
Definition: itkSimilarityMeasure.h:56
Base class for NifTK Image Registration Methods employing a binary mask.
Definition: itkMaskedImageRegistrationMethod.h:55
ImageType::SizeType SizeType
Definition: niftkMakeLapUSProbeBasicModel.cxx:31
void operator=(const ResidualHeapDataType &another)
Definition: itkBlockMatchingMethod.h:378
std::priority_queue< VarianceHeapDataType > VarianceHeap
Definition: itkBlockMatchingMethod.h:361
ImageTypeListAdaptorType::Pointer ImageTypeListAdaptorPointer
Definition: itkBlockMatchingMethod.h:101
ImageTypeCovarianceSampleFilterType::Pointer ImageTypeCovarianceSampleFilterPointer
Definition: itkBlockMatchingMethod.h:103
SimilarityMeasure< TImageType, TImageType > SimilarityMeasureType
Definition: itkBlockMatchingMethod.h:114
SmartPointer< Self > Pointer
Definition: itkPointSetToPointSetSingleValuedMetric.h:49
ImageType::SpacingType ImageSpacingType
Definition: itkBlockMatchingMethod.h:91
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1236
MinimumMaximumImageCalculatorType::Pointer MinimumMaximumImageCalculatorPointer
Definition: itkBlockMatchingMethod.h:142
PointSetType::PointsContainer PointsContainerType
Definition: itkBlockMatchingMethod.h:134
Definition: niftkITKAffineResampleImage.cxx:74
ImageType::IndexType IndexType
Definition: niftkMakeLapUSProbeBasicModel.cxx:32
RegionOfInterestFilterType::Pointer RegionOfInterestFilterPointer
Definition: itkBlockMatchingMethod.h:97
void SetKey(const TScalarType &aKey)
Definition: itkBlockMatchingMethod.h:350
NearestNeighborInterpolateImageFunction< TImageType, TScalarType > DummyInterpolatorType
Definition: itkBlockMatchingMethod.h:117
ImageType::PixelType ImagePixelType
Definition: itkBlockMatchingMethod.h:90
GLuint GLenum GLenum transform
Definition: glew.h:12775
GradientMagnitudeImageFilter< TImageType, GradientImageType > GradientMagnitudeFilterType
Definition: itkBlockMatchingMethod.h:107
RegionOfInterestImageFilter< TImageType, TImageType > RegionOfInterestFilterType
Definition: itkBlockMatchingMethod.h:96
PointType GetMoving() const
Definition: itkBlockMatchingMethod.h:401
Image< float, TImageType::ImageDimension > GradientImageType
Definition: itkBlockMatchingMethod.h:106
TransformType * TransformPointer
Definition: itkBlockMatchingMethod.h:140
virtual ~BlockMatchingMethod()
Definition: itkBlockMatchingMethod.h:274
Superclass::TransformType TransformType
Definition: itkBlockMatchingMethod.h:139
itk::Statistics::CovarianceSampleFilter< ImageTypeListAdaptorType > ImageTypeCovarianceSampleFilterType
Definition: itkBlockMatchingMethod.h:102
SmartPointer< const Self > ConstPointer
Definition: itkBlockMatchingMethod.h:76
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
PointSetType::PointsContainer::ConstIterator PointIterator
Definition: itkBlockMatchingMethod.h:132
ImageIndexType GetIndex() const
Definition: itkBlockMatchingMethod.h:354
Superclass::TransformType TransformType
Definition: itkMaskedImageRegistrationMethod.h:129
TImageType ImageType
Definition: itkBlockMatchingMethod.h:88
ImageType::RegionType RegionType
Definition: niftkMakeLapUSProbeBasicModel.cxx:30
TScalarType GetResidual() const
Definition: itkBlockMatchingMethod.h:395
std::priority_queue< ResidualHeapDataType > ResidualHeap
Definition: itkBlockMatchingMethod.h:409
void SetResidual(const TScalarType &aResidual)
Definition: itkBlockMatchingMethod.h:394
Computes similarity between two point sets, but sums it up to a single value.
Definition: itkPointSetToPointSetSingleValuedMetric.h:42
ResampleFilterType::Pointer ResampleFilterPointer
Definition: itkBlockMatchingMethod.h:95
friend bool operator<(const ResidualHeapDataType &x, const ResidualHeapDataType &y)
Definition: itkBlockMatchingMethod.h:385
GLuint index
Definition: glew.h:1798
ImageType::SizeType ImageSizeType
Definition: itkBlockMatchingMethod.h:89
PointSetType::PointType PointType
Definition: itkBlockMatchingMethod.h:131
DummyInterpolatorType::Pointer DummyInterpolatorPointer
Definition: itkBlockMatchingMethod.h:118
GradientImageTypeListAdaptorType::Pointer GradientImageTypeListAdaptorPointer
Definition: itkBlockMatchingMethod.h:110
GLint GLint GLint GLint GLint x
Definition: glew.h:1236
Superclass::ParametersType ParametersType
Definition: itkBlockMatchingMethod.h:119
Initial implementation of Seb Ourselin's block matching algorithm.
Definition: itkBlockMatchingMethod.h:67
void SetIndex(const ImageIndexType &anIndex)
Definition: itkBlockMatchingMethod.h:353
GLsizeiptr size
Definition: glew.h:1665
ImageType::RegionType ImageRegionType
Definition: itkBlockMatchingMethod.h:92
Simultaneous itk::Image and itk::Array (and hence vnl_vector) class.
void SetMoving(const PointType &aMovingPoint)
Definition: itkBlockMatchingMethod.h:400
const unsigned int Dimension
Definition: niftkBreastDCEandADC.cxx:89
itk::Statistics::ImageToListSampleAdaptor< GradientImageType > GradientImageTypeListAdaptorType
Definition: itkBlockMatchingMethod.h:109
ResampleImageFilter< TImageType, TImageType > ResampleFilterType
Definition: itkBlockMatchingMethod.h:94
Resample an image via a coordinate transform.
void operator=(const VarianceHeapDataType &another)
Definition: itkBlockMatchingMethod.h:335
ImageType::IndexType ImageIndexType
Definition: itkBlockMatchingMethod.h:93
GradientMagnitudeFilterType::Pointer GradientMagnitudeFilterPointer
Definition: itkBlockMatchingMethod.h:108
PointType GetFixed() const
Definition: itkBlockMatchingMethod.h:398
PointSetToPointSetSingleValuedMetric< PointSetType, PointSetType > PointSetMetricType
Definition: itkBlockMatchingMethod.h:137
PointsContainerType::Pointer PointsContainerPointer
Definition: itkBlockMatchingMethod.h:135
BlockMatchingMethod Self
Definition: itkBlockMatchingMethod.h:73
So we can have an ordered list of points, based on the residual between transformed fixed and moving...
Definition: itkBlockMatchingMethod.h:367
MinimumMaximumImageCalculator< TImageType > MinimumMaximumImageCalculatorType
Definition: itkBlockMatchingMethod.h:141
ResidualHeapDataType(const TScalarType &aResidual, const PointType &aFixedPoint, const PointType &aMovingPoint)
Definition: itkBlockMatchingMethod.h:371
MaskedImageRegistrationMethod< TImageType > Superclass
Definition: itkBlockMatchingMethod.h:74
GLsizei const GLcharARB ** string
Definition: glew.h:5194
SmartPointer< Self > Pointer
Definition: itkBlockMatchingMethod.h:75
itk::Statistics::CovarianceSampleFilter< GradientImageTypeListAdaptorType > GradientImageTypeCovarianceSampleFilterType
Definition: itkBlockMatchingMethod.h:111
void SetFixed(const PointType &aFixedPoint)
Definition: itkBlockMatchingMethod.h:397
SimilarityMeasureType * SimilarityMeasurePointer
Definition: itkBlockMatchingMethod.h:115
PointSetMetricType::Pointer PointSetMetricPointer
Definition: itkBlockMatchingMethod.h:138
So we can have an ordered list of indexes, based on variance of a block.
Definition: itkBlockMatchingMethod.h:326