Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

data.h

Go to the documentation of this file.
00001 #ifndef DATA_H 
00002 #define DATA_H
00003 
00004 
00005 #include <stdio.h>
00006 #include <string>
00007 using std::string;
00008 
00009 
00010 #define MB_TO_DATASET_THRES(x) ((x) << 19)
00011 #define DATASET_TO_MB(x) ((x) >> 19)
00012 
00013 
00014 struct gradient_t {
00015         float x,y,z;
00016 };
00017 
00018 gradient_t operator * (gradient_t g, float s);
00019 gradient_t operator + (gradient_t g1, gradient_t g2);
00020 
00021 // data class
00022 class Data {
00023 private:
00024         //the filesize in MB when there will be a parted fread
00025         int m_FileThreshold;
00026         //the size in MB of the packets read with fread
00027         int m_DataPackets;
00028 
00029         bool m_bAbort;
00030 
00031 
00032         short xDim, yDim, zDim;
00033         int xyDim;
00034         int size;
00035         short *data;
00036         gradient_t *gradients;
00037         bool CalcDensityHistogram();
00038         int histogram[4096];
00039         bool precalc;
00040         bool CalcGradients();
00041 public:
00042         Data() { xDim = 0;
00043                         yDim = 0;
00044                         zDim = 0;
00045                         xyDim = 0;
00046                         size = 0;
00047                         data = NULL;
00048                         gradients = NULL;
00049                         precalc = false;
00050                         m_FileThreshold = 40;
00051                         m_DataPackets = MB_TO_DATASET_THRES(10);
00052                         m_bAbort = false;
00053         };
00054 
00055         ~Data() { if(data!= NULL)delete data; if(gradients != NULL)delete gradients;};
00056         bool SetPreCalc(bool pc) { precalc = pc; return true;}
00057         void SetFileThreshold(int dFileThreshold) { m_FileThreshold = dFileThreshold; };
00058         void SetDataPackets(int dDataPack) { m_DataPackets = MB_TO_DATASET_THRES(dDataPack); };
00059         short GetXDim();
00060         short GetYDim();
00061         short GetZDim();
00062         int GetHistogram(int density);
00063         int GetDensity(int x, int y, int z);
00064         void LoadData(char* fname);
00065         gradient_t CalcGrad(int x, int y, int z);
00066         
00067 
00068         string filename;
00069 
00070         void SetAbort(void) { m_bAbort = true; };
00071 };
00072 
00073 #endif
00074 
00075 

Generated on Thu Jan 23 12:32:15 2003 by doxygen1.3-rc2