VTK
dox/Infovis/vtkBivariateLinearTableThreshold.h
Go to the documentation of this file.
00001 /*=========================================================================
00002   
00003 Program:   Visualization Toolkit
00004 Module:    vtkBivariateLinearTableThreshold.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 2009 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 -------------------------------------------------------------------------*/
00039 #ifndef __vtkBivariateLinearTableThreshold__h
00040 #define __vtkBivariateLinearTableThreshold__h
00041 
00042 #include "vtkTableAlgorithm.h"
00043 #include "vtkSmartPointer.h"  //Required for smart pointer internal ivars
00044 
00045 class vtkDataArrayCollection;
00046 class vtkDoubleArray;
00047 class vtkIdTypeArray;
00048 class vtkTable;
00049 
00050 class VTK_INFOVIS_EXPORT vtkBivariateLinearTableThreshold : public vtkTableAlgorithm
00051 {
00052 public:
00053   static vtkBivariateLinearTableThreshold* New();
00054   vtkTypeMacro(vtkBivariateLinearTableThreshold, vtkTableAlgorithm);
00055   void PrintSelf(ostream& os, vtkIndent indent);
00056 
00058 
00060   vtkSetMacro(Inclusive,int);
00061   vtkGetMacro(Inclusive,int);
00063 
00066   void AddColumnToThreshold(vtkIdType column, vtkIdType component);
00067   
00069   int GetNumberOfColumnsToThreshold();
00070 
00073   void GetColumnToThreshold(vtkIdType idx, vtkIdType& column, vtkIdType& component);
00074 
00076   void ClearColumnsToThreshold();
00077 
00079   vtkIdTypeArray* GetSelectedRowIds(int selection=0);
00080 
00081   //BTX
00082   enum OutputPorts
00083   {
00084     OUTPUT_ROW_IDS=0,
00085     OUTPUT_ROW_DATA
00086   };
00087   enum LinearThresholdType
00088   {
00089     BLT_ABOVE=0,
00090     BLT_BELOW,
00091     BLT_NEAR,
00092     BLT_BETWEEN
00093   };
00094   //ETX
00095   
00097   void Initialize();
00098 
00100   void AddLineEquation(double* p1, double* p2);
00101 
00103   void AddLineEquation(double* p, double slope);
00104 
00106   void AddLineEquation(double a, double b, double c);
00107 
00109   void ClearLineEquations();
00110 
00112 
00116   vtkGetMacro(LinearThresholdType,int);
00117   vtkSetMacro(LinearThresholdType,int);
00118   void SetLinearThresholdTypeToAbove() { this->SetLinearThresholdType(vtkBivariateLinearTableThreshold::BLT_ABOVE); }
00119   void SetLinearThresholdTypeToBelow() { this->SetLinearThresholdType(vtkBivariateLinearTableThreshold::BLT_BELOW); }
00120   void SetLinearThresholdTypeToNear() { this->SetLinearThresholdType(vtkBivariateLinearTableThreshold::BLT_NEAR); }
00121   void SetLinearThresholdTypeToBetween() { this->SetLinearThresholdType(vtkBivariateLinearTableThreshold::BLT_BETWEEN); }
00123 
00125 
00128   vtkSetVector2Macro(ColumnRanges,double);
00129   vtkGetVector2Macro(ColumnRanges,double);
00131 
00133 
00135   vtkSetMacro(DistanceThreshold,double);
00136   vtkGetMacro(DistanceThreshold,double);
00138 
00140 
00146   vtkSetMacro(UseNormalizedDistance,int);
00147   vtkGetMacro(UseNormalizedDistance,int);
00148   vtkBooleanMacro(UseNormalizedDistance,int);
00150 
00152   static void ComputeImplicitLineFunction(double* p1, double* p2, double* abc);
00153 
00155   static void ComputeImplicitLineFunction(double* p, double slope, double* abc);
00156   
00157 protected:
00158   vtkBivariateLinearTableThreshold();
00159   virtual ~vtkBivariateLinearTableThreshold();
00160 
00161   double ColumnRanges[2];
00162   double DistanceThreshold;
00163   int Inclusive;
00164   int LinearThresholdType;
00165   int NumberOfLineEquations;
00166   int UseNormalizedDistance;
00167 
00168   //BTX
00169   vtkSmartPointer<vtkDoubleArray> LineEquations;
00170   class Internals;
00171   Internals* Implementation;
00172   //ETX
00173 
00174   virtual int RequestData(
00175     vtkInformation*,
00176     vtkInformationVector**,
00177     vtkInformationVector*);
00178 
00179   virtual int FillInputPortInformation( int port, vtkInformation* info );
00180   virtual int FillOutputPortInformation( int port, vtkInformation* info );
00181 
00184   virtual int ApplyThreshold(vtkTable* tableToThreshold, vtkIdTypeArray* acceptedIds);
00185 
00187   int ThresholdAbove(double x, double y);
00188 
00190   int ThresholdBelow(double x, double y);
00191 
00193   int ThresholdNear(double x, double y);
00194 
00196 
00197   int ThresholdBetween(double x, double y);
00198 private:
00199   vtkBivariateLinearTableThreshold(const vtkBivariateLinearTableThreshold&); // Not implemented
00200   void operator=(const vtkBivariateLinearTableThreshold&); // Not implemented
00201 };
00203 
00204 #endif