Skip to content

itk::ParticleSystem

A facade class managing interactions with a particle system. More...

#include <itkParticleSystem.h>

Inherits from DataObject

Public Types

Name
typedef ParticleSystem Self
typedef DataObject Superclass
typedef SmartPointer< Self > Pointer
typedef SmartPointer< const Self > ConstPointer
typedef WeakPointer< const Self > ConstWeakPointer
using shapeworks::ParticleDomain DomainType
typedef Point< double, VDimension > PointType
typedef ParticleNeighborhood< VDimension > NeighborhoodType
typedef ParticleContainer< PointType > PointContainerType
typedef NeighborhoodType::PointVectorType PointVectorType
typedef vnl_matrix_fixed< double, VDimension+1, VDimension+1 > TransformType
typedef vnl_vector_fixed< double, VDimension > VectorType
typedef vnl_matrix< double > VnlMatrixType

Public Functions

Name
itkNewMacro(Self )
itkTypeMacro(ParticleSystem , DataObject )
itkStaticConstMacro(Dimension , unsigned int , VDimension )
void RegisterAttribute(ParticleAttribute< VDimension > * )
void SynchronizePositions()
unsigned long int GetNumberOfParticles(unsigned int d =0) const
const PointType & AddPosition(const PointType & , unsigned int d =0, int threadId =0)
const PointType & SetPosition(const PointType & , unsigned long int k, unsigned int d =0, int threadId =0)
void RemovePosition(unsigned long int k, unsigned int d =0, int threadId =0)
PointType & GetPosition(unsigned long int k, unsigned int d =0)
const PointType & GetPosition(unsigned long int k, unsigned int d =0) const
PointType GetTransformedPosition(unsigned long int k, unsigned int d =0) const
PointType GetPrefixTransformedPosition(unsigned long int k, unsigned int d =0) const
void SplitAllParticles(double epsilon, int threadId =0)
void SplitParticle(double epsilon, unsigned int idx, unsigned int d =0, int threadId =0)
void AdvancedAllParticleSplitting(double epsilon, unsigned int domains_per_shape, unsigned int dom_to_process)
void PrintParticleSystem()
void SetNeighborhood(unsigned int , NeighborhoodType * , int threadId =0)
void SetNeighborhood(NeighborhoodType * n, int threadId =0)
NeighborhoodType::ConstPointer GetNeighborhood(unsigned int k) const
PointVectorType FindNeighborhoodPoints(const PointType & p, int idx, double r, unsigned int d =0) const
PointVectorType FindNeighborhoodPoints(const PointType & p, int idx, std::vector< double > & w, std::vector< double > & distances, double r, unsigned int d =0) const
PointVectorType FindNeighborhoodPoints(const PointType & p, int idx, std::vector< double > & w, double r, unsigned int d =0) const
PointVectorType FindNeighborhoodPoints(unsigned int idx, double r, unsigned int d =0) const
PointVectorType FindNeighborhoodPoints(unsigned int idx, std::vector< double > & w, std::vector< double > & distances, double r, unsigned int d =0) const
PointVectorType FindNeighborhoodPoints(unsigned int idx, std::vector< double > & w, double r, unsigned int d =0) const
void AddDomain(DomainType::Pointer input, int threadId =0)
std::vector< DomainType::Pointer >::const_iterator GetDomainsBegin() const
std::vector< DomainType::Pointer >::const_iterator GetDomainsEnd() const
DomainType * GetDomain(unsigned int i)
DomainType * GetDomain()
const DomainType * GetDomain(unsigned int i) const
const DomainType * GetDomain() const
unsigned int GetNumberOfDomains() const
void SetTransform(unsigned int i, const TransformType & , int threadId =0)
void SetTransform(const TransformType & p, int threadId =0)
void SetPrefixTransform(unsigned int i, const TransformType & , int threadId =0)
void SetPrefixTransform(const TransformType & p, int threadId =0)
std::vector< TransformType >::const_iterator GetTransformsBegin() const
std::vector< TransformType >::const_iterator GetTransformsEnd() const
const TransformType & GetTransform(unsigned int i) const
const TransformType & GetTransform() const
TransformType GetTransform(unsigned int i)
TransformType GetTransform()
const TransformType & GetPrefixTransform(unsigned int i) const
const TransformType & GetPrefixTransform() const
TransformType GetPrefixTransform(unsigned int i)
TransformType GetPrefixTransform()
std::vector< TransformType >::const_iterator GetInverseTransformsBegin() const
std::vector< TransformType >::const_iterator GetInverseTransformsEnd() const
const TransformType & GetInverseTransform(unsigned int i) const
const TransformType & GetInverseTransform() const
const TransformType & GetInversePrefixTransform(unsigned int i) const
const TransformType & GetInversePrefixTransform() const
const std::vector< PointContainerType::Pointer > & GetPositions() const
const PointContainerType::Pointer & GetPositions(unsigned int d) const
void AddPositionList(const std::vector< PointType > & , unsigned int d =0, int threadId =0)
PointType TransformPoint(const PointType & , const TransformType & ) const
VectorType TransformVector(const VectorType & , const TransformType & ) const
VnlMatrixType TransformNormalDerivative(const VnlMatrixType & , const TransformType & ) const
TransformType InvertTransform(const TransformType & T) const
void FlagDomain(unsigned int i)
void UnflagDomain(unsigned int i)
bool GetDomainFlag(unsigned int i) const
const std::vector< bool > & GetDomainFlags() const
void SetDomainFlags()
void ResetDomainFlags()
void SetFixedParticleFlag(unsigned int d, unsigned int i)
void ResetFixedParticleFlag(unsigned int d, unsigned int i)
bool GetFixedParticleFlag(unsigned int d, unsigned int i) const
void ResetFixedParticleFlags()
void SetDomainsPerShape(unsigned int num)
unsigned int GetDomainsPerShape() const
void SetNumberOfDomains(unsigned int )

Protected Functions

Name
ParticleSystem()
void PrintSelf(std::ostream & os, Indent indent) const
virtual ~ParticleSystem()
std::vector< DomainType::Pointer >::iterator GetDomainsBegin()
std::vector< DomainType::Pointer >::iterator GetDomainsEnd()
std::vector< TransformType >::iterator GetTransformsBegin()
std::vector< TransformType >::iterator GetTransformsEnd()
std::vector< TransformType >::iterator GetInverseTransformsBegin()
std::vector< TransformType >::iterator GetInverseTransformsEnd()
TransformType & GetInverseTransform(unsigned int i)
TransformType & GetInverseTransform()
TransformType & GetInversePrefixTransform(unsigned int i)
TransformType & GetInversePrefixTransform()

Public Attributes

Name
constexpr int VDimension

Detailed Description

class itk::ParticleSystem;

A facade class managing interactions with a particle system.

A particle system consists of a set of particle locations and domains in which those locations are defined. For example, a particle system may simply be a set of points in 3D Euclidean space that are constrained to a specified bounding box. A more complex example is a set of 3D points constrained to a given surface. The itkParticleSystem class is also designed to manage multiple sets of points across multiple domains. For example, one may create a system of dozens of point sets that are each defined in different spaces. The itkParticleSystem class can also maintain a set of transformations associated with each domain that map that particular domain into another coordinate frame, for example, a common coordinate frame.

Public Types Documentation

typedef Self

typedef ParticleSystem itk::ParticleSystem::Self;

Standard class typedefs

typedef Superclass

typedef DataObject itk::ParticleSystem::Superclass;

typedef Pointer

typedef SmartPointer<Self> itk::ParticleSystem::Pointer;

typedef ConstPointer

typedef SmartPointer<const Self> itk::ParticleSystem::ConstPointer;

typedef ConstWeakPointer

typedef WeakPointer<const Self> itk::ParticleSystem::ConstWeakPointer;

using DomainType

using itk::ParticleSystem::DomainType =  shapeworks::ParticleDomain;

Define the base domain type.

typedef PointType

typedef Point<double, VDimension> itk::ParticleSystem::PointType;

Point type used to store particle locations.

typedef NeighborhoodType

typedef ParticleNeighborhood<VDimension> itk::ParticleSystem::NeighborhoodType;

Class used to compute neighborhoods of points. One is associated with each domain.

typedef PointContainerType

typedef ParticleContainer<PointType> itk::ParticleSystem::PointContainerType;

Point container type. One is associated with each domain.

typedef PointVectorType

typedef NeighborhoodType::PointVectorType itk::ParticleSystem::PointVectorType;

typedef TransformType

typedef vnl_matrix_fixed<double, VDimension + 1, VDimension + 1> itk::ParticleSystem::TransformType;

Defines a transform class type. One is associated with each domain. Transforms are affine for simplicity. This could be extended by using the itk::Transform base type so that a variety of transform types may be used.

typedef VectorType

typedef vnl_vector_fixed<double, VDimension> itk::ParticleSystem::VectorType;

typedef VnlMatrixType

typedef vnl_matrix<double> itk::ParticleSystem::VnlMatrixType;

Public Functions Documentation

function itkNewMacro

itkNewMacro(
    Self 
)

Method for creation through the object factory.

function itkTypeMacro

itkTypeMacro(
    ParticleSystem ,
    DataObject 
)

Run-time type information (and related methods).

function itkStaticConstMacro

itkStaticConstMacro(
    Dimension ,
    unsigned int ,
    VDimension 
)

Dimensionality of the domain of the particle system.

function RegisterAttribute

void RegisterAttribute(
    ParticleAttribute< VDimension > * 
)

Register an attribute object with this particle system. This action adds the attribute object as an observer for the particle system so that it will receive published updates. For example, a gradient attribute object may need to know when particle positions have changed so that it can update its internal state appropriately (e.g. precompute a gradient that corresponds to the new particle position). Internally, this method manages registering the appropriate itk::Command and itk::Object as an observer of this itk::Object (AddObserver). Relevant state information is passed to objects in particle events.

function SynchronizePositions

inline void SynchronizePositions()

Invokes the set event on all particle positions, resetting them to their current value. This method may be called to synchronize positional information among various observers which may have gone out of sync.

function GetNumberOfParticles

inline unsigned long int GetNumberOfParticles(
    unsigned int d =0
) const

Returns the number of particles in domain k.

function AddPosition

const PointType & AddPosition(
    const PointType & ,
    unsigned int d =0,
    int threadId =0
)

Add/Set/Remove a single particle position. The actual position added or set will be returned. If, for example, the domain imposes any constraints on this location (e.g. out-of-bounds, projection onto a surface), then the method returns the location after constraints are applied. Both the Add and Set methods require a domain index. If unspecified, the domain index is zero. The Set method requires a specific particle index. If the given index does not exist, an exception is thrown. Set is intended to be used for moving particles. The SetTransformedPosition sets the position using a Point transformed by the m_Transform associated with the given domain.

function SetPosition

const PointType & SetPosition(
    const PointType & ,
    unsigned long int k,
    unsigned int d =0,
    int threadId =0
)

function RemovePosition

void RemovePosition(
    unsigned long int k,
    unsigned int d =0,
    int threadId =0
)

function GetPosition

inline PointType & GetPosition(
    unsigned long int k,
    unsigned int d =0
)

Return a position with index k from domain d. Note the order in which the 2 integers must be specified! The domain number is specified second and the position index within the domain is specified first. Note that the domain index may be omitted if the particle system only contains a single domain. GetTransformedPosition returns the position premultiplied by the transform matrix for the given domain.

function GetPosition

inline const PointType & GetPosition(
    unsigned long int k,
    unsigned int d =0
) const

function GetTransformedPosition

inline PointType GetTransformedPosition(
    unsigned long int k,
    unsigned int d =0
) const

function GetPrefixTransformedPosition

inline PointType GetPrefixTransformedPosition(
    unsigned long int k,
    unsigned int d =0
) const

function SplitAllParticles

void SplitAllParticles(
    double epsilon,
    int threadId =0
)

Doubles the number of particles of the system by splitting each particle into 2 particles. Each new particle position is added to the system at a random epsilon distance on the surface from the original particle. The new particles are added using the AddPosition method, so all appropriate callbacks are invoked.

function SplitParticle

void SplitParticle(
    double epsilon,
    unsigned int idx,
    unsigned int d =0,
    int threadId =0
)

function AdvancedAllParticleSplitting

void AdvancedAllParticleSplitting(
    double epsilon,
    unsigned int domains_per_shape,
    unsigned int dom_to_process
)

function PrintParticleSystem

void PrintParticleSystem()

function SetNeighborhood

void SetNeighborhood(
    unsigned int ,
    NeighborhoodType * ,
    int threadId =0
)

Set/Get the neighborhood object associated with domain k.

function SetNeighborhood

inline void SetNeighborhood(
    NeighborhoodType * n,
    int threadId =0
)

function GetNeighborhood

inline NeighborhoodType::ConstPointer GetNeighborhood(
    unsigned int k
) const

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    const PointType & p,
    int idx,
    double r,
    unsigned int d =0
) const

Return the neighborhood of points with radius r around point p in domain k. This is just a convenience method to avoid exposing the underlying Neighborhood objects. FindTransformedNeighborhoodPoints returns the list with all points transformed by the transform associated with the given domain.

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    const PointType & p,
    int idx,
    std::vector< double > & w,
    std::vector< double > & distances,
    double r,
    unsigned int d =0
) const

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    const PointType & p,
    int idx,
    std::vector< double > & w,
    double r,
    unsigned int d =0
) const

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    unsigned int idx,
    double r,
    unsigned int d =0
) const

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    unsigned int idx,
    std::vector< double > & w,
    std::vector< double > & distances,
    double r,
    unsigned int d =0
) const

function FindNeighborhoodPoints

inline PointVectorType FindNeighborhoodPoints(
    unsigned int idx,
    std::vector< double > & w,
    double r,
    unsigned int d =0
) const

function AddDomain

void AddDomain(
    DomainType::Pointer input,
    int threadId =0
)

Add a domain to the particle system. This method also allocates space for a list of positions that are contained within the domain, and a default neighborhood calculator. The final, optional argument indicates the calling thread id.

function GetDomainsBegin

inline std::vector< DomainType::Pointer >::const_iterator GetDomainsBegin() const

Return an iterator that points to the first element of the list of the domains.

function GetDomainsEnd

inline std::vector< DomainType::Pointer >::const_iterator GetDomainsEnd() const

Return an iterator that points one position past the last element of the list of the domains.

function GetDomain

inline DomainType * GetDomain(
    unsigned int i
)

Return the i'th domain object.

function GetDomain

inline DomainType * GetDomain()

API for the single domain case.

function GetDomain

inline const DomainType * GetDomain(
    unsigned int i
) const

Return the i'th domain object.

function GetDomain

inline const DomainType * GetDomain() const

API for the single domain case.

function GetNumberOfDomains

inline unsigned int GetNumberOfDomains() const

Returns the number of domains contained in the particle system.

function SetTransform

void SetTransform(
    unsigned int i,
    const TransformType & ,
    int threadId =0
)

Set the transform associated with domain i. This method will also compute and set the corresponding inverse transform if possible. If the inverse transform cannot be computed, the exception is quietly handled by this method and an identity transform is set in its place. The calling program is responsible for knowing when an inverse transform cannot be computed.

function SetTransform

inline void SetTransform(
    const TransformType & p,
    int threadId =0
)

function SetPrefixTransform

void SetPrefixTransform(
    unsigned int i,
    const TransformType & ,
    int threadId =0
)

function SetPrefixTransform

inline void SetPrefixTransform(
    const TransformType & p,
    int threadId =0
)

function GetTransformsBegin

inline std::vector< TransformType >::const_iterator GetTransformsBegin() const

Return an iterator that points to the first element of the list of the transforms.

function GetTransformsEnd

inline std::vector< TransformType >::const_iterator GetTransformsEnd() const

Return an iterator that points one position past the last element of the list of the transforms.

function GetTransform

inline const TransformType & GetTransform(
    unsigned int i
) const

Return the i'th transform object.

function GetTransform

inline const TransformType & GetTransform() const

API for the single transform case.

function GetTransform

inline TransformType GetTransform(
    unsigned int i
)

Return the i'th transform object.

function GetTransform

inline TransformType GetTransform()

API for the single transform case.

function GetPrefixTransform

inline const TransformType & GetPrefixTransform(
    unsigned int i
) const

Return the i'th transform object.

function GetPrefixTransform

inline const TransformType & GetPrefixTransform() const

API for the single transform case.

function GetPrefixTransform

inline TransformType GetPrefixTransform(
    unsigned int i
)

Return the i'th transform object.

function GetPrefixTransform

inline TransformType GetPrefixTransform()

API for the single transform case.

function GetInverseTransformsBegin

inline std::vector< TransformType >::const_iterator GetInverseTransformsBegin() const

Return an iterator that points to the first element of the list of the inverse transforms.

function GetInverseTransformsEnd

inline std::vector< TransformType >::const_iterator GetInverseTransformsEnd() const

Return an iterator that points one position past the last element of the list of the transforms.

function GetInverseTransform

inline const TransformType & GetInverseTransform(
    unsigned int i
) const

Return the i'th transform object.

function GetInverseTransform

inline const TransformType & GetInverseTransform() const

API for the single transform case.

function GetInversePrefixTransform

inline const TransformType & GetInversePrefixTransform(
    unsigned int i
) const

Return the i'th transform object.

function GetInversePrefixTransform

inline const TransformType & GetInversePrefixTransform() const

API for the single transform case.

function GetPositions

inline const std::vector< PointContainerType::Pointer > & GetPositions() const

Return the array of particle positions.

function GetPositions

inline const PointContainerType::Pointer & GetPositions(
    unsigned int d
) const

function AddPositionList

void AddPositionList(
    const std::vector< PointType > & ,
    unsigned int d =0,
    int threadId =0
)

Adds a list of points to the specified domain. The arguments are the std::vector of points and the domain number.

function TransformPoint

PointType TransformPoint(
    const PointType & ,
    const TransformType & 
) const

Transforms a point using the given transform. NOTE: Scaling is not currently implemented. (This method may be converted to virtual and overridden if tranform type is generalized.)

function TransformVector

VectorType TransformVector(
    const VectorType & ,
    const TransformType & 
) const

Transforms a vector using the given transform. Only the rotational part of the transform is applied. NOTE: Scaling is not currently supported.

function TransformNormalDerivative

VnlMatrixType TransformNormalDerivative(
    const VnlMatrixType & ,
    const TransformType & 
) const

Transforms the derivative of normals to new space.

function InvertTransform

inline TransformType InvertTransform(
    const TransformType & T
) const

Returns the inverse of a transformation matrix.

function FlagDomain

inline void FlagDomain(
    unsigned int i
)

Flag/Unflag a domain. Flagging a domain has different meanings according to the application using this particle system.

function UnflagDomain

inline void UnflagDomain(
    unsigned int i
)

function GetDomainFlag

inline bool GetDomainFlag(
    unsigned int i
) const

function GetDomainFlags

inline const std::vector< bool > & GetDomainFlags() const

function SetDomainFlags

inline void SetDomainFlags()

function ResetDomainFlags

inline void ResetDomainFlags()

function SetFixedParticleFlag

inline void SetFixedParticleFlag(
    unsigned int d,
    unsigned int i
)

The following methods provide functionality for specifying particle indices that are fixed landmarks. SetPosition() calls to these particle indices will silently fail. For simplicity, only one list of indices is maintained for all dimensions. If particle index n is flagged, for example, then particle index n in all domains is fixed.

function ResetFixedParticleFlag

inline void ResetFixedParticleFlag(
    unsigned int d,
    unsigned int i
)

function GetFixedParticleFlag

inline bool GetFixedParticleFlag(
    unsigned int d,
    unsigned int i
) const

function ResetFixedParticleFlags

inline void ResetFixedParticleFlags()

function SetDomainsPerShape

inline void SetDomainsPerShape(
    unsigned int num
)

function GetDomainsPerShape

inline unsigned int GetDomainsPerShape() const

function SetNumberOfDomains

void SetNumberOfDomains(
    unsigned int 
)

Set the number of domains. This method modifies the size of the m_Domains, m_Positions, and m_Transform lists.

Protected Functions Documentation

function ParticleSystem

ParticleSystem()

function PrintSelf

void PrintSelf(
    std::ostream & os,
    Indent indent
) const

function ~ParticleSystem

inline virtual ~ParticleSystem()

function GetDomainsBegin

inline std::vector< DomainType::Pointer >::iterator GetDomainsBegin()

Return an iterator that points to the first element of the list of the domains.

function GetDomainsEnd

inline std::vector< DomainType::Pointer >::iterator GetDomainsEnd()

Return an iterator that points one position past the last element of the list of the domains.

function GetTransformsBegin

inline std::vector< TransformType >::iterator GetTransformsBegin()

Return an iterator that points to the first element of the list of the transforms.

function GetTransformsEnd

inline std::vector< TransformType >::iterator GetTransformsEnd()

Return an iterator that points one position past the last element of the list of the transforms.

function GetInverseTransformsBegin

inline std::vector< TransformType >::iterator GetInverseTransformsBegin()

Return an iterator that points to the first element of the list of the inverse transforms.

function GetInverseTransformsEnd

inline std::vector< TransformType >::iterator GetInverseTransformsEnd()

Return an iterator that points one position past the last element of the list of the transforms.

function GetInverseTransform

inline TransformType & GetInverseTransform(
    unsigned int i
)

Return the i'th transform object.

function GetInverseTransform

inline TransformType & GetInverseTransform()

API for the single transform case.

function GetInversePrefixTransform

inline TransformType & GetInversePrefixTransform(
    unsigned int i
)

Return the i'th transform object.

function GetInversePrefixTransform

inline TransformType & GetInversePrefixTransform()

API for the single transform case.

Public Attributes Documentation

variable VDimension

static constexpr int VDimension = 3;

Updated on 2022-07-23 at 16:40:06 -0600