#include <itkAdvancedImageMomentsCalculator.h>
Compute moments of an n-dimensional image.
This class provides methods for computing the moments and related properties of a single-echo image. Computing the (non-central) moments of a large image can easily take a million times longer than computing the various other values derived from them, so we compute the moments only on explicit request, and save their values (in an AdvancedImageMomentsCalculator object) for later retrieval by the user.
The non-central moments computed by this class are not really intended for general use and are therefore in index coordinates; that is, we pretend that the index that selects a particular pixel also equals its physical coordinates. The center of gravity, central moments, principal moments and principal axes are all more generally useful and are computed in the physical coordinates defined by the Origin and Spacing parameters of the image.
The methods that return values return the values themselves rather than references because the cost is small compared to the cost of computing the moments and doing so simplifies memory management for the caller.
Definition at line 68 of file itkAdvancedImageMomentsCalculator.h.
Data Structures | |
struct | ComputePerThreadStruct |
struct | MultiThreaderParameterType |
Public Types | |
using | AffineTransformPointer = typename AffineTransformType::Pointer |
using | AffineTransformType = AffineTransform<double, Self::ImageDimension> |
using | BinaryThresholdImageFilterType = itk::BinaryThresholdImageFilter<TImage, TImage> |
using | ConstPointer = SmartPointer<const Self> |
using | ImageConstPointer = typename ImageType::ConstPointer |
using | ImageGridSamplerPointer = typename ImageGridSamplerType::Pointer |
using | ImageGridSamplerType = itk::ImageGridSampler<ImageType> |
using | ImagePointer = typename ImageType::Pointer |
using | ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer |
using | ImageSampleContainerType = typename ImageGridSamplerType ::ImageSampleContainerType |
using | ImageType = TImage |
using | InputPixelType = typename TImage::PixelType |
using | MatrixType = Matrix<ScalarType, Self::ImageDimension, Self::ImageDimension> |
using | Pointer = SmartPointer<Self> |
using | ScalarType = double |
using | Self = AdvancedImageMomentsCalculator<TImage> |
using | SpatialObjectConstPointer = typename SpatialObjectType::ConstPointer |
using | SpatialObjectPointer = typename SpatialObjectType::Pointer |
using | SpatialObjectType = ImageMaskSpatialObject<Self::ImageDimension> |
using | Superclass = Object |
using | VectorType = Vector<ScalarType, Self::ImageDimension> |
Static Public Member Functions | |
static Pointer | New () |
Protected Types | |
using | ThreadInfoType = MultiThreaderBase::WorkUnitInfo |
using | ThreadRegionType = typename ImageType::RegionType |
Protected Member Functions | |
AdvancedImageMomentsCalculator () | |
virtual void | InitializeThreadingParameters () |
itkAlignedTypedef (ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct) | |
itkPadStruct (ITK_CACHE_LINE_ALIGNMENT, ComputePerThreadStruct, PaddedComputePerThreadStruct) | |
void | LaunchComputeThreaderCallback () const |
void | PrintSelf (std::ostream &os, Indent indent) const override |
virtual void | ThreadedCompute (ThreadIdType threadID) |
~AdvancedImageMomentsCalculator () override=default | |
Static Protected Member Functions | |
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION | ComputeThreaderCallback (void *arg) |
Private Member Functions | |
AdvancedImageMomentsCalculator (const Self &) | |
void | DoPostProcessing () |
void | operator= (const Self &) |
Private Attributes | |
bool | m_CenterOfGravityUsesLowerThreshold {} |
VectorType | m_Cg {} |
MatrixType | m_Cm {} |
std::vector< AlignedComputePerThreadStruct > | m_ComputePerThreadVariables {} |
ImageConstPointer | m_Image {} |
InputPixelType | m_LowerThresholdForCenterGravity {} |
ScalarType | m_M0 {} |
VectorType | m_M1 {} |
MatrixType | m_M2 {} |
SizeValueType | m_NumberOfPixelsCounted {} |
SizeValueType | m_NumberOfSamplesForCenteredTransformInitialization {} |
MatrixType | m_Pa {} |
VectorType | m_Pm {} |
ImageSampleContainerPointer | m_SampleContainer {} |
SpatialObjectConstPointer | m_SpatialObjectMask {} |
MultiThreaderBase::Pointer | m_Threader {} |
MultiThreaderParameterType | m_ThreaderParameters {} |
bool | m_UseMultiThread {} |
bool | m_Valid {} |
using itk::AdvancedImageMomentsCalculator< TImage >::AffineTransformPointer = typename AffineTransformType::Pointer |
Definition at line 111 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::AffineTransformType = AffineTransform<double, Self::ImageDimension> |
Affine transform for mapping to and from principal axis
Definition at line 110 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::BinaryThresholdImageFilterType = itk::BinaryThresholdImageFilter<TImage, TImage> |
Definition at line 245 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ConstPointer = SmartPointer<const Self> |
Definition at line 75 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageConstPointer = typename ImageType::ConstPointer |
Definition at line 107 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageGridSamplerPointer = typename ImageGridSamplerType::Pointer |
Definition at line 238 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageGridSamplerType = itk::ImageGridSampler<ImageType> |
Definition at line 236 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImagePointer = typename ImageType::Pointer |
Standard image type pointer within this class.
Definition at line 106 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer |
Definition at line 240 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageSampleContainerType = typename ImageGridSamplerType ::ImageSampleContainerType |
Definition at line 239 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ImageType = TImage |
Standard image type within this class.
Definition at line 103 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::InputPixelType = typename TImage::PixelType |
Definition at line 246 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::MatrixType = Matrix<ScalarType, Self::ImageDimension, Self::ImageDimension> |
Standard matrix type within this class.
Definition at line 100 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::Pointer = SmartPointer<Self> |
Definition at line 74 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::ScalarType = double |
Standard scalar type within this class.
Definition at line 87 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::Self = AdvancedImageMomentsCalculator<TImage> |
Standard class typedefs.
Definition at line 72 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::SpatialObjectConstPointer = typename SpatialObjectType::ConstPointer |
Definition at line 97 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::SpatialObjectPointer = typename SpatialObjectType::Pointer |
Spatial Object member types used within this class.
Definition at line 96 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::SpatialObjectType = ImageMaskSpatialObject<Self::ImageDimension> |
Spatial Object type within this class.
Definition at line 93 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::Superclass = Object |
Definition at line 73 of file itkAdvancedImageMomentsCalculator.h.
|
protected |
Typedef for multi-threading.
Definition at line 260 of file itkAdvancedImageMomentsCalculator.h.
|
protected |
The type of region used for multithreading
Definition at line 298 of file itkAdvancedImageMomentsCalculator.h.
using itk::AdvancedImageMomentsCalculator< TImage >::VectorType = Vector<ScalarType, Self::ImageDimension> |
Standard vector type within this class.
Definition at line 90 of file itkAdvancedImageMomentsCalculator.h.
|
protected |
|
overrideprotecteddefault |
|
private |
|
virtual |
|
virtual |
void itk::AdvancedImageMomentsCalculator< TImage >::Compute | ( | ) |
Compute moments of a new or modified image. This method computes the moments of the image given as a parameter and stores them in the object. The values of these moments and related parameters can then be retrieved by using other methods of this object. The multi-threading implementation.
void itk::AdvancedImageMomentsCalculator< TImage >::ComputeSingleThreaded | ( | ) |
The main functions that performs the single thread computation.
|
staticprotected |
Compute threader callback function.
|
private |
Internal helper function. Does post processing at the end of ComputeSingleThreaded() and AfterThreadedCompute()
VectorType itk::AdvancedImageMomentsCalculator< TImage >::GetCenterOfGravity | ( | ) | const |
Return center of gravity, in physical coordinates. This method returns the center of gravity of the image whose moments were last computed by this object. The center of gravity is computed in physical coordinates.
MatrixType itk::AdvancedImageMomentsCalculator< TImage >::GetCentralMoments | ( | ) | const |
Return second central moments, in physical coordinates. This method returns the central second moments of the image whose moments were last computed by this object. The central moments are computed in physical coordinates.
|
virtual |
Run-time type information (and related methods).
VectorType itk::AdvancedImageMomentsCalculator< TImage >::GetFirstMoments | ( | ) | const |
Return first moments about origin, in index coordinates. This method returns the first moments around the origin of the image whose moments were last computed by this object. For simplicity, these moments are computed in index coordinates rather than physical coordinates.
AffineTransformPointer itk::AdvancedImageMomentsCalculator< TImage >::GetPhysicalAxesToPrincipalAxesTransform | ( | ) | const |
Get the affine transform from physical axes to principal axes This method returns an affine transform which transforms from the physical coordinate system to the principal axes coordinate system.
MatrixType itk::AdvancedImageMomentsCalculator< TImage >::GetPrincipalAxes | ( | ) | const |
Return principal axes, in physical coordinates. This method returns the principal axes of the image whose moments were last computed by this object. The moments are returned as an orthogonal matrix, each row of which corresponds to one principal moment; for example, the principal axis corresponding to the smallest principal moment is the vector m[0], where m is the value returned by this method. The matrix of principal axes is guaranteed to be a proper rotation; that is, to have determinant +1 and to preserve parity. (Unless you have foolishly made one or more of the spacing values negative; in that case, you get to figure out the consequences.) The moments are computed in physical coordinates.
AffineTransformPointer itk::AdvancedImageMomentsCalculator< TImage >::GetPrincipalAxesToPhysicalAxesTransform | ( | ) | const |
Get the affine transform from principal axes to physical axes This method returns an affine transform which transforms from the principal axes coordinate system to physical coordinates.
VectorType itk::AdvancedImageMomentsCalculator< TImage >::GetPrincipalMoments | ( | ) | const |
Return principal moments, in physical coordinates. This method returns the principal moments of the image whose moments were last computed by this object. The moments are returned as a vector, with the principal moments ordered from smallest to largest. The moments are computed in physical coordinates.
MatrixType itk::AdvancedImageMomentsCalculator< TImage >::GetSecondMoments | ( | ) | const |
Return second moments about origin, in index coordinates. This method returns the second moments around the origin of the image whose moments were last computed by this object. For simplicity, these moments are computed in index coordinates rather than physical coordinates.
ScalarType itk::AdvancedImageMomentsCalculator< TImage >::GetTotalMass | ( | ) | const |
Return the total mass (or zeroth moment) of an image. This method returns the sum of pixel intensities (also known as the zeroth moment or the total mass) of the image whose moments were last computed by this object.
|
protectedvirtual |
Initialize some multi-threading related parameters.
|
protected |
|
protected |
itk::AdvancedImageMomentsCalculator< TImage >::itkStaticConstMacro | ( | ImageDimension | , |
unsigned int | , | ||
TImage::ImageDimension | ) |
Extract the dimension of the image.
|
protected |
Launch MultiThread Compute.
|
static |
Method for creation through the object factory.
|
private |
|
overrideprotected |
|
virtual |
|
virtual |
|
inlinevirtual |
Set the input image.
Definition at line 115 of file itkAdvancedImageMomentsCalculator.h.
|
virtual |
|
virtual |
Set some parameters.
|
inline |
Set the number of threads.
Definition at line 225 of file itkAdvancedImageMomentsCalculator.h.
|
inlinevirtual |
Set the spatial object mask.
Definition at line 127 of file itkAdvancedImageMomentsCalculator.h.
|
protectedvirtual |
The threaded implementation of Compute().
|
private |
Definition at line 320 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 327 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 328 of file itkAdvancedImageMomentsCalculator.h.
|
mutableprivate |
Definition at line 314 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 332 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 319 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 324 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 325 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 326 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 316 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 318 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 330 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 329 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 321 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 333 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 310 of file itkAdvancedImageMomentsCalculator.h.
|
mutableprivate |
Definition at line 312 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 315 of file itkAdvancedImageMomentsCalculator.h.
|
private |
Definition at line 323 of file itkAdvancedImageMomentsCalculator.h.
Generated on 2024-07-17 for elastix by 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) |