00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00019 #ifndef __vtkKWHistogram_h
00020 #define __vtkKWHistogram_h
00021
00022 #include "vtkObject.h"
00023 #include "vtkKWWidgets.h"
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
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 double DefaultMaximumOccurence;
00226 double LastMaximumOccurence;
00227 };
00228
00229 virtual int IsImageUpToDate(const ImageDescriptor *desc = 0);
00230 virtual vtkImageData* GetImage(ImageDescriptor *desc);
00231
00232
00233 protected:
00234
00235 vtkKWHistogram::ImageDescriptor *LastImageDescriptor;
00236
00237
00238 private:
00239 vtkKWHistogram(const vtkKWHistogram&);
00240 void operator=(const vtkKWHistogram&);
00241 };
00242
00243 #endif
00244