00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00025 #ifndef __vtkFixedPointVolumeRayCastHelper_h
00026 #define __vtkFixedPointVolumeRayCastHelper_h
00027
00028
00029 #define VTKKWRCHelper_GetCellScalarValues( DATA, SCALE, SHIFT ) \
00030 A = static_cast<unsigned int >(SCALE*(*(DATA ) + SHIFT)); \
00031 B = static_cast<unsigned int >(SCALE*(*(DATA+Binc) + SHIFT)); \
00032 C = static_cast<unsigned int >(SCALE*(*(DATA+Cinc) + SHIFT)); \
00033 D = static_cast<unsigned int >(SCALE*(*(DATA+Dinc) + SHIFT)); \
00034 E = static_cast<unsigned int >(SCALE*(*(DATA+Einc) + SHIFT)); \
00035 F = static_cast<unsigned int >(SCALE*(*(DATA+Finc) + SHIFT)); \
00036 G = static_cast<unsigned int >(SCALE*(*(DATA+Ginc) + SHIFT)); \
00037 H = static_cast<unsigned int >(SCALE*(*(DATA+Hinc) + SHIFT))
00038
00039
00040
00041 #define VTKKWRCHelper_GetCellScalarValuesSimple( DATA ) \
00042 A = static_cast<unsigned int >(*(DATA )); \
00043 B = static_cast<unsigned int >(*(DATA+Binc)); \
00044 C = static_cast<unsigned int >(*(DATA+Cinc)); \
00045 D = static_cast<unsigned int >(*(DATA+Dinc)); \
00046 E = static_cast<unsigned int >(*(DATA+Einc)); \
00047 F = static_cast<unsigned int >(*(DATA+Finc)); \
00048 G = static_cast<unsigned int >(*(DATA+Ginc)); \
00049 H = static_cast<unsigned int >(*(DATA+Hinc))
00050
00051
00052
00053 #define VTKKWRCHelper_GetCellMagnitudeValues( ABCD, EFGH ) \
00054 mA = static_cast<unsigned int >(*(ABCD )); \
00055 mB = static_cast<unsigned int >(*(ABCD+mBFinc)); \
00056 mC = static_cast<unsigned int >(*(ABCD+mCGinc)); \
00057 mD = static_cast<unsigned int >(*(ABCD+mDHinc)); \
00058 mE = static_cast<unsigned int >(*(EFGH )); \
00059 mF = static_cast<unsigned int >(*(EFGH+mBFinc)); \
00060 mG = static_cast<unsigned int >(*(EFGH+mCGinc)); \
00061 mH = static_cast<unsigned int >(*(EFGH+mDHinc))
00062
00063
00064
00065 #define VTKKWRCHelper_GetCellDirectionValues( ABCD, EFGH ) \
00066 normalA = static_cast<unsigned int >(*(ABCD )); \
00067 normalB = static_cast<unsigned int >(*(ABCD+dBFinc)); \
00068 normalC = static_cast<unsigned int >(*(ABCD+dCGinc)); \
00069 normalD = static_cast<unsigned int >(*(ABCD+dDHinc)); \
00070 normalE = static_cast<unsigned int >(*(EFGH )); \
00071 normalF = static_cast<unsigned int >(*(EFGH+dBFinc)); \
00072 normalG = static_cast<unsigned int >(*(EFGH+dCGinc)); \
00073 normalH = static_cast<unsigned int >(*(EFGH+dDHinc));
00074
00075
00076
00077 #define VTKKWRCHelper_GetCellComponentScalarValues( DATA, CIDX, SCALE, SHIFT ) \
00078 A[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA ) + SHIFT)); \
00079 B[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Binc) + SHIFT)); \
00080 C[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Cinc) + SHIFT)); \
00081 D[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Dinc) + SHIFT)); \
00082 E[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Einc) + SHIFT)); \
00083 F[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Finc) + SHIFT)); \
00084 G[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Ginc) + SHIFT)); \
00085 H[CIDX] = static_cast<unsigned int >(SCALE*(*(DATA+Hinc) + SHIFT))
00086
00087
00088
00089 #define VTKKWRCHelper_GetCellComponentRawScalarValues( DATA, CIDX ) \
00090 A[CIDX] = static_cast<unsigned int >((*(DATA ))); \
00091 B[CIDX] = static_cast<unsigned int >((*(DATA+Binc))); \
00092 C[CIDX] = static_cast<unsigned int >((*(DATA+Cinc))); \
00093 D[CIDX] = static_cast<unsigned int >((*(DATA+Dinc))); \
00094 E[CIDX] = static_cast<unsigned int >((*(DATA+Einc))); \
00095 F[CIDX] = static_cast<unsigned int >((*(DATA+Finc))); \
00096 G[CIDX] = static_cast<unsigned int >((*(DATA+Ginc))); \
00097 H[CIDX] = static_cast<unsigned int >((*(DATA+Hinc)))
00098
00099
00100
00101 #define VTKKWRCHelper_GetCellComponentMagnitudeValues( ABCD, EFGH, CIDX ) \
00102 mA[CIDX] = static_cast<unsigned int >(*(ABCD )); \
00103 mB[CIDX] = static_cast<unsigned int >(*(ABCD+mBFinc)); \
00104 mC[CIDX] = static_cast<unsigned int >(*(ABCD+mCGinc)); \
00105 mD[CIDX] = static_cast<unsigned int >(*(ABCD+mDHinc)); \
00106 mE[CIDX] = static_cast<unsigned int >(*(EFGH )); \
00107 mF[CIDX] = static_cast<unsigned int >(*(EFGH+mBFinc)); \
00108 mG[CIDX] = static_cast<unsigned int >(*(EFGH+mCGinc)); \
00109 mH[CIDX] = static_cast<unsigned int >(*(EFGH+mDHinc))
00110
00111
00112
00113 #define VTKKWRCHelper_GetCellComponentDirectionValues( ABCD, EFGH, CIDX ) \
00114 normalA[CIDX] = static_cast<unsigned int >(*(ABCD )); \
00115 normalB[CIDX] = static_cast<unsigned int >(*(ABCD+dBFinc)); \
00116 normalC[CIDX] = static_cast<unsigned int >(*(ABCD+dCGinc)); \
00117 normalD[CIDX] = static_cast<unsigned int >(*(ABCD+dDHinc)); \
00118 normalE[CIDX] = static_cast<unsigned int >(*(EFGH )); \
00119 normalF[CIDX] = static_cast<unsigned int >(*(EFGH+dBFinc)); \
00120 normalG[CIDX] = static_cast<unsigned int >(*(EFGH+dCGinc)); \
00121 normalH[CIDX] = static_cast<unsigned int >(*(EFGH+dDHinc));
00122
00123
00124
00125
00126 #define VTKKWRCHelper_ComputeWeights( POS ) \
00127 w2X = (POS[0]&VTKKW_FP_MASK); \
00128 w2Y = (POS[1]&VTKKW_FP_MASK); \
00129 w2Z = (POS[2]&VTKKW_FP_MASK); \
00130 \
00131 w1X = ((~w2X)&VTKKW_FP_MASK); \
00132 w1Y = ((~w2Y)&VTKKW_FP_MASK); \
00133 w1Z = ((~w2Z)&VTKKW_FP_MASK); \
00134 \
00135 w1Xw1Y = (0x4000+(w1X*w1Y))>>VTKKW_FP_SHIFT; \
00136 w2Xw1Y = (0x4000+(w2X*w1Y))>>VTKKW_FP_SHIFT; \
00137 w1Xw2Y = (0x4000+(w1X*w2Y))>>VTKKW_FP_SHIFT; \
00138 w2Xw2Y = (0x4000+(w2X*w2Y))>>VTKKW_FP_SHIFT; \
00139 //ETX
00140
00141
00142
00143 #define VTKKWRCHelper_InterpolateScalar( VAL ) \
00144 VAL = \
00145 (0x7fff + ((A*((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00146 (B*((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00147 (C*((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00148 (D*((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00149 (E*((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00150 (F*((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00151 (G*((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00152 (H*((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT;
00153
00154
00155
00156 #define VTKKWRCHelper_InterpolateMagnitude( VAL ) \
00157 VAL = \
00158 (0x7fff + ((mA*((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00159 (mB*((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00160 (mC*((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00161 (mD*((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00162 (mE*((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00163 (mF*((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00164 (mG*((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00165 (mH*((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT;
00166
00167
00168
00169 #define VTKKWRCHelper_InterpolateScalarComponent( VAL, CIDX, COMPONENTS ) \
00170 for ( CIDX = 0; CIDX < COMPONENTS; CIDX++ ) \
00171 { \
00172 VAL[CIDX] = \
00173 (0x7fff + ((A[CIDX]*((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00174 (B[CIDX]*((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00175 (C[CIDX]*((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00176 (D[CIDX]*((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00177 (E[CIDX]*((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00178 (F[CIDX]*((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00179 (G[CIDX]*((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00180 (H[CIDX]*((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00181 } \
00182 //ETX
00183
00184
00185 #define VTKKWRCHelper_InterpolateMagnitudeComponent( VAL, CIDX, COMPONENTS ) \
00186 for ( CIDX = 0; CIDX < COMPONENTS; CIDX++ ) \
00187 { \
00188 VAL[CIDX] = \
00189 (0x7fff + ((mA[CIDX]*((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00190 (mB[CIDX]*((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00191 (mC[CIDX]*((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00192 (mD[CIDX]*((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00193 (mE[CIDX]*((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00194 (mF[CIDX]*((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00195 (mG[CIDX]*((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00196 (mH[CIDX]*((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00197 }
00198
00199
00200
00201 #define VTKKWRCHelper_InterpolateShading( DTABLE, STABLE, COLOR ) \
00202 unsigned int _tmpDColor[3]; \
00203 unsigned int _tmpSColor[3]; \
00204 \
00205 _tmpDColor[0] = \
00206 (0x7fff + ((DTABLE[3*normalA] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00207 (DTABLE[3*normalB] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00208 (DTABLE[3*normalC] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00209 (DTABLE[3*normalD] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00210 (DTABLE[3*normalE] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00211 (DTABLE[3*normalF] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00212 (DTABLE[3*normalG] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00213 (DTABLE[3*normalH] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00214 \
00215 _tmpDColor[1] = \
00216 (0x7fff + ((DTABLE[3*normalA+1] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00217 (DTABLE[3*normalB+1] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00218 (DTABLE[3*normalC+1] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00219 (DTABLE[3*normalD+1] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00220 (DTABLE[3*normalE+1] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00221 (DTABLE[3*normalF+1] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00222 (DTABLE[3*normalG+1] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00223 (DTABLE[3*normalH+1] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00224 \
00225 _tmpDColor[2] = \
00226 (0x7fff + ((DTABLE[3*normalA+2] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00227 (DTABLE[3*normalB+2] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00228 (DTABLE[3*normalC+2] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00229 (DTABLE[3*normalD+2] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00230 (DTABLE[3*normalE+2] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00231 (DTABLE[3*normalF+2] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00232 (DTABLE[3*normalG+2] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00233 (DTABLE[3*normalH+2] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00234 \
00235 _tmpSColor[0] = \
00236 (0x7fff + ((STABLE[3*normalA] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00237 (STABLE[3*normalB] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00238 (STABLE[3*normalC] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00239 (STABLE[3*normalD] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00240 (STABLE[3*normalE] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00241 (STABLE[3*normalF] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00242 (STABLE[3*normalG] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00243 (STABLE[3*normalH] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00244 \
00245 _tmpSColor[1] = \
00246 (0x7fff + ((STABLE[3*normalA+1] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00247 (STABLE[3*normalB+1] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00248 (STABLE[3*normalC+1] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00249 (STABLE[3*normalD+1] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00250 (STABLE[3*normalE+1] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00251 (STABLE[3*normalF+1] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00252 (STABLE[3*normalG+1] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00253 (STABLE[3*normalH+1] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00254 \
00255 _tmpSColor[2] = \
00256 (0x7fff + ((STABLE[3*normalA+2] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00257 (STABLE[3*normalB+2] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00258 (STABLE[3*normalC+2] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00259 (STABLE[3*normalD+2] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00260 (STABLE[3*normalE+2] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00261 (STABLE[3*normalF+2] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00262 (STABLE[3*normalG+2] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00263 (STABLE[3*normalH+2] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00264 \
00265 \
00266 COLOR[0] = static_cast<unsigned short>((_tmpDColor[0]*COLOR[0]+0x7fff)>>VTKKW_FP_SHIFT); \
00267 COLOR[1] = static_cast<unsigned short>((_tmpDColor[1]*COLOR[1]+0x7fff)>>VTKKW_FP_SHIFT); \
00268 COLOR[2] = static_cast<unsigned short>((_tmpDColor[2]*COLOR[2]+0x7fff)>>VTKKW_FP_SHIFT); \
00269 COLOR[0] += (_tmpSColor[0]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00270 COLOR[1] += (_tmpSColor[1]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00271 COLOR[2] += (_tmpSColor[2]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT;
00272
00273
00274
00275
00276 #define VTKKWRCHelper_InterpolateShadingComponent( DTABLE, STABLE, COLOR, CIDX ) \
00277 unsigned int _tmpDColor[3]; \
00278 unsigned int _tmpSColor[3]; \
00279 \
00280 _tmpDColor[0] = \
00281 (0x7fff + ((DTABLE[CIDX][3*normalA[CIDX]] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00282 (DTABLE[CIDX][3*normalB[CIDX]] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00283 (DTABLE[CIDX][3*normalC[CIDX]] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00284 (DTABLE[CIDX][3*normalD[CIDX]] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00285 (DTABLE[CIDX][3*normalE[CIDX]] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00286 (DTABLE[CIDX][3*normalF[CIDX]] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00287 (DTABLE[CIDX][3*normalG[CIDX]] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00288 (DTABLE[CIDX][3*normalH[CIDX]] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00289 \
00290 _tmpDColor[1] = \
00291 (0x7fff + ((DTABLE[CIDX][3*normalA[CIDX]+1] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00292 (DTABLE[CIDX][3*normalB[CIDX]+1] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00293 (DTABLE[CIDX][3*normalC[CIDX]+1] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00294 (DTABLE[CIDX][3*normalD[CIDX]+1] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00295 (DTABLE[CIDX][3*normalE[CIDX]+1] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00296 (DTABLE[CIDX][3*normalF[CIDX]+1] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00297 (DTABLE[CIDX][3*normalG[CIDX]+1] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00298 (DTABLE[CIDX][3*normalH[CIDX]+1] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00299 \
00300 _tmpDColor[2] = \
00301 (0x7fff + ((DTABLE[CIDX][3*normalA[CIDX]+2] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00302 (DTABLE[CIDX][3*normalB[CIDX]+2] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00303 (DTABLE[CIDX][3*normalC[CIDX]+2] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00304 (DTABLE[CIDX][3*normalD[CIDX]+2] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00305 (DTABLE[CIDX][3*normalE[CIDX]+2] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00306 (DTABLE[CIDX][3*normalF[CIDX]+2] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00307 (DTABLE[CIDX][3*normalG[CIDX]+2] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00308 (DTABLE[CIDX][3*normalH[CIDX]+2] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00309 \
00310 _tmpSColor[0] = \
00311 (0x7fff + ((STABLE[CIDX][3*normalA[CIDX]] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00312 (STABLE[CIDX][3*normalB[CIDX]] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00313 (STABLE[CIDX][3*normalC[CIDX]] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00314 (STABLE[CIDX][3*normalD[CIDX]] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00315 (STABLE[CIDX][3*normalE[CIDX]] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00316 (STABLE[CIDX][3*normalF[CIDX]] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00317 (STABLE[CIDX][3*normalG[CIDX]] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00318 (STABLE[CIDX][3*normalH[CIDX]] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00319 \
00320 _tmpSColor[1] = \
00321 (0x7fff + ((STABLE[CIDX][3*normalA[CIDX]+1] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00322 (STABLE[CIDX][3*normalB[CIDX]+1] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00323 (STABLE[CIDX][3*normalC[CIDX]+1] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00324 (STABLE[CIDX][3*normalD[CIDX]+1] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00325 (STABLE[CIDX][3*normalE[CIDX]+1] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00326 (STABLE[CIDX][3*normalF[CIDX]+1] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00327 (STABLE[CIDX][3*normalG[CIDX]+1] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00328 (STABLE[CIDX][3*normalH[CIDX]+1] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00329 \
00330 _tmpSColor[2] = \
00331 (0x7fff + ((STABLE[CIDX][3*normalA[CIDX]+2] * ((0x4000 + w1Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00332 (STABLE[CIDX][3*normalB[CIDX]+2] * ((0x4000 + w2Xw1Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00333 (STABLE[CIDX][3*normalC[CIDX]+2] * ((0x4000 + w1Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00334 (STABLE[CIDX][3*normalD[CIDX]+2] * ((0x4000 + w2Xw2Y*w1Z)>>VTKKW_FP_SHIFT)) + \
00335 (STABLE[CIDX][3*normalE[CIDX]+2] * ((0x4000 + w1Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00336 (STABLE[CIDX][3*normalF[CIDX]+2] * ((0x4000 + w2Xw1Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00337 (STABLE[CIDX][3*normalG[CIDX]+2] * ((0x4000 + w1Xw2Y*w2Z)>>VTKKW_FP_SHIFT)) + \
00338 (STABLE[CIDX][3*normalH[CIDX]+2] * ((0x4000 + w2Xw2Y*w2Z)>>VTKKW_FP_SHIFT)))) >> VTKKW_FP_SHIFT; \
00339 \
00340 \
00341 COLOR[0] = static_cast<unsigned short>((_tmpDColor[0]*COLOR[0]+0x7fff)>>VTKKW_FP_SHIFT); \
00342 COLOR[1] = static_cast<unsigned short>((_tmpDColor[1]*COLOR[1]+0x7fff)>>VTKKW_FP_SHIFT); \
00343 COLOR[2] = static_cast<unsigned short>((_tmpDColor[2]*COLOR[2]+0x7fff)>>VTKKW_FP_SHIFT); \
00344 COLOR[0] += (_tmpSColor[0]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00345 COLOR[1] += (_tmpSColor[1]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00346 COLOR[2] += (_tmpSColor[2]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT;
00347
00348
00349
00350 #define VTKKWRCHelper_LookupColorUS( COLORTABLE, SCALAROPACITYTABLE, IDX, COLOR ) \
00351 COLOR[3] = SCALAROPACITYTABLE[IDX]; \
00352 if ( !COLOR[3] ) {continue;} \
00353 COLOR[0] = static_cast<unsigned short> \
00354 ((COLORTABLE[3*IDX ]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00355 COLOR[1] = static_cast<unsigned short> \
00356 ((COLORTABLE[3*IDX+1]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00357 COLOR[2] = static_cast<unsigned short> \
00358 ((COLORTABLE[3*IDX+2]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT));
00359
00360
00361
00362 #define VTKKWRCHelper_LookupColorMax( COLORTABLE, SCALAROPACITYTABLE, IDX, COLOR ) \
00363 COLOR[3] = SCALAROPACITYTABLE[IDX]; \
00364 COLOR[0] = static_cast<unsigned short> \
00365 ((COLORTABLE[3*IDX ]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00366 COLOR[1] = static_cast<unsigned short> \
00367 ((COLORTABLE[3*IDX+1]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00368 COLOR[2] = static_cast<unsigned short> \
00369 ((COLORTABLE[3*IDX+2]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT));
00370
00371
00372
00373 #define VTKKWRCHelper_LookupDependentColorUS( COLORTABLE, SCALAROPACITYTABLE, IDX, CMPS, COLOR ) \
00374 { \
00375 unsigned short _alpha; \
00376 switch ( CMPS ) \
00377 { \
00378 case 2: \
00379 _alpha = SCALAROPACITYTABLE[IDX[1]]; \
00380 COLOR[0] = static_cast<unsigned short> \
00381 ((COLORTABLE[3*IDX[0] ]*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00382 COLOR[1] = static_cast<unsigned short> \
00383 ((COLORTABLE[3*IDX[0]+1]*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00384 COLOR[2] = static_cast<unsigned short> \
00385 ((COLORTABLE[3*IDX[0]+2]*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00386 COLOR[3] = _alpha; \
00387 break; \
00388 case 4: \
00389 _alpha = SCALAROPACITYTABLE[IDX[3]]; \
00390 COLOR[0] = static_cast<unsigned short>((IDX[0]*_alpha + 0x7f)>>8 ); \
00391 COLOR[1] = static_cast<unsigned short>((IDX[1]*_alpha + 0x7f)>>8 ); \
00392 COLOR[2] = static_cast<unsigned short>((IDX[2]*_alpha + 0x7f)>>8 ); \
00393 COLOR[3] = _alpha; \
00394 break; \
00395 } \
00396 }
00397
00398
00399
00400 #define VTKKWRCHelper_LookupColorGOUS( CTABLE, SOTABLE, GOTABLE, IDX, IDX2, COLOR ) \
00401 COLOR[3] = (SOTABLE[IDX] * GOTABLE[IDX2] + 0x7fff)>>VTKKW_FP_SHIFT; \
00402 if ( !COLOR[3] ) {continue;} \
00403 COLOR[0] = static_cast<unsigned short> \
00404 ((CTABLE[3*IDX ]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00405 COLOR[1] = static_cast<unsigned short> \
00406 ((CTABLE[3*IDX+1]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00407 COLOR[2] = static_cast<unsigned short> \
00408 ((CTABLE[3*IDX+2]*COLOR[3] + 0x7fff)>>(VTKKW_FP_SHIFT));
00409
00410
00411
00412 #define VTKKWRCHelper_LookupShading( DTABLE, STABLE, NORMAL, COLOR ) \
00413 COLOR[0] = static_cast<unsigned short>((DTABLE[3*NORMAL ]*COLOR[0]+0x7fff)>>VTKKW_FP_SHIFT); \
00414 COLOR[1] = static_cast<unsigned short>((DTABLE[3*NORMAL+1]*COLOR[1]+0x7fff)>>VTKKW_FP_SHIFT); \
00415 COLOR[2] = static_cast<unsigned short>((DTABLE[3*NORMAL+2]*COLOR[2]+0x7fff)>>VTKKW_FP_SHIFT); \
00416 COLOR[0] += (STABLE[3*NORMAL ]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00417 COLOR[1] += (STABLE[3*NORMAL+1]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT; \
00418 COLOR[2] += (STABLE[3*NORMAL+2]*COLOR[3] + 0x7fff)>>VTKKW_FP_SHIFT;
00419
00420
00421
00422
00423 #define VTKKWRCHelper_LookupAndCombineIndependentColorsUS( COLORTABLE, SOTABLE, \
00424 SCALAR, WEIGHTS, \
00425 COMPONENTS, COLOR ) \
00426 unsigned int _tmp[4] = {0,0,0,0}; \
00427 unsigned short _alpha[4] = {0,0,0,0}; \
00428 unsigned int _totalAlpha = 0; \
00429 \
00430 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00431 { \
00432 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00433 _totalAlpha += _alpha[_idx]; \
00434 }} \
00435 \
00436 if ( !_totalAlpha ) {continue;} \
00437 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00438 { \
00439 if ( _alpha[_idx] ) \
00440 { \
00441 _tmp[0] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00442 _tmp[1] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00443 _tmp[2] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00444 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00445 } \
00446 }} \
00447 if ( !_tmp[3] ) {continue;} \
00448 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00449 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00450 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00451 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00452
00453
00454
00455 #define VTKKWRCHelper_LookupAndCombineIndependentColorsMax( COLORTABLE, SCALAROPACITYTABLE, \
00456 IDX, WEIGHTS, CMPS, COLOR ) \
00457 { \
00458 unsigned int _tmp[4] = {0,0,0,0}; \
00459 for ( int _idx = 0; _idx < CMPS; _idx++ ) \
00460 { \
00461 unsigned short _alpha = static_cast<unsigned short>(SCALAROPACITYTABLE[_idx][IDX[_idx]]*WEIGHTS[_idx]); \
00462 _tmp[0] += static_cast<unsigned short>(((COLORTABLE[_idx][3*IDX[_idx] ])*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00463 _tmp[1] += static_cast<unsigned short>(((COLORTABLE[_idx][3*IDX[_idx]+1])*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00464 _tmp[2] += static_cast<unsigned short>(((COLORTABLE[_idx][3*IDX[_idx]+2])*_alpha + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00465 _tmp[3] += _alpha; \
00466 } \
00467 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00468 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00469 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00470 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]); \
00471 }
00472
00473
00474
00475 #define VTKKWRCHelper_LookupAndCombineIndependentColorsGOUS( COLORTABLE, SOTABLE, \
00476 GOTABLE, \
00477 SCALAR, MAG, WEIGHTS, \
00478 COMPONENTS, COLOR ) \
00479 unsigned int _tmp[4] = {0,0,0,0}; \
00480 unsigned short _alpha[4] = {0,0,0,0}; \
00481 unsigned int _totalAlpha = 0; \
00482 \
00483 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00484 { \
00485 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00486 if ( _alpha[_idx] ) \
00487 { \
00488 _alpha[_idx] = static_cast<unsigned short>((_alpha[_idx]*GOTABLE[_idx][MAG[_idx]] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00489 _totalAlpha += _alpha[_idx]; \
00490 } \
00491 }} \
00492 \
00493 if ( !_totalAlpha ) {continue;} \
00494 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00495 { \
00496 if ( _alpha[_idx] ) \
00497 { \
00498 _tmp[0] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00499 _tmp[1] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00500 _tmp[2] += static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00501 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00502 } \
00503 }} \
00504 if ( !_tmp[3] ) {continue;}; \
00505 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00506 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00507 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00508 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00509
00510
00511
00512 #define VTKKWRCHelper_LookupAndCombineIndependentColorsShadeUS( COLORTABLE, SOTABLE, \
00513 DTABLE, STABLE, \
00514 SCALAR, NORMAL, WEIGHTS, \
00515 COMPONENTS, COLOR ) \
00516 unsigned int _tmp[4] = {0,0,0,0}; \
00517 unsigned int _tmpC[3]; \
00518 unsigned short _alpha[4] = {0,0,0,0}; \
00519 unsigned int _totalAlpha = 0; \
00520 \
00521 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00522 { \
00523 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00524 _totalAlpha += _alpha[_idx]; \
00525 }} \
00526 \
00527 if ( !_totalAlpha ) {continue;} \
00528 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00529 { \
00530 if ( _alpha[_idx] ) \
00531 { \
00532 _tmpC[0] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00533 _tmpC[1] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00534 _tmpC[2] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00535 _tmpC[0] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx] ]*_tmpC[0]+0x7fff)>>VTKKW_FP_SHIFT); \
00536 _tmpC[1] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx]+1]*_tmpC[1]+0x7fff)>>VTKKW_FP_SHIFT); \
00537 _tmpC[2] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx]+2]*_tmpC[2]+0x7fff)>>VTKKW_FP_SHIFT); \
00538 _tmpC[0] += (STABLE[_idx][3*NORMAL[_idx] ]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00539 _tmpC[1] += (STABLE[_idx][3*NORMAL[_idx]+1]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00540 _tmpC[2] += (STABLE[_idx][3*NORMAL[_idx]+2]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00541 _tmp[0] += _tmpC[0]; \
00542 _tmp[1] += _tmpC[1]; \
00543 _tmp[2] += _tmpC[2]; \
00544 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00545 } \
00546 }} \
00547 if ( !_tmp[3] ) {continue;} \
00548 \
00549 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00550 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00551 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00552 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00553
00554
00555
00556 #define VTKKWRCHelper_LookupAndCombineIndependentColorsInterpolateShadeUS( COLORTABLE, SOTABLE, \
00557 DTABLE, STABLE, \
00558 SCALAR, WEIGHTS, \
00559 COMPONENTS, COLOR ) \
00560 unsigned int _tmp[4] = {0,0,0,0}; \
00561 unsigned int _tmpC[4]; \
00562 unsigned short _alpha[4] = {0,0,0,0}; \
00563 unsigned int _totalAlpha = 0; \
00564 \
00565 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00566 { \
00567 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00568 _totalAlpha += _alpha[_idx]; \
00569 }} \
00570 \
00571 if ( !_totalAlpha ) {continue;} \
00572 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00573 { \
00574 if ( _alpha[_idx] ) \
00575 { \
00576 _tmpC[0] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00577 _tmpC[1] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00578 _tmpC[2] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00579 _tmpC[3] = _alpha[_idx]; \
00580 VTKKWRCHelper_InterpolateShadingComponent( DTABLE, STABLE, _tmpC, _idx ); \
00581 _tmp[0] += _tmpC[0]; \
00582 _tmp[1] += _tmpC[1]; \
00583 _tmp[2] += _tmpC[2]; \
00584 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00585 } \
00586 }} \
00587 if (!_tmp[3]) {continue;} \
00588 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00589 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00590 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00591 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00592
00593
00594
00595 #define VTKKWRCHelper_CompositeColorAndCheckEarlyTermination( COLOR, TMP, REMAININGOPACITY ) \
00596 COLOR[0] += (TMP[0]*REMAININGOPACITY+0x7fff)>>VTKKW_FP_SHIFT; \
00597 COLOR[1] += (TMP[1]*REMAININGOPACITY+0x7fff)>>VTKKW_FP_SHIFT; \
00598 COLOR[2] += (TMP[2]*REMAININGOPACITY+0x7fff)>>VTKKW_FP_SHIFT; \
00599 REMAININGOPACITY = (REMAININGOPACITY*((~(TMP[3])&VTKKW_FP_MASK))+0x7fff)>>VTKKW_FP_SHIFT; \
00600 if ( REMAININGOPACITY < 0xff ) \
00601 { \
00602 break; \
00603 }
00604
00605
00606
00607 #define VTKKWRCHelper_LookupAndCombineIndependentColorsGOShadeUS( COLORTABLE, SOTABLE, GOTABLE, \
00608 DTABLE, STABLE, \
00609 SCALAR, MAG, NORMAL, WEIGHTS, \
00610 COMPONENTS, COLOR ) \
00611 unsigned int _tmp[4] = {0,0,0,0}; \
00612 unsigned int _tmpC[3]; \
00613 unsigned short _alpha[4] = {0,0,0,0}; \
00614 unsigned int _totalAlpha = 0; \
00615 \
00616 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00617 { \
00618 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00619 if ( _alpha[_idx] ) \
00620 { \
00621 _alpha[_idx] = static_cast<unsigned short>((_alpha[_idx]*GOTABLE[_idx][MAG[_idx]] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00622 _totalAlpha += _alpha[_idx]; \
00623 } \
00624 }} \
00625 \
00626 if ( !_totalAlpha ) {continue;} \
00627 \
00628 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00629 { \
00630 if ( _alpha[_idx] ) \
00631 { \
00632 _tmpC[0] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00633 _tmpC[1] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00634 _tmpC[2] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00635 _tmpC[0] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx] ]*_tmpC[0]+0x7fff)>>VTKKW_FP_SHIFT); \
00636 _tmpC[1] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx]+1]*_tmpC[1]+0x7fff)>>VTKKW_FP_SHIFT); \
00637 _tmpC[2] = static_cast<unsigned short>((DTABLE[_idx][3*NORMAL[_idx]+2]*_tmpC[2]+0x7fff)>>VTKKW_FP_SHIFT); \
00638 _tmpC[0] += (STABLE[_idx][3*NORMAL[_idx] ]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00639 _tmpC[1] += (STABLE[_idx][3*NORMAL[_idx]+1]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00640 _tmpC[2] += (STABLE[_idx][3*NORMAL[_idx]+2]*_alpha[_idx] + 0x7fff)>>VTKKW_FP_SHIFT; \
00641 _tmp[0] += _tmpC[0]; \
00642 _tmp[1] += _tmpC[1]; \
00643 _tmp[2] += _tmpC[2]; \
00644 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00645 } \
00646 }} \
00647 if ( !_tmp[3] ) {continue;} \
00648 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00649 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00650 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00651 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00652
00653
00654
00655 #define VTKKWRCHelper_LookupAndCombineIndependentColorsGOInterpolateShadeUS( COLORTABLE, SOTABLE, GOTABLE, \
00656 DTABLE, STABLE, \
00657 SCALAR, MAG, WEIGHTS, \
00658 COMPONENTS, COLOR ) \
00659 unsigned int _tmp[4] = {0,0,0,0}; \
00660 unsigned int _tmpC[4]; \
00661 unsigned short _alpha[4] = {0,0,0,0}; \
00662 unsigned int _totalAlpha = 0; \
00663 \
00664 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00665 { \
00666 _alpha[_idx] = static_cast<unsigned short>(SOTABLE[_idx][SCALAR[_idx]]*WEIGHTS[_idx]); \
00667 if ( _alpha[_idx] ) \
00668 { \
00669 _alpha[_idx] = static_cast<unsigned short>((_alpha[_idx]*GOTABLE[_idx][MAG[_idx]] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00670 _totalAlpha += _alpha[_idx]; \
00671 } \
00672 }} \
00673 \
00674 if ( !_totalAlpha ) {continue;} \
00675 {for ( int _idx = 0; _idx < COMPONENTS; _idx++ ) \
00676 { \
00677 if ( _alpha[_idx] ) \
00678 { \
00679 _tmpC[0] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx] ])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00680 _tmpC[1] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+1])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00681 _tmpC[2] = static_cast<unsigned short>(((COLORTABLE[_idx][3*SCALAR[_idx]+2])*_alpha[_idx] + 0x7fff)>>(VTKKW_FP_SHIFT)); \
00682 _tmpC[3] = _alpha[_idx]; \
00683 VTKKWRCHelper_InterpolateShadingComponent( DTABLE, STABLE, _tmpC, _idx ); \
00684 _tmp[0] += _tmpC[0]; \
00685 _tmp[1] += _tmpC[1]; \
00686 _tmp[2] += _tmpC[2]; \
00687 _tmp[3] += ((_alpha[_idx]*_alpha[_idx])/_totalAlpha); \
00688 } \
00689 }} \
00690 if ( !_tmp[3] ) {continue;} \
00691 COLOR[0] = (_tmp[0]>32767)?(32767):(_tmp[0]); \
00692 COLOR[1] = (_tmp[1]>32767)?(32767):(_tmp[1]); \
00693 COLOR[2] = (_tmp[2]>32767)?(32767):(_tmp[2]); \
00694 COLOR[3] = (_tmp[3]>32767)?(32767):(_tmp[3]);
00695
00696
00697
00698
00699 #define VTKKWRCHelper_SetPixelColor( IMAGEPTR, COLOR, REMAININGOPACITY ) \
00700 IMAGEPTR[0] = (COLOR[0]>32767)?(32767):(COLOR[0]); \
00701 IMAGEPTR[1] = (COLOR[1]>32767)?(32767):(COLOR[1]); \
00702 IMAGEPTR[2] = (COLOR[2]>32767)?(32767):(COLOR[2]); \
00703 unsigned int tmpAlpha = (~REMAININGOPACITY)&VTKKW_FP_MASK; \
00704 IMAGEPTR[3] = (tmpAlpha>32767)?(32767):(tmpAlpha);
00705
00706
00707
00708 #define VTKKWRCHelper_MoveToNextSampleNN() \
00709 if ( k < numSteps-1 ) \
00710 { \
00711 mapper->FixedPointIncrement( pos, dir ); \
00712 mapper->ShiftVectorDown( pos, spos ); \
00713 dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00714 }
00715
00716
00717
00718 #define VTKKWRCHelper_MoveToNextSampleGONN() \
00719 if ( k < numSteps-1 ) \
00720 { \
00721 mapper->FixedPointIncrement( pos, dir ); \
00722 mapper->ShiftVectorDown( pos, spos ); \
00723 dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00724 magPtr = gradientMag[spos[2]] + spos[0]*mInc[0] + spos[1]*mInc[1]; \
00725 }
00726
00727
00728
00729 #define VTKKWRCHelper_MoveToNextSampleShadeNN() \
00730 if ( k < numSteps-1 ) \
00731 { \
00732 mapper->FixedPointIncrement( pos, dir ); \
00733 mapper->ShiftVectorDown( pos, spos ); \
00734 dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00735 dirPtr = gradientDir[spos[2]] + spos[0]*dInc[0] + spos[1]*dInc[1]; \
00736 }
00737
00738
00739
00740 #define VTKKWRCHelper_MoveToNextSampleGOShadeNN() \
00741 if ( k < numSteps-1 ) \
00742 { \
00743 mapper->FixedPointIncrement( pos, dir ); \
00744 mapper->ShiftVectorDown( pos, spos ); \
00745 dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00746 magPtr = gradientMag[spos[2]] + spos[0]*mInc[0] + spos[1]*mInc[1]; \
00747 dirPtr = gradientDir[spos[2]] + spos[0]*dInc[0] + spos[1]*dInc[1]; \
00748 }
00749
00750
00751
00752 #define VTKKWRCHelper_InitializeVariables() \
00753 int i, j; \
00754 unsigned short *imagePtr; \
00755 \
00756 int imageInUseSize[2]; \
00757 int imageMemorySize[2]; \
00758 int imageViewportSize[2]; \
00759 int imageOrigin[2]; \
00760 int dim[3]; \
00761 float shift[4]; \
00762 float scale[4]; \
00763 \
00764 mapper->GetRayCastImage()->GetImageInUseSize(imageInUseSize); \
00765 mapper->GetRayCastImage()->GetImageMemorySize(imageMemorySize); \
00766 mapper->GetRayCastImage()->GetImageViewportSize(imageViewportSize); \
00767 mapper->GetRayCastImage()->GetImageOrigin(imageOrigin); \
00768 mapper->GetInput()->GetDimensions(dim); \
00769 mapper->GetTableShift( shift ); \
00770 mapper->GetTableScale( scale ); \
00771 \
00772 int *rowBounds = mapper->GetRowBounds(); \
00773 unsigned short *image = mapper->GetRayCastImage()->GetImage(); \
00774 vtkRenderWindow *renWin = mapper->GetRenderWindow(); \
00775 int components = mapper->GetInput()->GetNumberOfScalarComponents(); \
00776 int cropping = (mapper->GetCropping() && \
00777 mapper->GetCroppingRegionFlags() != 0x2000 ); \
00778 \
00779 unsigned short *colorTable[4]; \
00780 unsigned short *scalarOpacityTable[4]; \
00781 \
00782 int c; \
00783 for ( c = 0; c < 4; c++ ) \
00784 { \
00785 colorTable[c] = mapper->GetColorTable(c); \
00786 (void)(colorTable[c]); \
00787 scalarOpacityTable[c] = mapper->GetScalarOpacityTable(c); \
00788 } \
00789 \
00790 unsigned int inc[3]; \
00791 inc[0] = components; \
00792 inc[1] = dim[0]*components; \
00793 inc[2] = dim[0]*dim[1]*components;
00794
00795
00796
00797 #define VTKKWRCHelper_InitializeWeights() \
00798 float weights[4]; \
00799 weights[0] = vol->GetProperty()->GetComponentWeight(0); \
00800 weights[1] = vol->GetProperty()->GetComponentWeight(1); \
00801 weights[2] = vol->GetProperty()->GetComponentWeight(2); \
00802 weights[3] = vol->GetProperty()->GetComponentWeight(3);
00803
00804
00805
00806 #define VTKKWRCHelper_InitializeVariablesGO() \
00807 unsigned short *gradientOpacityTable[4]; \
00808 for ( c = 0; c < 4; c++ ) \
00809 { \
00810 gradientOpacityTable[c] = mapper->GetGradientOpacityTable(c); \
00811 } \
00812 unsigned char **gradientMag = mapper->GetGradientMagnitude(); \
00813 \
00814 unsigned int mInc[3]; \
00815 if ( vol->GetProperty()->GetIndependentComponents() ) \
00816 { \
00817 mInc[0] = inc[0]; \
00818 mInc[1] = inc[1]; \
00819 mInc[2] = inc[2]; \
00820 } \
00821 else \
00822 { \
00823 mInc[0] = 1; \
00824 mInc[1] = dim[0]; \
00825 mInc[2] = dim[0]*dim[1]; \
00826 }
00827
00828
00829
00830 #define VTKKWRCHelper_InitializeVariablesShade() \
00831 unsigned short *diffuseShadingTable[4]; \
00832 unsigned short *specularShadingTable[4]; \
00833 for ( c = 0; c < 4; c++ ) \
00834 { \
00835 diffuseShadingTable[c] = mapper->GetDiffuseShadingTable(c); \
00836 specularShadingTable[c] = mapper->GetSpecularShadingTable(c); \
00837 } \
00838 unsigned short **gradientDir = mapper->GetGradientNormal(); \
00839 unsigned int dInc[3]; \
00840 if ( vol->GetProperty()->GetIndependentComponents() ) \
00841 { \
00842 dInc[0] = inc[0]; \
00843 dInc[1] = inc[1]; \
00844 dInc[2] = inc[2]; \
00845 } \
00846 else \
00847 { \
00848 dInc[0] = 1; \
00849 dInc[1] = dim[0]; \
00850 dInc[2] = dim[0]*dim[1]; \
00851 }
00852
00853
00854
00855 #define VTKKWRCHelper_InitializeTrilinVariables() \
00856 unsigned int Binc = components; \
00857 unsigned int Cinc = dim[0]*components; \
00858 unsigned int Dinc = dim[0]*components + components; \
00859 unsigned int Einc = dim[0]*dim[1]*components; \
00860 unsigned int Finc = dim[0]*dim[1]*components + components; \
00861 unsigned int Ginc = dim[0]*dim[1]*components + dim[0]*components; \
00862 unsigned int Hinc = dim[0]*dim[1]*components + dim[0]*components + components;
00863
00864
00865
00866 #define VTKKWRCHelper_InitializeTrilinVariablesGO() \
00867 int magOffset; \
00868 if ( vol->GetProperty()->GetIndependentComponents() ) \
00869 { \
00870 magOffset = components; \
00871 } \
00872 else \
00873 { \
00874 magOffset = 1; \
00875 } \
00876 \
00877 unsigned int mBFinc = magOffset; \
00878 unsigned int mCGinc = dim[0]*magOffset; \
00879 unsigned int mDHinc = dim[0]*magOffset + magOffset;
00880
00881
00882
00883 #define VTKKWRCHelper_InitializeTrilinVariablesShade() \
00884 int dirOffset; \
00885 if ( vol->GetProperty()->GetIndependentComponents() ) \
00886 { \
00887 dirOffset = components; \
00888 } \
00889 else \
00890 { \
00891 dirOffset = 1; \
00892 } \
00893 \
00894 unsigned int dBFinc = dirOffset; \
00895 unsigned int dCGinc = dim[0]*dirOffset; \
00896 unsigned int dDHinc = dim[0]*dirOffset + dirOffset;
00897
00898
00899
00900 #define VTKKWRCHelper_OuterInitialization() \
00901 if ( j%threadCount != threadID ) \
00902 { \
00903 continue; \
00904 } \
00905 if ( !threadID ) \
00906 { \
00907 if ( renWin->CheckAbortStatus() ) \
00908 { \
00909 break; \
00910 } \
00911 } \
00912 else if ( renWin->GetAbortRender() ) \
00913 { \
00914 break; \
00915 } \
00916 imagePtr = image + 4*(j*imageMemorySize[0] + rowBounds[j*2]);
00917
00918
00919
00920
00921 #define VTKKWRCHelper_InnerInitialization() \
00922 unsigned int numSteps; \
00923 unsigned int pos[3]; \
00924 unsigned int dir[3]; \
00925 mapper->ComputeRayInfo( i, j, pos, dir, &numSteps ); \
00926 if ( numSteps == 0 ) \
00927 { \
00928 *(imagePtr ) = 0; \
00929 *(imagePtr+1) = 0; \
00930 *(imagePtr+2) = 0; \
00931 *(imagePtr+3) = 0; \
00932 imagePtr += 4; \
00933 continue; \
00934 } \
00935 unsigned int spos[3]; \
00936 unsigned int k;
00937
00938
00939
00940 #define VTKKWRCHelper_InitializeMIPOneNN() \
00941 mapper->ShiftVectorDown( pos, spos ); \
00942 T *dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00943 T maxValue = *(dptr);
00944
00945
00946
00947 #define VTKKWRCHelper_InitializeMIPMultiNN() \
00948 mapper->ShiftVectorDown( pos, spos ); \
00949 T *dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
00950 T maxValue[4]; \
00951 for ( c = 0; c < components; c++ ) \
00952 { \
00953 maxValue[c] = *(dptr+c); \
00954 }
00955
00956
00957
00958 #define VTKKWRCHelper_InitializeMIPOneTrilin() \
00959 T *dptr; \
00960 unsigned int oldSPos[3]; \
00961 \
00962 oldSPos[0] = (pos[0] >> VTKKW_FP_SHIFT) + 1; \
00963 oldSPos[1] = 0; \
00964 oldSPos[2] = 0; \
00965 \
00966 unsigned int w1X, w1Y, w1Z; \
00967 unsigned int w2X, w2Y, w2Z; \
00968 unsigned int w1Xw1Y, w2Xw1Y, w1Xw2Y, w2Xw2Y; \
00969 \
00970 unsigned short maxValue=0; \
00971 unsigned short val; \
00972 unsigned int A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;
00973
00974
00975
00976 #define VTKKWRCHelper_InitializeMIPMultiTrilin() \
00977 T *dptr; \
00978 unsigned int oldSPos[3]; \
00979 \
00980 oldSPos[0] = (pos[0] >> VTKKW_FP_SHIFT) + 1; \
00981 oldSPos[1] = 0; \
00982 oldSPos[2] = 0; \
00983 \
00984 unsigned int w1X, w1Y, w1Z; \
00985 unsigned int w2X, w2Y, w2Z; \
00986 unsigned int w1Xw1Y, w2Xw1Y, w1Xw2Y, w2Xw2Y; \
00987 \
00988 unsigned short maxValue[4]; \
00989 unsigned short val[4]; \
00990 unsigned int A[4],B[4],C[4],D[4],E[4],F[4],G[4],H[4];
00991
00992
00993
00994 #define VTKKWRCHelper_InitializeCompositeGONN() \
00995 unsigned char *magPtr = gradientMag[spos[2]] + spos[0]*mInc[0] + spos[1]*mInc[1];
00996
00997
00998
00999 #define VTKKWRCHelper_InitializeCompositeShadeNN() \
01000 unsigned short *dirPtr = gradientDir[spos[2]] + spos[0]*dInc[0] + spos[1]*dInc[1];
01001
01002
01003
01004 #define VTKKWRCHelper_InitializeCompositeOneNN() \
01005 mapper->ShiftVectorDown( pos, spos ); \
01006 T *dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
01007 unsigned int color[3] = {0,0,0}; \
01008 unsigned short remainingOpacity = 0x7fff; \
01009 unsigned short tmp[4];
01010
01011
01012
01013 #define VTKKWRCHelper_InitializeCompositeMultiNN() \
01014 mapper->ShiftVectorDown( pos, spos ); \
01015 T *dptr = data + spos[0]*inc[0] + spos[1]*inc[1] + spos[2]*inc[2]; \
01016 unsigned int color[3] = {0,0,0}; \
01017 unsigned int remainingOpacity = 0x7fff; \
01018 unsigned short tmp[4]; \
01019 unsigned short val[4];
01020
01021
01022
01023 #define VTKKWRCHelper_InitializeCompositeOneTrilin() \
01024 T *dptr; \
01025 unsigned int oldSPos[3]; \
01026 \
01027 oldSPos[0] = (pos[0] >> VTKKW_FP_SHIFT) + 1; \
01028 oldSPos[1] = 0; \
01029 oldSPos[2] = 0; \
01030 \
01031 unsigned int w1X, w1Y, w1Z; \
01032 unsigned int w2X, w2Y, w2Z; \
01033 unsigned int w1Xw1Y, w2Xw1Y, w1Xw2Y, w2Xw2Y; \
01034 \
01035 unsigned short val; \
01036 unsigned int A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0; \
01037 \
01038 unsigned int color[3] = {0,0,0}; \
01039 unsigned short remainingOpacity = 0x7fff; \
01040 unsigned short tmp[4];
01041
01042
01043
01044 #define VTKKWRCHelper_InitializeCompositeOneGOTrilin() \
01045 unsigned char *magPtrABCD = 0, *magPtrEFGH = 0; \
01046 unsigned short mag; \
01047 unsigned int mA=0,mB=0,mC=0,mD=0,mE=0,mF=0,mG=0,mH=0;
01048
01049
01050
01051 #define VTKKWRCHelper_InitializeCompositeOneShadeTrilin() \
01052 unsigned short *dirPtrABCD = 0, *dirPtrEFGH = 0; \
01053 unsigned int normalA=0,normalB=0,normalC=0,normalD=0; \
01054 unsigned int normalE=0,normalF=0,normalG=0,normalH=0;
01055
01056
01057
01058 #define VTKKWRCHelper_InitializeCompositeMultiTrilin() \
01059 T *dptr; \
01060 unsigned int oldSPos[3]; \
01061 \
01062 oldSPos[0] = (pos[0] >> VTKKW_FP_SHIFT) + 1; \
01063 oldSPos[1] = 0; \
01064 oldSPos[2] = 0; \
01065 \
01066 unsigned int w1X, w1Y, w1Z; \
01067 unsigned int w2X, w2Y, w2Z; \
01068 unsigned int w1Xw1Y, w2Xw1Y, w1Xw2Y, w2Xw2Y; \
01069 \
01070 unsigned short val[4]; \
01071 unsigned int A[4],B[4],C[4],D[4],E[4],F[4],G[4],H[4]; \
01072 \
01073 unsigned int color[3] = {0,0,0}; \
01074 unsigned short remainingOpacity = 0x7fff; \
01075 unsigned short tmp[4];
01076
01077
01078
01079 #define VTKKWRCHelper_InitializeCompositeMultiGOTrilin() \
01080 unsigned char *magPtrABCD = 0, *magPtrEFGH = 0; \
01081 unsigned short mag[4]; \
01082 unsigned int mA[4],mB[4],mC[4],mD[4],mE[4],mF[4],mG[4],mH[4];
01083
01084
01085
01086 #define VTKKWRCHelper_InitializeCompositeMultiShadeTrilin() \
01087 unsigned short *dirPtrABCD = 0, *dirPtrEFGH = 0; \
01088 unsigned int normalA[4],normalB[4],normalC[4],normalD[4]; \
01089 unsigned int normalE[4],normalF[4],normalG[4],normalH[4];
01090
01091
01092
01093 #define VTKKWRCHelper_InitializationAndLoopStartNN() \
01094 VTKKWRCHelper_InitializeVariables(); \
01095 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01096 { \
01097 VTKKWRCHelper_OuterInitialization(); \
01098 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01099 { \
01100 VTKKWRCHelper_InnerInitialization();
01101
01102
01103
01104 #define VTKKWRCHelper_InitializationAndLoopStartGONN() \
01105 VTKKWRCHelper_InitializeVariables(); \
01106 VTKKWRCHelper_InitializeVariablesGO(); \
01107 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01108 { \
01109 VTKKWRCHelper_OuterInitialization(); \
01110 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01111 { \
01112 VTKKWRCHelper_InnerInitialization();
01113
01114
01115
01116 #define VTKKWRCHelper_InitializationAndLoopStartShadeNN() \
01117 VTKKWRCHelper_InitializeVariables(); \
01118 VTKKWRCHelper_InitializeVariablesShade(); \
01119 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01120 { \
01121 VTKKWRCHelper_OuterInitialization(); \
01122 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01123 { \
01124 VTKKWRCHelper_InnerInitialization();
01125
01126
01127
01128 #define VTKKWRCHelper_InitializationAndLoopStartGOShadeNN() \
01129 VTKKWRCHelper_InitializeVariables(); \
01130 VTKKWRCHelper_InitializeVariablesGO(); \
01131 VTKKWRCHelper_InitializeVariablesShade(); \
01132 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01133 { \
01134 VTKKWRCHelper_OuterInitialization(); \
01135 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01136 { \
01137 VTKKWRCHelper_InnerInitialization();
01138
01139
01140
01141 #define VTKKWRCHelper_InitializationAndLoopStartTrilin() \
01142 VTKKWRCHelper_InitializeVariables(); \
01143 VTKKWRCHelper_InitializeTrilinVariables(); \
01144 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01145 { \
01146 VTKKWRCHelper_OuterInitialization(); \
01147 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01148 { \
01149 VTKKWRCHelper_InnerInitialization();
01150
01151
01152
01153 #define VTKKWRCHelper_InitializationAndLoopStartGOTrilin() \
01154 VTKKWRCHelper_InitializeVariables(); \
01155 VTKKWRCHelper_InitializeVariablesGO(); \
01156 VTKKWRCHelper_InitializeTrilinVariables(); \
01157 VTKKWRCHelper_InitializeTrilinVariablesGO(); \
01158 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01159 { \
01160 VTKKWRCHelper_OuterInitialization(); \
01161 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01162 { \
01163 VTKKWRCHelper_InnerInitialization();
01164
01165
01166
01167 #define VTKKWRCHelper_InitializationAndLoopStartShadeTrilin() \
01168 VTKKWRCHelper_InitializeVariables(); \
01169 VTKKWRCHelper_InitializeVariablesShade(); \
01170 VTKKWRCHelper_InitializeTrilinVariables(); \
01171 VTKKWRCHelper_InitializeTrilinVariablesShade(); \
01172 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01173 { \
01174 VTKKWRCHelper_OuterInitialization(); \
01175 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01176 { \
01177 VTKKWRCHelper_InnerInitialization();
01178
01179
01180
01181 #define VTKKWRCHelper_InitializationAndLoopStartGOShadeTrilin() \
01182 VTKKWRCHelper_InitializeVariables(); \
01183 VTKKWRCHelper_InitializeVariablesShade(); \
01184 VTKKWRCHelper_InitializeVariablesGO(); \
01185 VTKKWRCHelper_InitializeTrilinVariables(); \
01186 VTKKWRCHelper_InitializeTrilinVariablesShade(); \
01187 VTKKWRCHelper_InitializeTrilinVariablesGO(); \
01188 for ( j = 0; j < imageInUseSize[1]; j++ ) \
01189 { \
01190 VTKKWRCHelper_OuterInitialization(); \
01191 for ( i = rowBounds[j*2]; i <= rowBounds[j*2+1]; i++ ) \
01192 { \
01193 VTKKWRCHelper_InnerInitialization();
01194
01195
01196
01197 #define VTKKWRCHelper_IncrementAndLoopEnd() \
01198 imagePtr+=4; \
01199 } \
01200 if ( j%32 == 31 ) \
01201 { \
01202 double fargs[1]; \
01203 fargs[0] = static_cast<double>(j)/static_cast<float>(imageInUseSize[1]-1); \
01204 mapper->InvokeEvent( vtkCommand::VolumeMapperRenderProgressEvent, fargs ); \
01205 } \
01206 }
01207
01208
01209
01210 #define VTKKWRCHelper_CroppingCheckTrilin( POS ) \
01211 if ( cropping ) \
01212 { \
01213 if ( mapper->CheckIfCropped( POS ) ) \
01214 { \
01215 continue; \
01216 } \
01217 }
01218
01219
01220
01221 #define VTKKWRCHelper_CroppingCheckNN( POS ) \
01222 if ( cropping ) \
01223 { \
01224 if ( mapper->CheckIfCropped( POS ) ) \
01225 { \
01226 continue; \
01227 } \
01228 }
01229
01230
01231
01232 #define VTKKWRCHelper_SpaceLeapSetup() \
01233 unsigned int mmpos[3]; \
01234 mmpos[0] = (pos[0] >> VTKKW_FPMM_SHIFT) + 1; \
01235 mmpos[1] = 0; \
01236 mmpos[2] = 0; \
01237 int mmvalid = 0;
01238
01239
01240
01241 #define VTKKWRCHelper_SpaceLeapSetupMulti() \
01242 unsigned int mmpos[3]; \
01243 mmpos[0] = (pos[0] >> VTKKW_FPMM_SHIFT) + 1; \
01244 mmpos[1] = 0; \
01245 mmpos[2] = 0; \
01246 int mmvalid[4] = {0,0,0,0};
01247
01248
01249
01250
01251 #define VTKKWRCHelper_SpaceLeapCheck() \
01252 if ( pos[0] >> VTKKW_FPMM_SHIFT != mmpos[0] || \
01253 pos[1] >> VTKKW_FPMM_SHIFT != mmpos[1] || \
01254 pos[2] >> VTKKW_FPMM_SHIFT != mmpos[2] ) \
01255 { \
01256 mmpos[0] = pos[0] >> VTKKW_FPMM_SHIFT; \
01257 mmpos[1] = pos[1] >> VTKKW_FPMM_SHIFT; \
01258 mmpos[2] = pos[2] >> VTKKW_FPMM_SHIFT; \
01259 mmvalid = mapper->CheckMinMaxVolumeFlag( mmpos, 0 ); \
01260 } \
01261 \
01262 if ( !mmvalid ) \
01263 { \
01264 continue; \
01265 }
01266
01267
01268
01269 #define VTKKWRCHelper_MIPSpaceLeapCheck( MAXIDX, MAXIDXDEF, FLIP ) \
01270 if ( pos[0] >> VTKKW_FPMM_SHIFT != mmpos[0] || \
01271 pos[1] >> VTKKW_FPMM_SHIFT != mmpos[1] || \
01272 pos[2] >> VTKKW_FPMM_SHIFT != mmpos[2] ) \
01273 { \
01274 mmpos[0] = pos[0] >> VTKKW_FPMM_SHIFT; \
01275 mmpos[1] = pos[1] >> VTKKW_FPMM_SHIFT; \
01276 mmpos[2] = pos[2] >> VTKKW_FPMM_SHIFT; \
01277 mmvalid = (MAXIDXDEF)? \
01278 (mapper->CheckMIPMinMaxVolumeFlag( mmpos, 0, MAXIDX, FLIP )):(1); \
01279 } \
01280 \
01281 if ( !mmvalid ) \
01282 { \
01283 continue; \
01284 }
01285
01286
01287
01288
01289 #define VTKKWRCHelper_MIPSpaceLeapPopulateMulti( MAXIDX, FLIP ) \
01290 if ( pos[0] >> VTKKW_FPMM_SHIFT != mmpos[0] || \
01291 pos[1] >> VTKKW_FPMM_SHIFT != mmpos[1] || \
01292 pos[2] >> VTKKW_FPMM_SHIFT != mmpos[2] ) \
01293 { \
01294 mmpos[0] = pos[0] >> VTKKW_FPMM_SHIFT; \
01295 mmpos[1] = pos[1] >> VTKKW_FPMM_SHIFT; \
01296 mmpos[2] = pos[2] >> VTKKW_FPMM_SHIFT; \
01297 for ( c = 0; c < components; c++ ) \
01298 { \
01299 mmvalid[c] = mapper->CheckMIPMinMaxVolumeFlag( mmpos, c, MAXIDX[c], FLIP ); \
01300 } \
01301 }
01302
01303
01304
01305 #define VTKKWRCHelper_MIPSpaceLeapCheckMulti( COMP, FLIP ) mmvalid[COMP]
01306
01307
01308 #include "vtkObject.h"
01309
01310 class vtkFixedPointVolumeRayCastMapper;
01311 class vtkVolume;
01312
01313 class VTK_VOLUMERENDERING_EXPORT vtkFixedPointVolumeRayCastHelper : public vtkObject
01314 {
01315 public:
01316 static vtkFixedPointVolumeRayCastHelper *New();
01317 vtkTypeRevisionMacro(vtkFixedPointVolumeRayCastHelper,vtkObject);
01318 void PrintSelf( ostream& os, vtkIndent indent );
01319
01320 virtual void GenerateImage( int,
01321 int,
01322 vtkVolume *,
01323 vtkFixedPointVolumeRayCastMapper *) {}
01324
01325 protected:
01326 vtkFixedPointVolumeRayCastHelper();
01327 ~vtkFixedPointVolumeRayCastHelper();
01328
01329
01330 private:
01331 vtkFixedPointVolumeRayCastHelper(const vtkFixedPointVolumeRayCastHelper&);
01332 void operator=(const vtkFixedPointVolumeRayCastHelper&);
01333 };
01334
01335 #endif
01336
01337
01338