VTK
dox/Infovis/vtkStatisticsAlgorithm.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Visualization Toolkit
00004 Module:    vtkStatisticsAlgorithm.h
00005 
00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007 All rights reserved.
00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010 This software is distributed WITHOUT ANY WARRANTY; without even
00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012 PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2010 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019   -------------------------------------------------------------------------*/
00057 #ifndef __vtkStatisticsAlgorithm_h
00058 #define __vtkStatisticsAlgorithm_h
00059 
00060 #include "vtkTableAlgorithm.h"
00061 
00062 class vtkDataObjectCollection;
00063 class vtkMultiBlockDataSet;
00064 class vtkStdString;
00065 class vtkStringArray;
00066 class vtkVariant;
00067 class vtkVariantArray;
00068 class vtkStatisticsAlgorithmPrivate;
00069 
00070 class VTK_INFOVIS_EXPORT vtkStatisticsAlgorithm : public vtkTableAlgorithm
00071 {
00072 public:
00073   vtkTypeMacro(vtkStatisticsAlgorithm, vtkTableAlgorithm);
00074   void PrintSelf(ostream& os, vtkIndent indent);
00075   
00076 //BTX
00078 
00079   enum InputPorts
00080     {
00081     INPUT_DATA = 0,         
00082     LEARN_PARAMETERS = 1,   
00083     INPUT_MODEL = 2         
00084     };
00086 
00088 
00089   enum OutputIndices
00090     {
00091     OUTPUT_DATA  = 0,       
00092     OUTPUT_MODEL = 1,       
00093     ASSESSMENT   = 2,       
00094     OUTPUT_TEST  = 2        
00095     };
00096 //ETX
00098 
00100 
00103   virtual void SetLearnOptionParameterConnection( vtkAlgorithmOutput* params )
00104     { this->SetInputConnection( vtkStatisticsAlgorithm::LEARN_PARAMETERS, params ); }
00106 
00108 
00111   virtual void SetLearnOptionParameters( vtkDataObject* params )
00112     { this->SetInput( vtkStatisticsAlgorithm::LEARN_PARAMETERS, params ); }
00114 
00116 
00119   virtual void SetInputModelConnection( vtkAlgorithmOutput* model )
00120     { this->SetInputConnection( vtkStatisticsAlgorithm::INPUT_MODEL, model ); }
00122 
00124 
00126   virtual void SetInputModel( vtkDataObject* model )
00127     { this->SetInput( vtkStatisticsAlgorithm::INPUT_MODEL, model ); }
00129 
00131 
00132   vtkSetMacro( LearnOption, bool );
00133   vtkGetMacro( LearnOption, bool );
00135 
00137 
00138   vtkSetMacro( DeriveOption, bool );
00139   vtkGetMacro( DeriveOption, bool );
00141 
00143 
00144   vtkSetMacro( AssessOption, bool );
00145   vtkGetMacro( AssessOption, bool );
00147 
00149 
00150   vtkSetMacro( TestOption, bool );
00151   vtkGetMacro( TestOption, bool );
00153 
00155 
00156   vtkSetMacro( NumberOfPrimaryTables, vtkIdType );
00157   vtkGetMacro( NumberOfPrimaryTables, vtkIdType );
00159 
00161 
00162   virtual void SetAssessParameters( vtkStringArray* );
00163   vtkGetObjectMacro(AssessParameters,vtkStringArray);
00165 
00167 
00168   virtual void SetAssessNames( vtkStringArray* );
00169   vtkGetObjectMacro(AssessNames,vtkStringArray);
00171 
00173   void SetAssessOptionParameter( vtkIdType id, vtkStdString name );
00174 
00176   vtkStdString GetAssessParameter( vtkIdType id );
00177 
00178 //BTX
00180 
00181   class AssessFunctor {
00182   public:
00183     virtual void operator() ( vtkVariantArray*,
00184                               vtkIdType ) = 0;
00185     virtual ~AssessFunctor() { }
00186   };
00187 //ETX
00189 
00201   virtual void SetColumnStatus( const char* namCol, int status );
00202 
00205   virtual void ResetAllColumnStates();
00206 
00210   virtual int RequestSelectedColumns();
00211 
00213   virtual void ResetRequests();
00214 
00220   virtual vtkIdType GetNumberOfRequests();
00221 
00223   virtual vtkIdType GetNumberOfColumnsForRequest( vtkIdType request );
00224 
00226 
00235   virtual const char* GetColumnForRequest( vtkIdType r, vtkIdType c );
00236   //BTX
00237   virtual int GetColumnForRequest( vtkIdType r, vtkIdType c, vtkStdString& columnName );
00238   //ETX
00240 
00242 
00247   virtual bool SetParameter( const char* parameter,
00248                              int index,
00249                              vtkVariant value );
00251 
00253 
00254   virtual void Aggregate( vtkDataObjectCollection*,
00255                           vtkMultiBlockDataSet* ) = 0;
00257 
00258 protected:
00259   vtkStatisticsAlgorithm();
00260   ~vtkStatisticsAlgorithm();
00261 
00262   virtual int FillInputPortInformation( int port, vtkInformation* info );
00263   virtual int FillOutputPortInformation( int port, vtkInformation* info );
00264 
00265   virtual int RequestData(
00266     vtkInformation*,
00267     vtkInformationVector**,
00268     vtkInformationVector* );
00269 
00271 
00273   virtual void Learn( vtkTable*,
00274                       vtkTable*,
00275                       vtkMultiBlockDataSet* ) = 0;
00277 
00279   virtual void Derive( vtkMultiBlockDataSet* ) = 0;
00280 
00282 
00283   virtual void Assess( vtkTable*,
00284                        vtkMultiBlockDataSet*,
00285                        vtkTable* ) = 0; 
00287 
00289 
00290   virtual void Test( vtkTable*,
00291                      vtkMultiBlockDataSet*,
00292                      vtkTable* ) = 0; 
00294 
00295   //BTX
00297 
00298   virtual void SelectAssessFunctor( vtkTable* outData, 
00299                                     vtkDataObject* inMeta,
00300                                     vtkStringArray* rowNames,
00301                                     AssessFunctor*& dfunc ) = 0;
00302   //ETX
00304 
00305   int NumberOfPrimaryTables;
00306   bool LearnOption;
00307   bool DeriveOption;
00308   bool AssessOption;
00309   bool TestOption;
00310   vtkStringArray* AssessParameters;
00311   vtkStringArray* AssessNames;
00312   vtkStatisticsAlgorithmPrivate* Internals;
00313 
00314 private:
00315   vtkStatisticsAlgorithm(const vtkStatisticsAlgorithm&); // Not implemented
00316   void operator=(const vtkStatisticsAlgorithm&);   // Not implemented
00317 };
00318 
00319 #endif