Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

CDensities.h

00001 #ifndef  __CDENSITIES_H__ 
00002 #define  __CDENSITIES_H__ 
00003 
00004 #include <windows.h>
00005 
00011 class CDensities 
00012 {
00013 public:
00014     CDensities()
00015     {
00016         _dimX = 0;
00017         _dimY = 0;
00018         _pDensities = 0;
00019     }
00020 
00021     ~CDensities()
00022     {
00023         Shutdown();
00024     }
00025 
00030     void Init( unsigned short dimX, unsigned short dimY)
00031     {
00032         _dimX = dimX;
00033         _dimY = dimY;
00034         _size = _dimX * _dimY;
00035  
00036         if ( _pDensities && dimX )
00037         {
00038             delete[] _pDensities;
00039 
00040             _pDensities = 0;
00041         }
00042 
00043                 if ( !_pDensities )
00044                 {
00045              _pDensities = new unsigned short [_size];
00046              if ( !_pDensities || !_size )
00047                 throw;
00048 
00049             for ( int i = 0; i < _size; i++ )
00050             {   
00051                             _pDensities[i] = 0;
00052             }
00053         }
00054     
00055     }
00056 
00062     void Shutdown()
00063     {
00064         
00065         if ( _pDensities )
00066              delete[] _pDensities;
00067 
00068         _pDensities = 0;
00069         _dimX = 0;
00070         _dimY = 0;
00071         _size = 0;
00072     }
00073 
00077     BOOL IsValid()  { return ( _pDensities ) ? TRUE: FALSE; }
00078 
00082         unsigned short GetDimX()            { return _dimX; }
00083         unsigned short GetDimY()            { return _dimY; }
00084     unsigned short * GetDensitiesPtr()    { return _pDensities; }
00085 
00086     void InitDensities_XY_plain_by_Slice(int iSliceNum);
00087     void InitDensities_XZ_plain_by_Slice(int iSliceNum);
00088     void InitDensities_YZ_plain_by_Slice(int iSliceNum);
00089 
00093     unsigned short GetMaxValue();
00094 
00095 private:
00096     unsigned short      _dimX, _dimY;   // dimension of densities array
00097     unsigned short  *   _pDensities;    // pointer to 2D plane of densities, generated from 3D data
00098         unsigned long           _size;
00099 };
00100 
00101 #endif /* __CDENSITIES_H__ */

Generated on Mon Dec 12 15:20:26 2005 for CCube by  doxygen 1.4.1