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 "vtkStatisticsAlgorithm.h"
105 
106 class vtkIdTypeArray;
107 class vtkIntArray;
108 class vtkDoubleArray;
111 
113 {
114 public:
116  virtual void PrintSelf( ostream& os, vtkIndent indent );
117  static vtkKMeansStatistics* New();
118 
120 
121  virtual void SetDistanceFunctor( vtkKMeansDistanceFunctor* );
122  vtkGetObjectMacro(DistanceFunctor,vtkKMeansDistanceFunctor);
124 
126 
128  vtkSetMacro(DefaultNumberOfClusters, int);
129  vtkGetMacro(DefaultNumberOfClusters, int);
131 
133 
134  vtkSetStringMacro(KValuesArrayName);
135  vtkGetStringMacro(KValuesArrayName);
137 
139 
141  vtkSetMacro( MaxNumIterations, int );
142  vtkGetMacro( MaxNumIterations, int );
144 
146 
148  vtkSetMacro( Tolerance, double );
149  vtkGetMacro( Tolerance, double );
151 
153 
156  vtkMultiBlockDataSet* ) { return; };
158 
159  //BTX
161 
162  virtual bool SetParameter(
163  const char* parameter, int index, vtkVariant value );
164  //ETX
166 
167 protected:
170 
172 
173  virtual void Learn( vtkTable*,
174  vtkTable*,
177 
179  virtual void Derive( vtkMultiBlockDataSet* );
180 
182 
183  virtual void Assess( vtkTable*,
185  vtkTable* );
187 
189 
190  virtual void Test( vtkTable*,
192  vtkTable* ) { return; };
194 
195  //BTX
197 
198  virtual void SelectAssessFunctor( vtkTable* inData,
199  vtkDataObject* inMeta,
200  vtkStringArray* rowNames,
201  AssessFunctor*& dfunc );
202  //ETX
204 
205 
208  virtual void UpdateClusterCenters( vtkTable* newClusterElements,
209  vtkTable* curClusterElements,
210  vtkIdTypeArray* numMembershipChanges,
211  vtkIdTypeArray* numElementsInCluster,
212  vtkDoubleArray* error,
213  vtkIdTypeArray* startRunID,
214  vtkIdTypeArray* endRunID,
215  vtkIntArray *computeRun );
217 
221  virtual vtkIdType GetTotalNumberOfObservations( vtkIdType numObservations );
222 
224 
228  int InitializeDataAndClusterCenters(vtkTable* inParameters,
229  vtkTable* inData,
230  vtkTable* dataElements,
231  vtkIdTypeArray* numberOfClusters,
232  vtkTable* curClusterElements,
233  vtkTable* newClusterElements,
234  vtkIdTypeArray* startRunID,
235  vtkIdTypeArray* endRunID);
237 
239 
242  virtual void CreateInitialClusterCenters(vtkIdType numToAllocate,
243  vtkIdTypeArray* numberOfClusters,
244  vtkTable* inData,
245  vtkTable* curClusterElements,
246  vtkTable* newClusterElements);
248 
249 
261  double Tolerance;
265 
266 private:
267  vtkKMeansStatistics( const vtkKMeansStatistics& ); // Not implemented
268  void operator=( const vtkKMeansStatistics& ); // Not implemented
269 };
270 
271 #endif