Shapeworks Studio  2.1
Shape analysis software suite
itkPSMShapeMatrixAttribute.h
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPSMShapeMatrixAttribute_h
19 #define __itkPSMShapeMatrixAttribute_h
20 
21 #include "itkDataObject.h"
22 #include "itkWeakPointer.h"
23 #include "itkPSMAttribute.h"
24 #include "itkPSMContainer.h"
25 #include "itkPSMParticleSystem.h"
26 #include "vnl/vnl_matrix.h"
27 
28 namespace itk
29 {
44 template <class T, unsigned int VDimension>
45 class ITK_EXPORT PSMShapeMatrixAttribute
46  : public vnl_matrix<T>, public PSMAttribute<VDimension>
47 {
48 public:
50  typedef T DataType;
52  typedef PSMAttribute<VDimension> Superclass;
53  typedef SmartPointer<Self> Pointer;
54  typedef SmartPointer<const Self> ConstPointer;
55  typedef WeakPointer<const Self> ConstWeakPointer;
56 
58  itkNewMacro(Self);
59 
62 
64  virtual void Initialize() {};
65 
70  virtual void DomainAddEventCallback(Object *, const EventObject &e);
71 
73  virtual void ResizeMatrix(int , int );
74 
78  virtual void PositionAddEventCallback(Object *o, const EventObject &e);
79 
82  virtual void PositionSetEventCallback(Object *o, const EventObject &e);
83 
85  virtual void PositionRemoveEventCallback(Object *, const EventObject &)
86  {
87  itkExceptionMacro("This Attribute class does not support particle position removal.");
88  }
89 
92  void SetDomainsPerShape(int i)
93  { m_DomainsPerShape = i; }
94  int GetDomainsPerShape() const
95  { return m_DomainsPerShape; }
96 
99  virtual void BeforeIteration() {}
100 
103  virtual void AfterIteration() {}
104 
106  virtual void SetMatrix(const vnl_matrix<T> &m)
107  {
108  vnl_matrix<T>::operator=(m);
109  }
110 
111 protected:
112  PSMShapeMatrixAttribute() : m_DomainsPerShape(1)
113  {
114  this->m_DefinedCallbacks.DomainAddEvent = true;
115  this->m_DefinedCallbacks.PositionAddEvent = true;
116  this->m_DefinedCallbacks.PositionSetEvent = true;
117  this->m_DefinedCallbacks.PositionRemoveEvent = true;
118  }
119  virtual ~PSMShapeMatrixAttribute() {};
120 
121  void PrintSelf(std::ostream& os, Indent indent) const
122  { Superclass::PrintSelf(os,indent); }
123 
124  int m_DomainsPerShape;
125 
126 private:
127  PSMShapeMatrixAttribute(const Self&); //purposely not implemented
128  void operator=(const Self&); //purposely not implemented
129 
130 };
131 
132 } // end namespace
133 
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "itkPSMShapeMatrixAttribute.hxx"
136 #endif
137 
138 #endif
Each column describes a shape. A shape may be composed of m_DomainsPerShape domains (default 1)...
virtual void SetMatrix(const vnl_matrix< T > &m)
Base class for PSMParticleSystem attribute classes.
virtual void PositionRemoveEventCallback(Object *, const EventObject &)