00001 #ifndef CVOLUMESTATISTICS_H
00002 #define CVOLUMESTATISTICS_H
00003
00004
00005
00006
00007
00008 #include "Volume.h"
00009 #include "Math/TVector3.h"
00010
00011 #include "Definitions.h"
00012 #include "Memory/IManagedObject.h"
00013 #include "Memory/mmgr.h"
00014
00015
00016
00017
00018
00019 #define NORMALIZE_NONE 0
00020 #define NORMALIZE_LINEAR 1
00021 #define NORMALIZE_LOG 2
00022
00023 class CVolumeFormat;
00024
00025 struct SHistogramData
00026 {
00027 float * data;
00028 int nmbBuckets;
00029 float minBucket;
00030 float maxBucket;
00031 char normalizeMethod;
00032
00033 SHistogramData()
00034 {
00035 data = NULL;
00036 minBucket = FLT_MAX;
00037 maxBucket = 0;
00038 nmbBuckets = -1;
00039 normalizeMethod = NORMALIZE_NONE;
00040 }
00041
00042 ~SHistogramData()
00043 {
00044 SAFE_DELETE_ARRAY(data);
00045 }
00046 };
00047
00048
00049
00050
00051 class CVolumeStatistics : public IManagedObject
00052 {
00053
00054 private:
00055
00056
00057
00058 unsigned int minVolumeDataV;
00059 unsigned int maxVolumeDataV;
00060
00061
00062 SHistogramData originalH;
00063 SHistogramData originalGradH;
00064
00065
00066 SHistogramData quantizedH;
00067 SHistogramData quantizedGradH;
00068
00069
00070 SHistogramData normQuantizedH;
00071 SHistogramData normQuantizedGradH;
00072
00073
00074 static CVector3f scale;
00075
00076
00077 float (* GradientPtr)(int,int,int,int,int,int,int);
00078
00079
00080 public:
00081
00082
00083 CVolumeStatistics(CVolumeFormat & pFormat);
00084 ~CVolumeStatistics();
00085
00086 SHistogramData & GetHistogram(int quantisation,char normalizeMethod);
00087 SHistogramData & GetGradHistogram(int quantisation, char normalizeMethod);
00088
00089 unsigned int GetMaxValue(){return maxVolumeDataV;}
00090 unsigned int GetMinValue(){return minVolumeDataV;}
00091
00092
00093 private:
00094
00095
00096 void Hist(CVolumeFormat * const pFormat);
00097 bool ACCHist(CVolumeFormat * const pFormat);
00098 void SetMinMaxBucket(SHistogramData &);
00099 void Normalize(SHistogramData & quantizedH, SHistogramData & normQuantizedH, char normalizeMethod);
00100
00101 static float Gradient(int,int,int,int,int,int,int);
00102 static float GradientLI(int,int,int,int,int,int,int);
00103 };
00104
00105 #endif //CVOLUMESTATISTICS_H