Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Widgets/vtkKWHistogram.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWHistogram.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00019 #ifndef __vtkKWHistogram_h
00020 #define __vtkKWHistogram_h
00021 
00022 #include "vtkObject.h"
00023 #include "vtkKWWidgets.h" // Needed for export symbols directives
00024 
00025 class vtkColorTransferFunction;
00026 class vtkDataArray;
00027 class vtkImageData;
00028 class vtkDoubleArray;
00029 
00030 class KWWIDGETS_EXPORT vtkKWHistogram : public vtkObject
00031 {
00032 public:
00033   static vtkKWHistogram* New();
00034   vtkTypeRevisionMacro(vtkKWHistogram,vtkObject);
00035   void PrintSelf(ostream& os, vtkIndent indent);
00036 
00038 
00041   vtkGetVector2Macro(Range, double);
00043 
00045 
00046   vtkGetObjectMacro(Bins, vtkDoubleArray);
00048 
00050   virtual vtkIdType GetNumberOfBins();
00051 
00053 
00055   vtkSetMacro(MaximumNumberOfBins, vtkIdType);
00056   vtkGetMacro(MaximumNumberOfBins, vtkIdType);
00058 
00060 
00061   virtual double GetMinimumOccurence();
00062   virtual double GetMaximumOccurence();
00063   virtual double GetTotalOccurence();
00065 
00067   virtual double GetOccurenceAtValue(double value);
00068 
00070 
00073   virtual double GetValueAtAccumulatedOccurence(
00074     double acc, double *exclude_value = 0);
00076 
00079   virtual void BuildHistogram(vtkDataArray *scalars, int component);
00080 
00082 
00090   vtkSetVector2Macro(Range, double);
00092 
00094 
00096   virtual void EstimateHistogramRange(
00097     vtkDataArray *scalars, int component, double range[2]);
00099 
00112   virtual void AccumulateHistogram(vtkDataArray *scalars, int component);
00113 
00117   virtual void EmptyHistogram();
00118 
00120 
00121   virtual void SetLogMode(int);
00122   vtkBooleanMacro(LogMode, int);
00123   vtkGetMacro(LogMode, int);
00125 
00126 protected:
00127   vtkKWHistogram();
00128   ~vtkKWHistogram();
00129 
00130   double Range[2];
00131 
00132   vtkDoubleArray *Bins;
00133 
00134   vtkImageData *Image;
00135   unsigned long LastImageBuildTime;
00136   unsigned long LastTransferFunctionTime;
00137   int           LogMode;
00138   vtkIdType     MaximumNumberOfBins;
00139 
00140   virtual void ComputeStatistics();
00141   unsigned long LastStatisticsBuildTime;
00142 
00143   double MinimumOccurence;
00144   double MaximumOccurence;
00145   double TotalOccurence;
00146 
00148 
00150   virtual void UpdateHistogram(
00151     vtkDataArray *scalars, int component, int reset_range);
00153 
00155 
00157   virtual void EstimateHistogramRangeAndNumberOfBins(
00158     vtkDataArray *scalars, int component, 
00159     double range[2], vtkIdType *nb_of_bins);
00161 
00162 public:
00164 
00169   class KWWIDGETS_EXPORT ImageDescriptor
00170   {
00171   public:
00172     ImageDescriptor();
00174 
00175     int  IsValid() const;
00176     int  IsEqualTo(const ImageDescriptor *desc);
00177     void Copy(const ImageDescriptor *desc);
00178 
00179     int          DrawBackground;
00180     int          DrawGrid;
00181     int          GridSize;
00182 
00183     enum
00184     {
00185       StyleBars = 0,
00186       StyleDots
00187     };
00188     int          Style;
00189 
00190     double       Range[2];
00191     void SetRange(double range0, double range1);
00192     void SetRange(double range[2]);
00193 
00194     unsigned int Width;
00195     unsigned int Height;
00196     void SetDimensions(unsigned int width, unsigned int height);
00197 
00198     double       Color[3];
00199     void SetColor(double color[3]);
00200 
00201     double       BackgroundColor[3];
00202     void SetBackgroundColor(double color[3]);
00203 
00204     double       OutOfRangeColor[3];
00205     void SetOutOfRangeColor(double color[3]);
00206 
00207     double       GridColor[3];
00208     void SetGridColor(double color[3]);
00209 
00210     vtkColorTransferFunction *ColorTransferFunction;
00211 
00212     // When the histogram is drawn, a resampled version of the histogram
00213     // is computed where each column-pixel along the Width is a bin.
00214     // The histogram itself is scaled vertically so that the bin with
00215     // the maximum occurence occupies the full Height.
00216     // Each time it occurs, the LastMaximumOccurence ivar is modified
00217     // to store this maximum occurence.
00218     // If the DefaultMaximumOccurence is set to something other than 0.0
00219     // it will override the maximum occurence found so far and be used
00220     // to scale the histogram vertically (of course, it has to be >=
00221     // to the current maximum occurence).
00222     // Using DefaultMaximumOccurence is right now the way to have two
00223     // histograms being scaled the same way, under some constraints.
00224 
00225     double       DefaultMaximumOccurence;
00226     double       LastMaximumOccurence;
00227   };
00228   // @endcond
00229   virtual int IsImageUpToDate(const ImageDescriptor *desc = 0);
00230   virtual vtkImageData* GetImage(ImageDescriptor *desc);
00231   //ETX
00232   
00233 protected:
00234   //BTX
00235   vtkKWHistogram::ImageDescriptor *LastImageDescriptor;
00236   //ETX
00237 
00238 private:
00239   vtkKWHistogram(const vtkKWHistogram&); // Not implemented
00240   void operator=(const vtkKWHistogram&); // Not implemented
00241 };
00242 
00243 #endif
00244 

Generated on Tue May 30 12:31:43 2006 for ParaView by doxygen 1.3.5