Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
itk::PSMShapeMatrixAttribute< T, VDimension > Class Template Reference

Each column describes a shape. A shape may be composed of m_DomainsPerShape domains (default 1). In this implementation, all domains must have the same number of particles. More...

#include <itkPSMShapeMatrixAttribute.h>

+ Inheritance diagram for itk::PSMShapeMatrixAttribute< T, VDimension >:
+ Collaboration diagram for itk::PSMShapeMatrixAttribute< T, VDimension >:

Public Types

typedef T DataType
 
typedef PSMShapeMatrixAttribute Self
 
typedef PSMAttribute< VDimension > Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef WeakPointer< const SelfConstWeakPointer
 
- Public Types inherited from itk::PSMAttribute< VDimension >
typedef PSMAttribute Self
 
typedef DataObject Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef WeakPointer< const SelfConstWeakPointer
 

Public Member Functions

 itkNewMacro (Self)
 
 itkTypeMacro (PSMShapeMatrixAttribute, PSMAttribute)
 
virtual void Initialize ()
 
virtual void DomainAddEventCallback (Object *, const EventObject &e)
 
virtual void ResizeMatrix (int, int)
 
virtual void PositionAddEventCallback (Object *o, const EventObject &e)
 
virtual void PositionSetEventCallback (Object *o, const EventObject &e)
 
virtual void PositionRemoveEventCallback (Object *, const EventObject &)
 
void SetDomainsPerShape (int i)
 
int GetDomainsPerShape () const
 
virtual void BeforeIteration ()
 
virtual void AfterIteration ()
 
virtual void SetMatrix (const vnl_matrix< T > &m)
 
- Public Member Functions inherited from itk::PSMAttribute< VDimension >
 itkNewMacro (Self)
 
 itkTypeMacro (PSMAttribute, DataObject)
 
virtual void EventCallback (Object *, const EventObject &)
 
virtual void EventWithIndexCallback (Object *, const EventObject &)
 
virtual void TransformSetEventCallback (Object *, const EventObject &)
 
virtual void PrefixTransformSetEventCallback (Object *, const EventObject &)
 
virtual void NeighborhoodSetEventCallback (Object *, const EventObject &)
 

Protected Member Functions

void PrintSelf (std::ostream &os, Indent indent) const
 
- Protected Member Functions inherited from itk::PSMAttribute< VDimension >
void PrintSelf (std::ostream &os, Indent indent) const
 

Protected Attributes

int m_DomainsPerShape
 

Additional Inherited Members

- Public Attributes inherited from itk::PSMAttribute< VDimension >
DefinedCallbacksStruct m_DefinedCallbacks
 

Detailed Description

template<class T, unsigned int VDimension>
class itk::PSMShapeMatrixAttribute< T, VDimension >

Each column describes a shape. A shape may be composed of m_DomainsPerShape domains (default 1). In this implementation, all domains must have the same number of particles.

This class defines a shape matrix. Each of the columns in the matrix is a point-based representation of a different shape.

Author
Josh Cates

Definition at line 45 of file itkPSMShapeMatrixAttribute.h.

Member Typedef Documentation

template<class T, unsigned int VDimension>
typedef T itk::PSMShapeMatrixAttribute< T, VDimension >::DataType

Standard class typedefs

Definition at line 50 of file itkPSMShapeMatrixAttribute.h.

Member Function Documentation

template<class T, unsigned int VDimension>
virtual void itk::PSMShapeMatrixAttribute< T, VDimension >::AfterIteration ( )
inlinevirtual

Method defining actions after the iteration of a solver that is using this class (via a PSM function object).

Definition at line 103 of file itkPSMShapeMatrixAttribute.h.

103 {}
template<class T, unsigned int VDimension>
virtual void itk::PSMShapeMatrixAttribute< T, VDimension >::BeforeIteration ( )
inlinevirtual

Method defining actions before the iteration of a solver that is using this class (via a PSM function object).

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 99 of file itkPSMShapeMatrixAttribute.h.

99 {}
template<class T , unsigned int VDimension>
void itk::PSMShapeMatrixAttribute< T, VDimension >::DomainAddEventCallback ( Object *  ,
const EventObject &  e 
)
virtual

Callbacks that may be defined by a subclass. If a subclass defines one of these callback methods, the corresponding flag in m_DefinedCallbacks should be set to true so that the PSMParticleSystem will know to register the appropriate event with this method.

Reimplemented from itk::PSMAttribute< VDimension >.

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 26 of file itkPSMShapeMatrixAttribute.hxx.

27 {
28  const ParticleDomainAddEvent &event = dynamic_cast<const ParticleDomainAddEvent &>(e);
29  unsigned int d = event.GetDomainIndex();
30 
31  if ( d % m_DomainsPerShape == 0 )
32  {
33  this->ResizeMatrix(this->rows(), this->cols()+1);
34  }
35 }
template<class T, unsigned int VDimension>
virtual void itk::PSMShapeMatrixAttribute< T, VDimension >::Initialize ( )
inlinevirtual

Perform any initialization steps. This can be overridden by subclasses.

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 64 of file itkPSMShapeMatrixAttribute.h.

64 {};
template<class T, unsigned int VDimension>
itk::PSMShapeMatrixAttribute< T, VDimension >::itkNewMacro ( Self  )

Method for creation through the object factory.

template<class T, unsigned int VDimension>
itk::PSMShapeMatrixAttribute< T, VDimension >::itkTypeMacro ( PSMShapeMatrixAttribute< T, VDimension >  ,
PSMAttribute   
)

Run-time type information (and related methods).

template<class T , unsigned int VDimension>
void itk::PSMShapeMatrixAttribute< T, VDimension >::PositionAddEventCallback ( Object *  o,
const EventObject &  e 
)
virtual

Callback defining actions when a position is added to a ParticleSystem. This method will likely be called from itkParticleSystem with the event ParticleAddEvent.

Reimplemented from itk::PSMAttribute< VDimension >.

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 56 of file itkPSMShapeMatrixAttribute.hxx.

57 {
58  const ParticlePositionAddEvent &event = dynamic_cast<const ParticlePositionAddEvent &>(e);
59  const PSMParticleSystem<VDimension> *ps= dynamic_cast<const PSMParticleSystem<VDimension> *>(o);
60  const int d = event.GetDomainIndex();
61  const unsigned int idx = event.GetPositionIndex();
62  const typename PSMParticleSystem<VDimension>::PointType pos = ps->GetTransformedPosition(idx, d);
63 
64  const unsigned int PointsPerDomain = ps ->GetNumberOfParticles(d);
65 
66  // Make sure we have enough rows.
67  if ((ps->GetNumberOfParticles(d) * VDimension * m_DomainsPerShape) > this->rows())
68  {
69  this->ResizeMatrix(PointsPerDomain * VDimension * m_DomainsPerShape, this->cols());
70  }
71 
72  // CANNOT ADD POSITION INFO UNTIL ALL POINTS PER DOMAIN IS KNOWN
73  // Add position info to the matrix
74  unsigned int k = ((d % m_DomainsPerShape) * PointsPerDomain * VDimension)
75  + (idx * VDimension);
76  for (unsigned int i = 0; i < VDimension; i++)
77  {
78  this->operator()(i+k, d / m_DomainsPerShape) = pos[i];
79  }
80 }
Point< double, VDimension > PointType
template<class T, unsigned int VDimension>
virtual void itk::PSMShapeMatrixAttribute< T, VDimension >::PositionRemoveEventCallback ( Object *  ,
const EventObject &   
)
inlinevirtual

Reserved for future implementation.

Reimplemented from itk::PSMAttribute< VDimension >.

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 85 of file itkPSMShapeMatrixAttribute.h.

86  {
87  itkExceptionMacro("This Attribute class does not support particle position removal.");
88  }
template<class T , unsigned int VDimension>
void itk::PSMShapeMatrixAttribute< T, VDimension >::PositionSetEventCallback ( Object *  o,
const EventObject &  e 
)
virtual

Callback for defining actions when a position value is set – usually from ParticleSystem.

Reimplemented from itk::PSMAttribute< VDimension >.

Reimplemented in itk::PSMMixedEffectsShapeMatrixAttribute< T, VDimension >, and itk::PSMRegressionShapeMatrixAttribute< T, VDimension >.

Definition at line 83 of file itkPSMShapeMatrixAttribute.hxx.

84 {
85  const ParticlePositionSetEvent &event = dynamic_cast<const ParticlePositionSetEvent &>(e);
86  const PSMParticleSystem<VDimension> *ps= dynamic_cast<const PSMParticleSystem<VDimension> *>(o);
87  const int d = event.GetDomainIndex();
88  const unsigned int idx = event.GetPositionIndex();
89  const typename PSMParticleSystem<VDimension>::PointType pos = ps->GetTransformedPosition(idx, d);
90  const unsigned int PointsPerDomain = ps ->GetNumberOfParticles(d);
91 
92  // Modify matrix info
93  // unsigned int k = VDimension * idx;
94  unsigned int k = ((d % m_DomainsPerShape) * PointsPerDomain * VDimension)
95  + (idx * VDimension);
96  for (unsigned int i = 0; i < VDimension; i++)
97  {
98  this->operator()(i+k, d / m_DomainsPerShape) = pos[i];
99  }
100 }
Point< double, VDimension > PointType
template<class T , unsigned int VDimension>
void itk::PSMShapeMatrixAttribute< T, VDimension >::ResizeMatrix ( int  rs,
int  cs 
)
virtual

Resize the existing matrix to a given size.

Definition at line 38 of file itkPSMShapeMatrixAttribute.hxx.

39 {
40  vnl_matrix<T> tmp(*this); // copy existing matrix
41 
42  // Create new column (shape)
43  this->set_size(rs, cs);
44 
45  // Copy old data into new matrix.
46  for (unsigned int c = 0; c < tmp.cols(); c++)
47  {
48  for (unsigned int r = 0; r < tmp.rows(); r++)
49  {
50  this->operator()(r,c) = tmp(r,c);
51  }
52  }
53 }
template<class T, unsigned int VDimension>
void itk::PSMShapeMatrixAttribute< T, VDimension >::SetDomainsPerShape ( int  i)
inline

Set/Get the number of domains per shape. This can only be safely done before shapes are initialized with points!

Definition at line 92 of file itkPSMShapeMatrixAttribute.h.

93  { m_DomainsPerShape = i; }
template<class T, unsigned int VDimension>
virtual void itk::PSMShapeMatrixAttribute< T, VDimension >::SetMatrix ( const vnl_matrix< T > &  m)
inlinevirtual

Directly supply the matrix data.

Definition at line 106 of file itkPSMShapeMatrixAttribute.h.

107  {
108  vnl_matrix<T>::operator=(m);
109  }

The documentation for this class was generated from the following files: