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         short xDim, yDim, zDim;
00030         int xyDim;
00031         int size;
00032         short *data;
00033         gradient_t *gradients;
00034         bool CalcDensityHistogram();
00035         int histogram[4096];
00036         bool precalc;
00037         bool CalcGradients();
00038 public:
00039         Data() { xDim = 0;
00040                         yDim = 0;
00041                         zDim = 0;
00042                         xyDim = 0;
00043                         size = 0;
00044                         data = NULL;
00045                         gradients = NULL;
00046                         precalc = false;
00047                         m_FileThreshold = 40;
00048                         m_DataPackets = MB_TO_DATASET_THRES(10);
00049         };
00050 
00051         ~Data() { if(data!= NULL)delete data; if(gradients != NULL)delete gradients;};
00052         bool SetPreCalc(bool pc) { precalc = pc; return true;}
00053         void SetFileThreshold(int dFileThreshold) { m_FileThreshold = dFileThreshold; };
00054         void SetDataPackets(int dDataPack) { m_DataPackets = MB_TO_DATASET_THRES(dDataPack); };
00055         short GetXDim();
00056         short GetYDim();
00057         short GetZDim();
00058         int GetHistogram(int density);
00059         int GetDensity(int x, int y, int z);
00060         void LoadData(char* fname);
00061         gradient_t CalcGrad(int x, int y, int z);
00062         
00063 
00064         string filename;
00065 };
00066 
00067 #endif
00068 
00069 

Generated on Thu Jan 30 21:35:43 2003 for 3DVis by doxygen1.3-rc2