00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00026
00027 #ifndef __VPVOLUME_H
00028 #define __VPVOLUME_H
00029
00030
00031 #include <vpimage.h>
00032 #include <vpslice.h>
00033 #include <vptable.h>
00034 #include <vpraycasting.h>
00035
00036
00037
00038 #ifndef __GL_STUFF
00039 #define __GL_STUFF
00040 #include <FL/Fl_Gl_Window.h>
00041 #include <FL/gl.h>
00042 #include <GL/glu.h>
00043 #endif // __GL_STUFF
00044
00045
00046
00047 #define NONE 1001
00048 #define ARQCT 1002
00049 #define ARQMRI 1003
00050 #define ARQPET 1004
00051 #define ARQSPECT 1005
00052
00053
00054
00055 #define LINEAROPAC 100
00056 #define TABLEOPAC 101
00057 #define GRADIENTOPAC 102
00058
00059
00060
00061 #define LOCALSHADING 200
00062 #define GOURAUDSHADING 201
00063 #define PHONGSHADING 202
00064
00065
00066
00067 #define red 0
00068 #define green 1
00069 #define blue 2
00070
00071
00072
00073 #define C_VR_MAGIC_NUMBER_OLD 192837465
00074 #define C_VR_MAGIC_NUMBER 192837466
00075 #define C_MANUFACTURER_STRING_LENGTH 20
00076 #define C_ORIG_FILENAME_STRING_LENGTH 128
00077 #define C_UNSIGNED_BYTE 1001
00078 #define C_UNSIGNED_SHORT 1002
00079 #define C_INTENSITY8 2001
00080 #define C_INTENSITY16 2002
00081 #define C_INDEX4_INTENSITY12 2003
00082 #define C_INDEX8_INTENSITY8 2004
00083
00084 typedef struct {
00085 int x;
00086 int y;
00087 int z;
00088 }xyz;
00089 typedef unsigned short int sword;
00090
00091
00092
00093 typedef struct {
00094 unsigned char x;
00095 unsigned char y;
00096 unsigned char z;
00097 }xyzc;
00098
00099
00100
00101
00102
00103
00104
00106
00107
00108
00110
00111 class VPVolume : public VPImage{
00112
00113 private:
00114 int visualizationType;
00115 int opacityComputation;
00116 int fileType;
00117 int zDimension;
00118 int fileBits;
00119 int topSlice;
00120 int sideSlice;
00121 int frontSlice;
00122 unsigned int **grayImage;
00123
00124 unsigned int ***colorImage;
00125
00126 unsigned int maxVolumeColor;
00127 unsigned int minVolumeColor;
00128 unsigned int ***volumeMatrix;
00129 unsigned int ***volumeMatrix2;
00130 unsigned char ***volumeLightedMatrix;
00131 VPPoint3D scale;
00132 VPPoint3D centerFocalPoint;
00133 VPTable controlTables;
00134 VPCamera *activeCamera;
00135 VPRayCasting rayCasting;
00136 VPSlice slice;
00137 bool allocMemory();
00138 bool allocMemory2();
00139 VPPoint3D cameraLocationForInnerStructure;
00140 public:
00141 VPVolume();
00142 VPVolume (const char *n, int t, int dh, int dv, int s, int b);
00143 ~VPVolume();
00144 void vpReadRawFile(const char *n);
00145 void vpReadIFile(const char *n, char *p);
00146 void vpReadVolFile(const char *n);
00147 float vpGetLightValue(int i, int j, int k);
00148 unsigned int vpGetValue(int i, int j, int k);
00149 inline int vpGetZDimension() { return zDimension; }
00150 void vpRender();
00151 void vpAllocateGrayImage(int h, int w);
00152 void vpAllocateColorImage(int h, int w);
00153 void vpProcessLightedVolume(VPVector3D ld, float al);
00154 VPVector3D vpGetSobelGradient(int i, int j, int k);
00155 VPVector3D vpGetLinearGradientEstimation(int i, int j, int k);
00156 VPVector3D vpGetCentralDifferenceGradient(int i, int j, int k);
00157 void vpSetSliceTopCamera();
00158 void vpSetSliceFrontCamera();
00159 void vpSetSliceSideCamera();
00160 void vpDisplayGray();
00161 void vpDisplayColor();
00162 void vpRotate();
00163 void vpTranslate(VPPoint3D t);
00164 void vpScale(VPPoint3D s);
00165 void vpSetVisualizationType(int vp);
00166 int vpGetVisualizationType();
00167 void vpSetTopSlice(int v);
00168 int vpGetTopSlice();
00169 void vpSetSideSlice(int v);
00170 int vpGetSideSlice();
00171 void vpSetFrontSlice(int v);
00172 int vpGetFrontSlice();
00173 void vpSetActiveCamera(VPCamera *c);
00174 void vpSetRayCastingSBand(VPPoint3D sb, int vt);
00175 int vpGetRayCastingSBand();
00176 void vpSetRayCastingTBand(VPPoint3D tb, int vt);
00177 int vpGetRayCastingTBand();
00178 void vpSetRayCastingSampleStep(float s);
00179 float vpGetRayCastingSampleStep();
00180 void vpSetRayCastingAmbientLight(float a);
00181 float vpGetRayCastingAmbientLight();
00182 void vpSetRayCastingDiffuseLight(float d);
00183 float vpGetRayCastingDiffuseLight();
00184 void vpSetRayCastingSpecularExponent(int s);
00185 int vpGetRayCastingSpecularExponent();
00186 void vpSetRayCastingSpecular(bool s);
00187 bool vpGetRayCastingSpecular();
00188 void vpSetRayCastingShadingMethod(int sm);
00189 int vpGetRayCastingShadingMethod();
00190 void vpSetRayCastingTypeOfCuttingTool(int t);
00191 int vpGetRayCastingTypeOfCuttingTool();
00192 void vpSetOpacityComputation(int oc);
00193 int vpGetOpacityComputation();
00194 void vpSetOpacityTable(float t[]);
00195 float * vpGetOpacityTable();
00196 void vpSetColorTable(VPColor c[]);
00197 VPColor * vpGetColorTable();
00198 void vpSetControlPoints (int cp[], int n);
00199 void vpGetControlPoints(int cp[], int &n);
00200 void vpSetControlPoints (int cp[], VPColor c[], int n);
00201 void vpGetControlPoints(int cp[], VPColor c[],int &n);
00202 void vpProcessHistogram();
00203 void vpProcessCenterFocalPoint();
00204 VPPoint3D vpGetCenterFocalPoint();
00205 unsigned int vpGetMinVolumeColor();
00206 unsigned int vpGetMaxVolumeColor();
00207 VPTable vpGetControlTables();
00208 GLvoid vpSwapBytes(GLint *intPtr, int sizeBytes);
00209 void vpAdjustScale(int x, int y, int z);
00210 VPPoint3D vpGetScale();
00211 VPPoint2D vpGetSliceViewSBandPoint();
00212 VPPoint2D vpGetSliceViewTBandPoint();
00213 int vpGetFileType();
00214 void vpSetCameraLocationForInnerStructure(VPPoint3D c);
00215 VPPoint3D vpGetCameraLocationForInnerStructure();
00216 };
00217
00218
00219
00220 #endif // __VPVOLUME_H