VTK
vtkKMeansStatistics.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkKMeansStatistics.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2010 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19  -------------------------------------------------------------------------*/
101 #ifndef vtkKMeansStatistics_h
102 #define vtkKMeansStatistics_h
103 
104 #include "vtkFiltersStatisticsModule.h" // For export macro
105 #include "vtkStatisticsAlgorithm.h"
106 
107 class vtkIdTypeArray;
108 class vtkIntArray;
109 class vtkDoubleArray;
112 
114 {
115 public:
117  virtual void PrintSelf( ostream& os, vtkIndent indent );
118  static vtkKMeansStatistics* New();
119 
121 
122  virtual void SetDistanceFunctor( vtkKMeansDistanceFunctor* );
123  vtkGetObjectMacro(DistanceFunctor,vtkKMeansDistanceFunctor);
125 
127 
129  vtkSetMacro(DefaultNumberOfClusters, int);
130  vtkGetMacro(DefaultNumberOfClusters, int);
132 
134 
135  vtkSetStringMacro(KValuesArrayName);
136  vtkGetStringMacro(KValuesArrayName);
138 
140 
142  vtkSetMacro( MaxNumIterations, int );
143  vtkGetMacro( MaxNumIterations, int );
145 
147 
149  vtkSetMacro( Tolerance, double );
150  vtkGetMacro( Tolerance, double );
152 
154 
157  vtkMultiBlockDataSet* ) { return; };
159 
160  //BTX
162 
163  virtual bool SetParameter(
164  const char* parameter, int index, vtkVariant value );
165  //ETX
167 
168 protected:
171 
173 
174  virtual void Learn( vtkTable*,
175  vtkTable*,
178 
180  virtual void Derive( vtkMultiBlockDataSet* );
181 
183 
184  virtual void Assess( vtkTable*,
186  vtkTable* );
188 
190 
191  virtual void Test( vtkTable*,
193  vtkTable* ) { return; };
195 
196  //BTX
198 
199  virtual void SelectAssessFunctor( vtkTable* inData,
200  vtkDataObject* inMeta,
201  vtkStringArray* rowNames,
202  AssessFunctor*& dfunc );
203  //ETX
205 
206 
209  virtual void UpdateClusterCenters( vtkTable* newClusterElements,
210  vtkTable* curClusterElements,
211  vtkIdTypeArray* numMembershipChanges,
212  vtkIdTypeArray* numElementsInCluster,
213  vtkDoubleArray* error,
214  vtkIdTypeArray* startRunID,
215  vtkIdTypeArray* endRunID,
216  vtkIntArray *computeRun );
218 
222  virtual vtkIdType GetTotalNumberOfObservations( vtkIdType numObservations );
223 
225 
229  int InitializeDataAndClusterCenters(vtkTable* inParameters,
230  vtkTable* inData,
231  vtkTable* dataElements,
232  vtkIdTypeArray* numberOfClusters,
233  vtkTable* curClusterElements,
234  vtkTable* newClusterElements,
235  vtkIdTypeArray* startRunID,
236  vtkIdTypeArray* endRunID);
238 
240 
243  virtual void CreateInitialClusterCenters(vtkIdType numToAllocate,
244  vtkIdTypeArray* numberOfClusters,
245  vtkTable* inData,
246  vtkTable* curClusterElements,
247  vtkTable* newClusterElements);
249 
250 
262  double Tolerance;
266 
267 private:
268  vtkKMeansStatistics( const vtkKMeansStatistics& ); // Not implemented
269  void operator=( const vtkKMeansStatistics& ); // Not implemented
270 };
271 
272 #endif
virtual void Test(vtkTable *, vtkMultiBlockDataSet *, vtkTable *)
virtual void Assess(vtkTable *, vtkMultiBlockDataSet *, vtkTable *)=0
static vtkTableAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
maintain an unordered list of data objects
vtkKMeansDistanceFunctor * DistanceFunctor
a vtkAbstractArray subclass for strings
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:247
virtual void Aggregate(vtkDataObjectCollection *, vtkMultiBlockDataSet *)
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
dynamic, self-adjusting array of double
Base class for statistics algorithms.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
a simple class to control print indentation
Definition: vtkIndent.h:38
A class for KMeans clustering.
virtual void Learn(vtkTable *, vtkTable *, vtkMultiBlockDataSet *)=0
virtual void Derive(vtkMultiBlockDataSet *)=0
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:67
virtual bool SetParameter(const char *parameter, int index, vtkVariant value)
Composite dataset that organizes datasets into blocks.
virtual void SelectAssessFunctor(vtkTable *outData, vtkDataObject *inMeta, vtkStringArray *rowNames, AssessFunctor *&dfunc)=0
#define VTKFILTERSSTATISTICS_EXPORT
general representation of visualization data
Definition: vtkDataObject.h:64
measure distance from k-means cluster centers