00001 #ifndef _VOLSET_H_ 00002 #define _VOLSET_H_ 00003 00004 #include "vuTFunc/vuTFIntensity.h" 00005 #include "vuCamera.h" 00006 #include "Volume.h" 00007 00009 #define ITERATE_VOLS(f) do { int c;\ 00010 for( c=0; c<m_NVolumes; c++) \ 00011 if(m_Volumes[c]) m_Volumes[c]->f; \ 00012 }while(0); 00013 00017 class VolumeSet 00018 { 00019 public: 00022 VolumeSet(int nvolumes = 0); 00024 ~VolumeSet(); 00025 00029 void createVolumes(int nvolumes = 0, bool initFilter=false); 00030 00032 void clearSlice(void) 00033 { 00034 ITERATE_VOLS(clearSlice()); 00035 } 00036 00038 void computeSlice(dword x_stop, dword y_stop, dword x_pass, dword y_pass) 00039 { 00040 ITERATE_VOLS(computeSlice(x_stop, y_stop, x_pass, y_pass)); 00041 } 00042 00044 Volume* operator[](dword index) 00045 { 00046 if((long)index < m_NVolumes) 00047 return m_Volumes[index]; 00048 else 00049 return NULL; 00050 } 00051 00053 const Volume* operator[](dword index) const 00054 { 00055 if((long)index < m_NVolumes) 00056 return m_Volumes[index]; 00057 else 00058 return NULL; 00059 } 00060 00062 void rotateSliceX(float alpha) { 00063 ITERATE_VOLS(rotateSliceX(alpha)); 00064 } 00066 void rotateSliceY(float alpha) { 00067 ITERATE_VOLS(rotateSliceY(alpha)); 00068 } 00070 void rotateSliceZ(float alpha) { 00071 ITERATE_VOLS(rotateSliceZ(alpha)); 00072 } 00074 void setCamera(const vuCamera& cam) { 00075 ITERATE_VOLS(setCamera(cam)); 00076 } 00078 void setSliceScale(float scale) { 00079 ITERATE_VOLS(setSliceScale(scale)); 00080 } 00082 void setSliceBias(float bias) { 00083 ITERATE_VOLS(setSliceBias(bias)); 00084 } 00085 00087 bool setFilter(int num); 00088 00091 bool setFilter(SpecFVRNS::Filter* filter); 00092 00094 bool read(char* in, float s = 1.0, 00095 float m_pad = 1.0f, dword a_pad = 0); 00096 00101 void buildColourVolumes(byte *data, 00102 dword xsize, dword ysize, dword zsize, 00103 dword dsize, const vuTFIntensity &tfunc, 00104 float osamp=1.0f, float m_pad=1.0f, 00105 dword a_pad=0); 00106 00108 bool write_fvr(char* fn); 00109 00110 protected: 00112 void destroyData(bool destroyFilter=false); 00113 00114 public: 00115 int m_NVolumes; 00116 SpecFVRNS::Filter *m_Filter; 00117 Volume **m_Volumes; 00118 bool m_Recomp; 00119 }; 00120 00121 #endif