00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00022 #ifndef __vtkKWHistogram_h
00023 #define __vtkKWHistogram_h
00024
00025 #include "vtkObject.h"
00026 #include "vtkKWWidgets.h"
00027
00028 class vtkColorTransferFunction;
00029 class vtkDataArray;
00030 class vtkImageData;
00031 class vtkDoubleArray;
00032 class vtkIntArray;
00033
00034 class KWWidgets_EXPORT vtkKWHistogram : public vtkObject
00035 {
00036
00037 public:
00038 static vtkKWHistogram* New();
00039 vtkTypeRevisionMacro(vtkKWHistogram,vtkObject);
00040 void PrintSelf(ostream& os, vtkIndent indent);
00041
00043
00046 vtkGetVector2Macro(Range, double);
00048
00050
00051 vtkGetObjectMacro(Bins, vtkDoubleArray);
00053
00055 virtual vtkIdType GetNumberOfBins();
00056
00058
00060 vtkSetMacro(MaximumNumberOfBins, vtkIdType);
00061 vtkGetMacro(MaximumNumberOfBins, vtkIdType);
00063
00065
00066 virtual double GetMinimumOccurence();
00067 virtual double GetMaximumOccurence();
00068 virtual double GetTotalOccurence();
00070
00072 virtual double GetOccurenceAtValue(double value);
00073
00075
00078 virtual double GetValueAtAccumulatedOccurence(
00079 double acc, double *exclude_value = 0);
00081
00084 virtual void BuildHistogram(vtkDataArray *scalars, int component);
00085
00087
00095 vtkSetVector2Macro(Range, double);
00097
00099
00101 virtual void EstimateHistogramRange(
00102 vtkDataArray *scalars, int component, double range[2]);
00104
00117 virtual void AccumulateHistogram(vtkDataArray *scalars, int component);
00118
00122 virtual void EmptyHistogram();
00123
00125
00126 virtual void SetLogMode(int);
00127 vtkBooleanMacro(LogMode, int);
00128 vtkGetMacro(LogMode, int);
00130
00131
00132
00133 protected:
00134 vtkKWHistogram();
00135 ~vtkKWHistogram();
00136
00137 double Range[2];
00138
00139 vtkDoubleArray *Bins;
00140
00141 vtkImageData *Image;
00142 vtkIntArray *ImageCoordinates;
00143
00144 unsigned long LastImageBuildTime;
00145 unsigned long LastTransferFunctionTime;
00146 int LogMode;
00147 vtkIdType MaximumNumberOfBins;
00148
00149 virtual void ComputeStatistics();
00150 unsigned long LastStatisticsBuildTime;
00151
00152 double MinimumOccurence;
00153 double MaximumOccurence;
00154 double TotalOccurence;
00155
00157
00159 virtual void UpdateHistogram(
00160 vtkDataArray *scalars, int component, int reset_range);
00162
00164
00166 virtual void EstimateHistogramRangeAndNumberOfBins(
00167 vtkDataArray *scalars, int component,
00168 double range[2], vtkIdType *nb_of_bins);
00170
00171
00172
00173 public:
00175
00180 class KWWidgets_EXPORT ImageDescriptor
00181 {
00182 public:
00183 ImageDescriptor();
00185
00186 int IsValid() const;
00187 int IsEqualTo(const ImageDescriptor *desc);
00188 void Copy(const ImageDescriptor *desc);
00189
00190 int DrawForeground;
00191 int DrawBackground;
00192 int DrawGrid;
00193 int GridSize;
00194
00195 enum
00196 {
00197 StyleBars = 0,
00198 StyleDots
00199 };
00200 int Style;
00201
00202 double Range[2];
00203 void SetRange(double range0, double range1);
00204 void SetRange(double range[2]);
00205
00206 unsigned int Width;
00207 unsigned int Height;
00208 void SetDimensions(unsigned int width, unsigned int height);
00209
00210 double Color[3];
00211 void SetColor(double color[3]);
00212
00213 double BackgroundColor[3];
00214 void SetBackgroundColor(double color[3]);
00215
00216 double OutOfRangeColor[3];
00217 void SetOutOfRangeColor(double color[3]);
00218
00219 double GridColor[3];
00220 void SetGridColor(double color[3]);
00221
00222 vtkColorTransferFunction *ColorTransferFunction;
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237 double DefaultMaximumOccurence;
00238 double LastMaximumOccurence;
00239 };
00240
00241 virtual int IsImageUpToDate(const ImageDescriptor *desc = 0);
00242 virtual vtkImageData* GetImage(ImageDescriptor *desc);
00243 virtual vtkIntArray* GetImageCoordinates(ImageDescriptor *desc);
00244
00245
00246
00247
00248 protected:
00249
00250 vtkKWHistogram::ImageDescriptor *LastImageDescriptor;
00251
00252
00253 virtual int RefreshImage(ImageDescriptor *desc);
00254
00255
00256
00257 private:
00258 vtkKWHistogram(const vtkKWHistogram&);
00259 void operator=(const vtkKWHistogram&);
00260 };
00261
00262 #endif
00263
00264