go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elastix::RandomCoordinateSampler< TElastix > Class Template Reference

#include <elxRandomCoordinateSampler.h>

Detailed Description

template<class TElastix>
class elastix::RandomCoordinateSampler< TElastix >

An interpolator based on the itk::ImageRandomCoordinateSampler.

This image sampler randomly samples 'NumberOfSamples' coordinates in the InputImageRegion. If a mask is given, the sampler tries to find samples within the mask. If the mask is very sparse, this may take some time. The RandomCoordinate sampler samples not only positions that correspond to voxels, but also positions between voxels. An interpolator for the fixed image is thus required. A B-spline interpolator is used, the order of which can be specified by the user. Typically, the RandomCoordinate gives a smoother cost function, because the so-called 'grid-effect' is avoided.

This sampler is suitable to used in combination with the NewSamplesEveryIteration parameter (defined in the elx::OptimizerBase).

The parameters used in this class are:

Parameters

ImageSampler: Select this image sampler as follows:
(ImageSampler "RandomCoordinate")

NumberOfSpatialSamples: The number of image voxels used for computing the metric value and its derivative in each iteration. Must be given for each resolution.
example: (NumberOfSpatialSamples 2048 2048 4000)
The default is 5000.

UseRandomSampleRegion: Defines whether to randomly select a subregion of the image in each iteration. When set to "true", also specify the SampleRegionSize. By setting this option to "true", in combination with the NewSamplesEveryIteration parameter, a "localised" similarity measure is obtained. This can give better performance in case of the presence of large inhomogeneities in the image, for example.
example: (UseRandomSampleRegion "true")
Default: false.

SampleRegionSize: the size of the subregions that are selected when using the UseRandomSampleRegion option. The size should be specified in mm, for each dimension. As a rule of thumb, you may try a value ~1/3 of the image size.
example: (SampleRegionSize 50.0 50.0 50.0)
You can also specify one number, which will be used for all dimensions. Also, you can specify different values for each resolution:
example: (SampleRegionSize 50.0 50.0 50.0 30.0 30.0 30.0)
In this example, in the first resolution 50mm is used for each of the 3 dimensions, and in the second resolution 30mm.
Default: sampleRegionSize[i] = min ( fixedImageSize[i], max_i ( fixedImageSize[i]/3 ) ), with fixedImageSize in mm. So, approximately 1/3 of the fixed image size.

FixedImageBSplineInterpolationOrder: When using a RandomCoordinate sampler, the fixed image needs to be interpolated. This is done using a B-spline interpolator. With this option you can specify the order of interpolation.
example: (FixedImageBSplineInterpolationOrder 0 0 1)
Default value: 1. The parameter can be specified for each resolution.

Definition at line 78 of file elxRandomCoordinateSampler.h.

Inheritance diagram for elastix::RandomCoordinateSampler< TElastix >:

Public Types

using ConstPointer = itk::SmartPointer<const Self>
 
using CoordRepType
 
using DefaultInterpolatorType
 
using InputImageSpacingType
 
using InterpolatorType
 
using ITKBaseType = typename Superclass2::ITKBaseType
 
using Pointer = itk::SmartPointer<Self>
 
using Self = RandomCoordinateSampler
 
using Superclass1 = itk::ImageRandomCoordinateSampler<typename elx::ImageSamplerBase<TElastix>::InputImageType>
 
using Superclass2 = elx::ImageSamplerBase<TElastix>
 
- Public Types inherited from itk::ImageRandomCoordinateSampler< TInputImage >
using ConstPointer = SmartPointer<const Self>
 
using CoordRepType = double
 
using DefaultInterpolatorType = BSplineInterpolateImageFunction<InputImageType, CoordRepType, double>
 
using InputImageSpacingType = typename InputImageType::SpacingType
 
using InterpolatorPointer = typename InterpolatorType::Pointer
 
using InterpolatorType = InterpolateImageFunction<InputImageType, CoordRepType>
 
using Pointer = SmartPointer<Self>
 
using RandomGeneratorPointer = typename RandomGeneratorType::Pointer
 
using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator
 
using Self = ImageRandomCoordinateSampler
 
using Superclass = ImageRandomSamplerBase<TInputImage>
 
- Public Types inherited from itk::ImageRandomSamplerBase< TInputImage >
using ConstPointer = SmartPointer<const Self>
 
using ImageSampleContainerPointer
 
using ImageSampleContainerType
 
using ImageSampleType
 
using InputImageConstPointer
 
using InputImagePixelType
 
using InputImagePointer
 
using InputImageRegionType
 
using InputImageType
 
using MaskType
 
using Pointer = SmartPointer<Self>
 
using SeedIntegerType = Statistics::MersenneTwisterRandomVariateGenerator::IntegerType
 
using Self = ImageRandomSamplerBase
 
using Superclass = ImageSamplerBase<TInputImage>
 
- Public Types inherited from itk::ImageSamplerBase< TInputImage >
using ConstPointer = SmartPointer<const Self>
 
using ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer
 
using ImageSampleContainerType = VectorDataContainer<std::vcl_size_t, ImageSampleType>
 
using ImageSampleType = ImageSample<InputImageType>
 
using ImageSampleValueType = typename ImageSampleType::RealType
 
using InputImageConstPointer = typename InputImageType::ConstPointer
 
using InputImageIndexType = typename InputImageType::IndexType
 
using InputImagePixelType = typename InputImageType::PixelType
 
using InputImagePointer = typename InputImageType::Pointer
 
using InputImagePointType = typename InputImageType::PointType
 
using InputImagePointValueType = typename InputImagePointType::ValueType
 
using InputImageRegionType = typename InputImageType::RegionType
 
using InputImageRegionVectorType = std::vector<InputImageRegionType>
 
using InputImageSizeType = typename InputImageType::SizeType
 
using InputImageType = TInputImage
 
using MaskConstPointer = typename MaskType::ConstPointer
 
using MaskPointer = typename MaskType::Pointer
 
using MaskType = ImageMaskSpatialObject<Self::InputImageDimension>
 
using MaskVectorType = std::vector<MaskConstPointer>
 
using Pointer = SmartPointer<Self>
 
using Self = ImageSamplerBase
 
using Superclass = VectorContainerSource<VectorDataContainer<std::vcl_size_t, ImageSample<TInputImage>>>
 
- Public Types inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >
using ConstPointer
 
using OutputVectorContainerPointer
 
using OutputVectorContainerType
 
using Pointer
 
using Self
 
using Superclass
 
- Public Types inherited from itk::ImageSamplerBase< TElastix >
using ConstPointer
 
using ImageSampleContainerPointer
 
using ImageSampleContainerType
 
using ImageSampleType
 
using ImageSampleValueType
 
using InputImageConstPointer
 
using InputImageIndexType
 
using InputImagePixelType
 
using InputImagePointer
 
using InputImagePointType
 
using InputImagePointValueType
 
using InputImageRegionType
 
using InputImageRegionVectorType
 
using InputImageSizeType
 
using InputImageType
 
using MaskConstPointer
 
using MaskPointer
 
using MaskType
 
using MaskVectorType
 
using Pointer
 
using Self
 
using Superclass
 
- Public Types inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TElastix > > >
using ConstPointer
 
using OutputVectorContainerPointer
 
using OutputVectorContainerType
 
using Pointer
 
using Self
 
using Superclass
 

Public Member Functions

void BeforeEachResolution () override
 
 elxClassNameMacro ("RandomCoordinate")
 
virtual const char * GetClassName () const
 
 ITK_DISALLOW_COPY_AND_MOVE (RandomCoordinateSampler)
 
 itkStaticConstMacro (InputImageDimension, unsigned int, Superclass1::InputImageDimension)
 
- Public Member Functions inherited from itk::ImageRandomCoordinateSampler< TInputImage >
virtual const InputImageSpacingTypeGetSampleRegionSize ()
 
virtual bool GetUseRandomSampleRegion () const
 
 ITK_DISALLOW_COPY_AND_MOVE (ImageRandomCoordinateSampler)
 
 itkGetModifiableObjectMacro (Interpolator, InterpolatorType)
 
 itkStaticConstMacro (InputImageDimension, unsigned int, Superclass::InputImageDimension)
 
virtual void SetInterpolator (InterpolatorType *_arg)
 
virtual void SetSampleRegionSize (InputImageSpacingType _arg)
 
virtual void SetUseRandomSampleRegion (bool _arg)
 
- Public Member Functions inherited from itk::ImageRandomSamplerBase< TInputImage >
std::optional< SeedIntegerTypeGetOptionalSeed () const
 
 ITK_DISALLOW_COPY_AND_MOVE (ImageRandomSamplerBase)
 
 itkStaticConstMacro (InputImageDimension, unsigned int, Superclass::InputImageDimension)
 
void SetOptionalSeed (const std::optional< SeedIntegerType > arg)
 
void SetSeed (const SeedIntegerType arg)
 
- Public Member Functions inherited from itk::ImageSamplerBase< TInputImage >
virtual const InputImageRegionTypeGetCroppedInputImageRegion ()
 
const InputImageTypeGetInput ()
 
const InputImageTypeGetInput (unsigned int idx)
 
virtual const InputImageRegionTypeGetInputImageRegion () const
 
virtual const InputImageRegionTypeGetInputImageRegion (unsigned int pos) const
 
virtual const MaskTypeGetMask () const
 
virtual const MaskTypeGetMask (unsigned int pos) const
 
virtual unsigned int GetNumberOfInputImageRegions () const
 
virtual unsigned int GetNumberOfMasks () const
 
virtual unsigned long GetNumberOfSamples () const
 
OutputVectorContainerTypeGetOutput ()
 
 ITK_DISALLOW_COPY_AND_MOVE (ImageSamplerBase)
 
 itkStaticConstMacro (InputImageDimension, unsigned int, InputImageType::ImageDimension)
 
DataObject::Pointer MakeOutput (ProcessObject::DataObjectPointerArraySizeType idx) override
 
virtual bool SelectingNewSamplesOnUpdateSupported () const
 
virtual bool SelectNewSamplesOnUpdate ()
 
void SetInput (const InputImageType *input)
 
void SetInput (unsigned int idx, const InputImageType *input)
 
virtual void SetInputImageRegion (const InputImageRegionType _arg)
 
virtual void SetInputImageRegion (const InputImageRegionType _arg, unsigned int pos)
 
virtual void SetMask (const MaskType *_arg)
 
virtual void SetMask (const MaskType *_arg, unsigned int pos)
 
virtual void SetNumberOfInputImageRegions (const unsigned int _arg)
 
virtual void SetNumberOfMasks (const unsigned int _arg)
 
virtual void SetNumberOfSamples (unsigned long _arg)
 
virtual void SetUseMultiThread (bool _arg)
 
- Public Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >
OutputVectorContainerTypeGetOutput ()
 
OutputVectorContainerTypeGetOutput (unsigned int idx)
 
virtual void GraftNthOutput (unsigned int idx, DataObject *output)
 
virtual void GraftOutput (DataObject *output)
 
 ITK_DISALLOW_COPY_AND_MOVE (VectorContainerSource)
 
DataObjectPointer MakeOutput (ProcessObject::DataObjectPointerArraySizeType idx) override
 
- Public Member Functions inherited from itk::ImageSamplerBase< TElastix >
virtual const InputImageRegionTypeGetCroppedInputImageRegion ()
 
const InputImageTypeGetInput ()
 
const InputImageTypeGetInput (unsigned int idx)
 
virtual const InputImageRegionTypeGetInputImageRegion () const
 
virtual const InputImageRegionTypeGetInputImageRegion (unsigned int pos) const
 
virtual const MaskTypeGetMask () const
 
virtual const MaskTypeGetMask (unsigned int pos) const
 
virtual unsigned int GetNumberOfInputImageRegions () const
 
virtual unsigned int GetNumberOfMasks () const
 
virtual unsigned long GetNumberOfSamples () const
 
OutputVectorContainerTypeGetOutput ()
 
 ITK_DISALLOW_COPY_AND_MOVE (ImageSamplerBase)
 
 itkStaticConstMacro (InputImageDimension, unsigned int, InputImageType::ImageDimension)
 
DataObject::Pointer MakeOutput (ProcessObject::DataObjectPointerArraySizeType idx) override
 
virtual bool SelectingNewSamplesOnUpdateSupported () const
 
virtual bool SelectNewSamplesOnUpdate ()
 
void SetInput (const InputImageType *input)
 
void SetInput (unsigned int idx, const InputImageType *input)
 
virtual void SetInputImageRegion (const InputImageRegionType _arg)
 
virtual void SetInputImageRegion (const InputImageRegionType _arg, unsigned int pos)
 
virtual void SetMask (const MaskType *_arg)
 
virtual void SetMask (const MaskType *_arg, unsigned int pos)
 
virtual void SetNumberOfInputImageRegions (const unsigned int _arg)
 
virtual void SetNumberOfMasks (const unsigned int _arg)
 
virtual void SetNumberOfSamples (unsigned long _arg)
 
virtual void SetUseMultiThread (bool _arg)
 
- Public Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TElastix > > >
OutputVectorContainerTypeGetOutput ()
 
OutputVectorContainerTypeGetOutput (unsigned int idx)
 
virtual void GraftNthOutput (unsigned int idx, DataObject *output)
 
virtual void GraftOutput (DataObject *output)
 
 ITK_DISALLOW_COPY_AND_MOVE (VectorContainerSource)
 
DataObjectPointer MakeOutput (ProcessObject::DataObjectPointerArraySizeType idx) override
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::ImageRandomCoordinateSampler< TInputImage >
static Pointer New ()
 
- Static Public Member Functions inherited from itk::ImageRandomSamplerBase< TInputImage >
static Pointer New ()
 
- Static Public Member Functions inherited from itk::ImageSamplerBase< TInputImage >
static Pointer New ()
 
- Static Public Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >
static Pointer New ()
 
- Static Public Member Functions inherited from itk::ImageSamplerBase< TElastix >
static Pointer New ()
 
- Static Public Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TElastix > > >
static Pointer New ()
 

Protected Member Functions

 RandomCoordinateSampler ()=default
 
 ~RandomCoordinateSampler () override=default
 
- Protected Member Functions inherited from itk::ImageRandomCoordinateSampler< TInputImage >
void GenerateData () override
 
virtual void GenerateRandomCoordinate (const InputImageContinuousIndexType &smallestContIndex, const InputImageContinuousIndexType &largestContIndex, InputImageContinuousIndexType &randomContIndex)
 
virtual void GenerateSampleRegion (const InputImageContinuousIndexType &smallestImageContIndex, const InputImageContinuousIndexType &largestImageContIndex, InputImageContinuousIndexType &smallestContIndex, InputImageContinuousIndexType &largestContIndex)
 
 ImageRandomCoordinateSampler ()=default
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~ImageRandomCoordinateSampler () override=default
 
- Protected Member Functions inherited from itk::ImageRandomSamplerBase< TInputImage >
void GenerateRandomNumberList ()
 
 ImageRandomSamplerBase ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~ImageRandomSamplerBase () override=default
 
- Protected Member Functions inherited from itk::ImageSamplerBase< TInputImage >
virtual bool CheckInputImageRegions ()
 
void CropInputImageRegion ()
 
void GenerateInputRequestedRegion () override
 
 ImageSamplerBase ()
 
virtual bool IsInsideAllMasks (const InputImagePointType &point) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void UpdateAllMasks ()
 
 ~ImageSamplerBase () override=default
 
- Protected Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TInputImage > > >
void PrintSelf (std::ostream &os, Indent indent) const override
 
 VectorContainerSource ()
 
 ~VectorContainerSource () override=default
 
- Protected Member Functions inherited from itk::ImageSamplerBase< TElastix >
virtual bool CheckInputImageRegions ()
 
void CropInputImageRegion ()
 
void GenerateInputRequestedRegion () override
 
 ImageSamplerBase ()
 
virtual bool IsInsideAllMasks (const InputImagePointType &point) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void UpdateAllMasks ()
 
 ~ImageSamplerBase () override=default
 
- Protected Member Functions inherited from itk::VectorContainerSource< VectorDataContainer< std::vcl_size_t, ImageSample< TElastix > > >
void PrintSelf (std::ostream &os, Indent indent) const override
 
 VectorContainerSource ()
 
 ~VectorContainerSource () override=default
 

Private Attributes

 elxOverrideGetSelfMacro
 

Additional Inherited Members

- Protected Types inherited from itk::ImageRandomCoordinateSampler< TInputImage >
using InputImageContinuousIndexType = typename InterpolatorType::ContinuousIndexType
 
- Static Protected Member Functions inherited from itk::ImageSamplerBase< TInputImage >
static std::vector< InputImageRegionTypeSplitRegion (const InputImageRegionType &inputRegion, const vcl_size_t requestedNumberOfSubregions)
 
- Static Protected Member Functions inherited from itk::ImageSamplerBase< TElastix >
static std::vector< InputImageRegionTypeSplitRegion (const InputImageRegionType &inputRegion, const vcl_size_t requestedNumberOfSubregions)
 
- Protected Attributes inherited from itk::ImageRandomCoordinateSampler< TInputImage >
InterpolatorPointer m_Interpolator
 
RandomGeneratorPointer m_RandomGenerator { RandomGeneratorType::GetInstance() }
 
InputImageSpacingType m_SampleRegionSize { itk::MakeFilled<InputImageSpacingType>(1.0) }
 
- Protected Attributes inherited from itk::ImageRandomSamplerBase< TInputImage >
std::vector< doublem_RandomNumberList {}
 
- Protected Attributes inherited from itk::ImageSamplerBase< TInputImage >
unsigned long m_NumberOfSamples { 0 }
 
bool m_UseMultiThread { true }
 
- Protected Attributes inherited from itk::ImageSamplerBase< TElastix >
unsigned long m_NumberOfSamples
 
bool m_UseMultiThread
 

Member Typedef Documentation

◆ ConstPointer

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::ConstPointer = itk::SmartPointer<const Self>

Definition at line 90 of file elxRandomCoordinateSampler.h.

◆ CoordRepType

template<class TElastix >
using itk::ImageRandomCoordinateSampler< TInputImage >::CoordRepType

This image sampler samples the image on physical coordinates and thus needs an interpolator.

Definition at line 82 of file itkImageRandomCoordinateSampler.h.

◆ DefaultInterpolatorType

template<class TElastix >
using itk::ImageRandomCoordinateSampler< TInputImage >::DefaultInterpolatorType

Definition at line 85 of file itkImageRandomCoordinateSampler.h.

◆ InputImageSpacingType

template<class TElastix >
using itk::ImageRandomCoordinateSampler< TInputImage >::InputImageSpacingType

Definition at line 71 of file itkImageRandomCoordinateSampler.h.

◆ InterpolatorType

template<class TElastix >
using itk::ImageRandomCoordinateSampler< TInputImage >::InterpolatorType

Definition at line 83 of file itkImageRandomCoordinateSampler.h.

◆ ITKBaseType

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::ITKBaseType = typename Superclass2::ITKBaseType

Definition at line 135 of file elxRandomCoordinateSampler.h.

◆ Pointer

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::Pointer = itk::SmartPointer<Self>

Definition at line 89 of file elxRandomCoordinateSampler.h.

◆ Self

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::Self = RandomCoordinateSampler

Standard ITK-stuff.

Definition at line 86 of file elxRandomCoordinateSampler.h.

◆ Superclass1

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::Superclass1 = itk::ImageRandomCoordinateSampler<typename elx::ImageSamplerBase<TElastix>::InputImageType>

Definition at line 87 of file elxRandomCoordinateSampler.h.

◆ Superclass2

template<class TElastix >
using elastix::RandomCoordinateSampler< TElastix >::Superclass2 = elx::ImageSamplerBase<TElastix>

Definition at line 88 of file elxRandomCoordinateSampler.h.

Constructor & Destructor Documentation

◆ RandomCoordinateSampler()

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::RandomCoordinateSampler ( )
protecteddefault

The constructor.

◆ ~RandomCoordinateSampler()

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::~RandomCoordinateSampler ( )
overrideprotecteddefault

The destructor.

Member Function Documentation

◆ BeforeEachResolution()

template<class TElastix >
void elastix::RandomCoordinateSampler< TElastix >::BeforeEachResolution ( )
override

Execute stuff before each resolution:

  • Set the number of samples.
  • Set the fixed image interpolation order
  • Set the UseRandomSampleRegion flag and the SampleRegionSize

◆ elxClassNameMacro()

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::elxClassNameMacro ( "RandomCoordinate" )

Name of this class. Use this name in the parameter file to select this specific interpolator.
example: (ImageSampler "RandomCoordinate")

◆ GetClassName()

template<class TElastix >
virtual const char * elastix::RandomCoordinateSampler< TElastix >::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::ImageRandomCoordinateSampler< TInputImage >.

◆ ITK_DISALLOW_COPY_AND_MOVE()

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::ITK_DISALLOW_COPY_AND_MOVE ( RandomCoordinateSampler< TElastix > )

◆ itkStaticConstMacro()

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::itkStaticConstMacro ( InputImageDimension ,
unsigned int ,
Superclass1::InputImageDimension  )

The input image dimension.

◆ New()

template<class TElastix >
static Pointer elastix::RandomCoordinateSampler< TElastix >::New ( )
static

Method for creation through the object factory.

Field Documentation

◆ elxOverrideGetSelfMacro

template<class TElastix >
elastix::RandomCoordinateSampler< TElastix >::elxOverrideGetSelfMacro
private

Definition at line 152 of file elxRandomCoordinateSampler.h.



Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo