VTK
vtkKMeansDistanceFunctor.h
Go to the documentation of this file.
1 #ifndef vtkKMeansDistanceFunctor_h
2 #define vtkKMeansDistanceFunctor_h
3 
16 #include "vtkFiltersStatisticsModule.h" // For export macro
17 #include "vtkObject.h"
18 
19 class vtkVariantArray;
20 class vtkAbstractArray;
21 class vtkTable;
22 
23 class VTKFILTERSSTATISTICS_EXPORT vtkKMeansDistanceFunctor : public vtkObject
24 {
25 public:
28  void PrintSelf( ostream& os, vtkIndent indent ) VTK_OVERRIDE;
29 
34  virtual vtkVariantArray* GetEmptyTuple( vtkIdType dimension );
35 
40  virtual void operator() ( double&, vtkVariantArray*, vtkVariantArray * );
41 
50  virtual void PairwiseUpdate( vtkTable* clusterCenters, vtkIdType row, vtkVariantArray* data, vtkIdType dataCardinality, vtkIdType totalCardinality );
51 
61 
67 
71  virtual void DeallocateElementArray( void* );
72 
78 
83  virtual void PackElements( vtkTable* curTable, void* vElements );
84 
86 
90  virtual void UnPackElements( vtkTable* curTable, vtkTable* newTable, void* vLocalElements, void* vGlobalElements, int np );
91  virtual void UnPackElements( vtkTable* curTable, void* vLocalElements, vtkIdType numRows, vtkIdType numCols );
93 
97  virtual int GetDataType();
98 
99 protected:
102 
103  vtkVariantArray* EmptyTuple; // Used to quickly initialize Tuple for each datum
104  vtkTable* CenterUpdates; // Used to hold online computation of next iteration's cluster center coords.
105 
106 private:
107  vtkKMeansDistanceFunctor( const vtkKMeansDistanceFunctor& ) VTK_DELETE_FUNCTION;
108  void operator = ( const vtkKMeansDistanceFunctor& ) VTK_DELETE_FUNCTION;
109 };
110 
111 #endif // vtkKMeansDistanceFunctor_h
vtkKMeansDistanceFunctor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
vtkKMeansDistanceFunctor
measure distance from k-means cluster centers
Definition: vtkKMeansDistanceFunctor.h:24
vtkKMeansDistanceFunctor::GetEmptyTuple
virtual vtkVariantArray * GetEmptyTuple(vtkIdType dimension)
Return an empty tuple.
vtkKMeansDistanceFunctor::GetDataType
virtual int GetDataType()
Return the data type used to store cluster center coordinates.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkVariantArray
An array holding vtkVariants.
Definition: vtkVariantArray.h:47
vtkKMeansDistanceFunctor::CreateCoordinateArray
virtual vtkAbstractArray * CreateCoordinateArray()
Return a vtkAbstractArray capable of holding cluster center coordinates.
vtkKMeansDistanceFunctor::PackElements
virtual void PackElements(vtkTable *curTable, void *vElements)
Pack the cluster center coordinates in vElements into columns of curTable.
vtkKMeansDistanceFunctor::~vtkKMeansDistanceFunctor
~vtkKMeansDistanceFunctor() override
vtkKMeansDistanceFunctor::UnPackElements
virtual void UnPackElements(vtkTable *curTable, vtkTable *newTable, void *vLocalElements, void *vGlobalElements, int np)
Unpack the cluster center coordinates in vElements into columns of curTable.
vtkKMeansDistanceFunctor::vtkKMeansDistanceFunctor
vtkKMeansDistanceFunctor()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkKMeansDistanceFunctor::PairwiseUpdate
virtual void PairwiseUpdate(vtkTable *clusterCenters, vtkIdType row, vtkVariantArray *data, vtkIdType dataCardinality, vtkIdType totalCardinality)
This is called once per observation per run per iteration in order to assign the observation to its n...
vtkObject.h
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:79
vtkKMeansDistanceFunctor::PerturbElement
virtual void PerturbElement(vtkTable *, vtkTable *, vtkIdType, vtkIdType, vtkIdType, double)
When a cluster center (1) has no observations that are closer to it than other cluster centers or (2)...
vtkKMeansDistanceFunctor::DeallocateElementArray
virtual void DeallocateElementArray(void *)
Free an array allocated with AllocateElementArray.
vtkKMeansDistanceFunctor::AllocateElementArray
virtual void * AllocateElementArray(vtkIdType size)
Allocate an array large enough to hold size coordinates and return a void pointer to this array.
vtkKMeansDistanceFunctor::New
static vtkKMeansDistanceFunctor * New()
vtkKMeansDistanceFunctor::UnPackElements
virtual void UnPackElements(vtkTable *curTable, void *vLocalElements, vtkIdType numRows, vtkIdType numCols)