00001 #ifndef _VOLUME_H_
00002 #define _VOLUME_H_
00003
00004 #include <fstream.h>
00005 #include "vuTFunc/vuTFIntensity.h"
00006 #include "vuSimpleTypes.h"
00007 #include "vuCamera.h"
00008 #include "vuVector.h"
00009 #include "Filter.h"
00010
00011 #define NCOMP 7
00012
00013 class VolumeSet;
00014
00015
00016
00017 class Volume
00018 {
00019 friend class VolumeSet;
00020 public:
00021
00022
00023 Volume();
00024 Volume(Volume& inst);
00025 ~Volume();
00026
00027
00028 Volume& operator=(Volume& rhs);
00029
00031 bool convert(byte* data, dword XSize, dword YSize, dword ZSize,
00032 dword d_size, const vuTFIntensity &tfunc, dword component,
00033 float osamp=1.0f, float m_pad=1.0f, dword a_pad=0);
00034
00035
00036 void writeImage(void);
00037
00038
00039 void setFilter(SpecFVRNS::Filter* filter);
00040
00041
00042
00043 void setSliceScale(float scale);
00044 void setSliceBias(float bias);
00045
00046
00047
00048
00049 void rotateSliceX(float alpha);
00050 void rotateSliceY(float alpha);
00051 void rotateSliceZ(float alpha);
00052 void setViewMatrix(const vuMatrix& mat);
00053 void setCamera(const vuCamera& cam);
00054 void getCamera(vuCamera& cam) const;
00055
00056
00057
00058
00059 void clearSlice(void);
00060 void computeSlice(void);
00061 void computeSlice(dword x_stop, dword y_stop, dword x_pass, dword y_pass);
00062 float* getSliceData(void);
00063
00064
00065
00066
00067 dword getSliceWidth(void) const;
00068 dword getSliceHeight(void) const;
00069
00070 dword getInternalSliceWidth(void) const;
00071 dword getInternalSliceHeight(void) const;
00072
00073
00074 void setOversampling(float s);
00075
00076 protected:
00077
00078
00079 void setWrap(dword wrap);
00080
00081
00082
00083 void wrapVolume(void);
00084
00085
00086
00087 void interpolateSlice(void);
00088 void interpolateSlice(dword x_stop, dword y_stop, dword x_pass, dword y_pass);
00089
00090
00091
00092 void scaleAndBias(void);
00093
00094 inline int Volume::vcoord(int x, int y, int z) const
00095 {
00096 return ((z * m_YSize + y) * m_XSize + x) * 2;
00097 }
00098
00099 inline int Volume::scoord(int x, int y) const
00100 {
00101 return (y * m_SliceXSize + x) * 2;
00102 }
00103
00104 void preprocess(void);
00105 void write_fvr(char* out) const;
00106 bool read_fvr(ifstream& fin, dword XSize, dword YSize, dword ZSize, dword d_size);
00107 protected:
00108
00109 float* m_Volume;
00110 dword m_XSize;
00111 dword m_YSize;
00112 dword m_ZSize;
00113 dword m_Wrap;
00114
00115
00116 SpecFVRNS::Filter* m_Filter;
00117
00118
00119 float* m_Slice;
00120
00121 vuVector m_XStep;
00122 vuVector m_YStep;
00123 dword m_SliceXSize;
00124 dword m_SliceYSize;
00125 vuVector m_XAxis;
00126 vuVector m_YAxis;
00127 vuVector m_ZAxis;
00128 vuVector m_Origin;
00129
00130
00131 float* m_Image;
00132 dword m_ImageXSize;
00133 dword m_ImageYSize;
00134 dword m_ImageStep;
00135 float* m_SlicePtr;
00136 float m_Scale;
00137 float m_Bias;
00138
00139 int m_CurImage;
00140
00141 dword m_InnerXSize;
00142 dword m_InnerYSize;
00143
00144 #ifndef FVR_NO_SLICE_COPY
00145 float* m_SSlice;
00146 #endif
00147 };
00148
00149 #endif
00150
00151