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 2008 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 vtkStdString;
00064 class vtkStringArray;
00065 class vtkVariant;
00066 class vtkVariantArray;
00067 class vtkStatisticsAlgorithmPrivate;
00068 
00069 class VTK_INFOVIS_EXPORT vtkStatisticsAlgorithm : public vtkTableAlgorithm
00070 {
00071 public:
00072   vtkTypeMacro(vtkStatisticsAlgorithm, vtkTableAlgorithm);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074   
00075 //BTX
00077 
00078   enum InputPorts
00079     {
00080     INPUT_DATA = 0,         
00081     LEARN_PARAMETERS = 1,   
00082     INPUT_MODEL = 2         
00083     };
00085 
00087 
00088   enum OutputIndices
00089     {
00090     OUTPUT_DATA  = 0,       
00091     OUTPUT_MODEL = 1,       
00092     ASSESSMENT   = 2,       
00093     OUTPUT_TEST  = 2        
00094     };
00096 //ETX
00097 
00099 
00102   virtual void SetLearnOptionParameterConnection( vtkAlgorithmOutput* params )
00103     { this->SetInputConnection( vtkStatisticsAlgorithm::LEARN_PARAMETERS, params ); }
00105 
00107 
00110   virtual void SetLearnOptionParameters( vtkDataObject* params )
00111     { this->SetInput( vtkStatisticsAlgorithm::LEARN_PARAMETERS, params ); }
00113 
00115 
00118   virtual void SetInputModelConnection( vtkAlgorithmOutput* model )
00119     { this->SetInputConnection( vtkStatisticsAlgorithm::INPUT_MODEL, model ); }
00121 
00123 
00125   virtual void SetInputModel( vtkDataObject* model )
00126     { this->SetInput( vtkStatisticsAlgorithm::INPUT_MODEL, model ); }
00128 
00130 
00131   vtkSetMacro( LearnOption, bool );
00132   vtkGetMacro( LearnOption, bool );
00134 
00136 
00137   vtkSetMacro( DeriveOption, bool );
00138   vtkGetMacro( DeriveOption, bool );
00140 
00142 
00143   vtkSetMacro( AssessOption, bool );
00144   vtkGetMacro( AssessOption, bool );
00146 
00148 
00149   vtkSetMacro( TestOption, bool );
00150   vtkGetMacro( TestOption, bool );
00152 
00154 
00155   virtual void SetAssessParameters( vtkStringArray* );
00156   vtkGetObjectMacro(AssessParameters,vtkStringArray);
00158 
00160 
00161   virtual void SetAssessNames( vtkStringArray* );
00162   vtkGetObjectMacro(AssessNames,vtkStringArray);
00164 
00165 //BTX
00167   void SetAssessOptionParameter( vtkIdType id, vtkStdString name );
00168 
00170   vtkStdString GetAssessParameter( vtkIdType id );
00171 
00173 
00174   class AssessFunctor {
00175   public:
00176     virtual void operator() ( vtkVariantArray*,
00177                               vtkIdType ) = 0;
00178     virtual ~AssessFunctor() { }
00179   };
00181 //ETX
00182 
00194   virtual void SetColumnStatus( const char* namCol, int status );
00195 
00198   virtual void ResetAllColumnStates();
00199 
00203   virtual int RequestSelectedColumns();
00204 
00206   virtual void ResetRequests();
00207 
00213   virtual vtkIdType GetNumberOfRequests();
00214 
00216   virtual vtkIdType GetNumberOfColumnsForRequest( vtkIdType request );
00217 
00219 
00228   virtual const char* GetColumnForRequest( vtkIdType r, vtkIdType c );
00229   //BTX
00230   virtual int GetColumnForRequest( vtkIdType r, vtkIdType c, vtkStdString& columnName );
00231   //ETX
00233 
00234 //BTX  
00236 
00241   virtual bool SetParameter( const char* parameter,
00242                              int index,
00243                              vtkVariant value );
00245 //ETX
00246 
00248 
00249   virtual void Aggregate( vtkDataObjectCollection*,
00250                           vtkDataObject* ) = 0;
00252 
00253 protected:
00254   vtkStatisticsAlgorithm();
00255   ~vtkStatisticsAlgorithm();
00256 
00257   virtual int FillInputPortInformation( int port, vtkInformation* info );
00258   virtual int FillOutputPortInformation( int port, vtkInformation* info );
00259 
00260   virtual int RequestData(
00261     vtkInformation*,
00262     vtkInformationVector**,
00263     vtkInformationVector* );
00264 
00266 
00268   virtual void Learn( vtkTable*,
00269                       vtkTable*,
00270                       vtkDataObject* ) = 0;
00272 
00274   virtual void Derive( vtkDataObject* ) = 0;
00275 
00277 
00278   virtual void Assess( vtkTable*,
00279                        vtkDataObject*,
00280                        vtkTable* ) = 0; 
00282 
00284 
00285   virtual void Test( vtkTable*,
00286                      vtkDataObject*,
00287                      vtkDataObject* ) = 0; 
00289 
00290   //BTX
00292 
00293   virtual void SelectAssessFunctor( vtkTable* outData, 
00294                                     vtkDataObject* inMeta,
00295                                     vtkStringArray* rowNames,
00296                                     AssessFunctor*& dfunc ) = 0;
00297   //ETX
00299 
00300   bool LearnOption;
00301   bool DeriveOption;
00302   bool AssessOption;
00303   bool TestOption;
00304   vtkStringArray* AssessParameters;
00305   vtkStringArray* AssessNames;
00306   vtkStatisticsAlgorithmPrivate* Internals;
00307 
00308 private:
00309   vtkStatisticsAlgorithm(const vtkStatisticsAlgorithm&); // Not implemented
00310   void operator=(const vtkStatisticsAlgorithm&);   // Not implemented
00311 };
00312 
00313 #endif