VTK
dox/Infovis/vtkExtractHistogram2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExtractHistogram2D.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 2011 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 -------------------------------------------------------------------------*/
00047 #ifndef __vtkExtractHistogram2D_h
00048 #define __vtkExtractHistogram2D_h
00049 
00050 #include "vtkStatisticsAlgorithm.h"
00051 
00052 class vtkImageData;
00053 class vtkIdTypeArray;
00054 class vtkMultiBlockDataSet;
00055 
00056 class VTK_INFOVIS_EXPORT vtkExtractHistogram2D : public vtkStatisticsAlgorithm
00057 {
00058 public:
00059   static vtkExtractHistogram2D* New();
00060   vtkTypeMacro(vtkExtractHistogram2D, vtkStatisticsAlgorithm);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00063 //BTX
00064   enum OutputIndices
00065   {
00066     HISTOGRAM_IMAGE=3
00067   };
00068 //ETX
00069 
00071 
00072   vtkSetVector2Macro(NumberOfBins,int);
00073   vtkGetVector2Macro(NumberOfBins,int);
00075 
00077 
00079   vtkSetVector2Macro(ComponentsToProcess,int);
00080   vtkGetVector2Macro(ComponentsToProcess,int);
00082 
00084 
00087   vtkSetVector4Macro(CustomHistogramExtents,double);
00088   vtkGetVector4Macro(CustomHistogramExtents,double);
00090 
00092 
00094   vtkSetMacro(UseCustomHistogramExtents,int);
00095   vtkGetMacro(UseCustomHistogramExtents,int);
00096   vtkBooleanMacro(UseCustomHistogramExtents,int);
00098 
00100 
00103   vtkSetMacro(ScalarType,int);
00104   void SetScalarTypeToUnsignedInt()
00105     {this->SetScalarType(VTK_UNSIGNED_INT);};
00106   void SetScalarTypeToUnsignedLong()
00107     {this->SetScalarType(VTK_UNSIGNED_LONG);};
00108   void SetScalarTypeToUnsignedShort()
00109     {this->SetScalarType(VTK_UNSIGNED_SHORT);};
00110   void SetScalarTypeToUnsignedChar()
00111     {this->SetScalarType(VTK_UNSIGNED_CHAR);};
00112   void SetScalarTypeToFloat()
00113     {this->SetScalarType(VTK_FLOAT);};
00114   void SetScalarTypeToDouble()
00115     {this->SetScalarType(VTK_DOUBLE);};
00116   vtkGetMacro(ScalarType,int);
00118   
00120 
00122   vtkGetMacro(MaximumBinCount,double);
00124 
00127   int GetBinRange(vtkIdType binX, vtkIdType binY, double range[4]);
00128 
00131   int GetBinRange(vtkIdType bin, double range[4]);
00132 
00135   void GetBinWidth(double bw[2]);
00136 
00139   vtkImageData* GetOutputHistogramImage();
00140 
00143   double* GetHistogramExtents();
00144 
00145   vtkSetMacro(SwapColumns,int);
00146   vtkGetMacro(SwapColumns,int);
00147   vtkBooleanMacro(SwapColumns,int);
00148 
00150 
00151   virtual void SetRowMask(vtkDataArray*);
00152   vtkGetObjectMacro(RowMask,vtkDataArray);
00154 
00156   virtual void Aggregate( vtkDataObjectCollection*, vtkMultiBlockDataSet* ) {};
00157 
00158 protected:
00159   vtkExtractHistogram2D();
00160   ~vtkExtractHistogram2D();
00161 
00162   int SwapColumns;
00163   int NumberOfBins[2];
00164   double HistogramExtents[4];
00165   double CustomHistogramExtents[4];
00166   int UseCustomHistogramExtents;
00167   int ComponentsToProcess[2];
00168   double MaximumBinCount;
00169   int ScalarType;
00170   vtkDataArray* RowMask;
00171 
00172   virtual int ComputeBinExtents(vtkDataArray* col1, vtkDataArray* col2);
00173 
00175 
00177   virtual void Learn( vtkTable* inData,
00178                       vtkTable* inParameters,
00179                       vtkMultiBlockDataSet* inMeta );
00181 
00183   virtual void Derive( vtkMultiBlockDataSet* ) {};
00184 
00186 
00187   virtual void Test( vtkTable*,
00188                      vtkMultiBlockDataSet*,
00189                      vtkTable* ) { return; }; 
00191 
00193 
00194   virtual void Assess( vtkTable*,
00195                        vtkMultiBlockDataSet*,
00196                        vtkTable* ) { return; }; 
00198 
00200 
00201   virtual void SelectAssessFunctor( vtkTable* vtkNotUsed(outData), 
00202                                     vtkDataObject* vtkNotUsed(inMeta),
00203                                     vtkStringArray* vtkNotUsed(rowNames),
00204                                     AssessFunctor*& vtkNotUsed(dfunc) ) {};
00206 
00207   virtual int FillOutputPortInformation( int port, vtkInformation* info );
00208 
00210 
00212   virtual int RequestInformation (vtkInformation *request, 
00213                                   vtkInformationVector **inputVector, 
00214                                   vtkInformationVector *outputVector);
00216 
00218 
00219   int GetInputArrays(vtkDataArray*& col1, vtkDataArray*& col2);
00220 private:
00221   vtkExtractHistogram2D(const vtkExtractHistogram2D&); // Not implemented
00222   void operator=(const vtkExtractHistogram2D&);   // Not implemented
00223 };
00225 
00226 #endif