21 #include "vtkWindows.h"
25 #define GPU_INFO MITK_INFO("mapper.vr")
26 #define GPU_WARN MITK_WARN("mapper.vr")
28 #include "vtkCamera.h"
29 #include "vtkDataArray.h"
30 #include "vtkImageData.h"
32 #include "vtkLightCollection.h"
34 #include "vtkMatrix4x4.h"
35 #include "vtkObjectFactory.h"
36 #include "vtkOpenGLExtensionManager.h"
38 #include "vtkPlaneCollection.h"
39 #include "vtkPointData.h"
40 #include "vtkRenderWindow.h"
41 #include "vtkRenderer.h"
42 #include "vtkTimerLog.h"
43 #include "vtkTransform.h"
44 #include "vtkVolumeProperty.h"
47 #include "vtkOpenGLRenderWindow.h"
49 #define myGL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
50 #define myGL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
51 #define myGL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
56 "TEMP index, normal, finalColor;\n"
57 "TEMP temp,temp1, temp2, temp3,temp4; \n"
59 "TEMP ndotl, ndoth, ndotv; \n"
60 "TEMP lightInfo, lightResult;\n"
64 "ATTRIB tex0 = fragment.texcoord[0];\n"
67 "PARAM lightDirection = program.local[0];\n"
68 "PARAM halfwayVector = program.local[1];\n"
69 "PARAM coefficient = program.local[2];\n"
70 "PARAM lightDiffColor = program.local[3]; \n"
71 "PARAM lightSpecColor = program.local[4]; \n"
72 "PARAM viewVector = program.local[5];\n"
73 "PARAM constants = program.local[6];\n"
76 "OUTPUT out = result.color;\n"
80 "TEX temp2, tex0, texture[0], 3D;\n"
84 "MAD normal, temp2, constants.x, constants.y;\n"
86 "DP3 temp4, normal, normal;\n"
87 "RSQ temp, temp4.x;\n"
88 "MUL normal, normal, temp;\n"
96 "TEX sampleColor, tex0, texture[1], 3D;\n"
100 "DP3 ndotl, normal, lightDirection;\n"
104 "DP3 ndoth, normal, halfwayVector;\n"
106 "DP3 ndotv, normal, viewVector;\n"
109 "MUL temp3, ndotl, constants.y; \n"
110 "CMP ndotl, ndotv, ndotl, temp3;\n"
111 "MUL temp3, ndoth, constants.y; \n"
112 "CMP ndoth, ndotv, ndoth, temp3;\n"
115 "MOV lightInfo.x, ndotl.x; \n"
116 "MOV lightInfo.y, ndoth.x; \n"
117 "MOV lightInfo.w, coefficient.w; \n"
120 "LIT lightResult, lightInfo;\n"
123 "MUL lightResult, lightResult, 4.0;\n"
126 "MUL finalColor, coefficient.x, sampleColor;\n"
129 "MUL temp3, lightDiffColor, sampleColor;\n"
130 "MUL temp3, temp3, lightResult.y;\n"
131 "ADD finalColor, finalColor, temp3;\n"
134 "MUL temp3, lightSpecColor, lightResult.z; \n"
138 "ADD out, finalColor, temp3;\n"
139 "MOV out.w, temp2.w;\n"
149 "TEMP index, normal, finalColor;\n"
150 "TEMP temp,temp1, temp2, temp3,temp4; \n"
151 "TEMP sampleColor;\n"
152 "TEMP ndotl, ndoth, ndotv; \n"
153 "TEMP lightInfo, lightResult;\n"
157 "ATTRIB tex0 = fragment.texcoord[0];\n"
160 "PARAM lightDirection = program.local[0];\n"
161 "PARAM halfwayVector = program.local[1];\n"
162 "PARAM coefficient = program.local[2];\n"
163 "PARAM lightDiffColor = program.local[3]; \n"
164 "PARAM lightSpecColor = program.local[4]; \n"
165 "PARAM viewVector = program.local[5];\n"
166 "PARAM constants = program.local[6];\n"
169 "OUTPUT out = result.color;\n"
173 "TEX temp2, tex0, texture[0], 3D;\n"
211 "MOV index.x,temp2.a;\n"
215 "MAD normal, temp2, constants.x, constants.y;\n"
225 "DP3 temp4, normal, normal;\n"
227 "RSQ temp, temp4.x;\n"
229 "RCP temp4,temp.x;\n"
231 "MUL normal, normal, temp;\n"
233 "MOV index.y, temp4.x;\n"
235 "TEX sampleColor, index, texture[1], 2D;\n"
241 "DP3 ndotl, normal, lightDirection;\n"
245 "DP3 ndoth, normal, halfwayVector;\n"
247 "DP3 ndotv, normal, viewVector;\n"
250 "MUL temp3, ndotl, constants.y; \n"
251 "CMP ndotl, ndotv, ndotl, temp3;\n"
252 "MUL temp3, ndoth, constants.y; \n"
253 "CMP ndoth, ndotv, ndoth, temp3;\n"
256 "MOV lightInfo.x, ndotl.x; \n"
257 "MOV lightInfo.y, ndoth.x; \n"
258 "MOV lightInfo.w, coefficient.w; \n"
261 "LIT lightResult, lightInfo;\n"
264 "MUL lightResult, lightResult, 4.0;\n"
267 "MUL finalColor, coefficient.x, sampleColor;\n"
270 "MUL temp3, lightDiffColor, sampleColor;\n"
271 "MUL temp3, temp3, lightResult.y;\n"
272 "ADD finalColor, finalColor, temp3;\n"
275 "MUL temp3, lightSpecColor, lightResult.z; \n"
279 "ADD out, finalColor, temp3;\n"
280 "MOV out.w, sampleColor.w;\n"
322 static_cast<vtkRenderWindow *
>(renWin)->MakeCurrent();
323 #ifdef GL_VERSION_1_1
348 vtkWindow *renWin = renderer->
GetVtkRenderer()->GetRenderWindow();
352 static_cast<vtkRenderWindow *
>(renWin)->MakeCurrent();
353 #ifdef GL_VERSION_1_1
377 ren->GetRenderWindow()->MakeCurrent();
387 vtkErrorMacro(
"required extensions not supported");
392 vtkPlaneCollection *clipPlanes;
394 int numClipPlanes = 0;
395 double planeEquation[4];
398 vol->GetMatrix(matrix);
401 glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_POLYGON_BIT |
407 clipPlanes = this->ClippingPlanes;
410 numClipPlanes = clipPlanes->GetNumberOfItems();
411 if (numClipPlanes > 6)
413 vtkErrorMacro(<<
"OpenGL guarantees only 6 additional clipping planes");
416 for (i = 0; i < numClipPlanes; i++)
418 glEnable(static_cast<GLenum>(GL_CLIP_PLANE0 + i));
420 plane =
static_cast<vtkPlane *
>(clipPlanes->GetItemAsObject(i));
422 planeEquation[0] = plane->GetNormal()[0];
423 planeEquation[1] = plane->GetNormal()[1];
424 planeEquation[2] = plane->GetNormal()[2];
425 planeEquation[3] = -(planeEquation[0] * plane->GetOrigin()[0] + planeEquation[1] * plane->GetOrigin()[1] +
426 planeEquation[2] * plane->GetOrigin()[2]);
427 glClipPlane(static_cast<GLenum>(GL_CLIP_PLANE0 + i), planeEquation);
432 glMatrixMode(GL_MODELVIEW);
434 glMultMatrixd(matrix->Element[0]);
436 glColor4f(1.0, 1.0, 1.0, 1.0);
439 glDisable(GL_LIGHTING);
446 glMatrixMode(GL_MODELVIEW);
463 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
465 int components = this->GetInput()->GetNumberOfScalarComponents();
477 vtkgl::ActiveTexture(vtkgl::TEXTURE2);
478 glDisable(GL_TEXTURE_2D);
479 glDisable(vtkgl::TEXTURE_3D);
481 vtkgl::ActiveTexture(vtkgl::TEXTURE1);
482 glDisable(GL_TEXTURE_2D);
483 glDisable(vtkgl::TEXTURE_3D);
485 vtkgl::ActiveTexture(vtkgl::TEXTURE0);
486 glDisable(GL_TEXTURE_2D);
487 glDisable(vtkgl::TEXTURE_3D);
496 if (glIsTexture(*index))
500 glDeleteTextures(1, &tempIndex);
509 GLuint tempIndex = 0;
510 glGenTextures(1, &tempIndex);
511 *index =
static_cast<long>(tempIndex);
518 vtkRenderWindow *renWin = ren->GetRenderWindow();
520 if (renWin->CheckAbortStatus())
525 double bounds[27][6];
536 this->GetInput()->GetBounds(bounds[0]);
540 else if (this->CroppingRegionFlags == 0x2000)
542 this->GetCroppingRegionPlanes(bounds[0]);
550 ren->GetActiveCamera()->GetPosition(camPos);
553 this->GetInput()->GetBounds(volBounds);
558 vol->GetMatrix(volMatrix);
561 volMatrix->MultiplyPoint(camPos, camPos);
565 camPos[0] /= camPos[3];
566 camPos[1] /= camPos[3];
567 camPos[2] /= camPos[3];
575 for (i = 0; i < 3; i++)
577 limit[i * 4] = volBounds[i * 2];
578 limit[i * 4 + 1] = this->CroppingRegionPlanes[i * 2];
579 limit[i * 4 + 2] = this->CroppingRegionPlanes[i * 2 + 1];
580 limit[i * 4 + 3] = volBounds[i * 2 + 1];
588 for (region = 0; region < 27; region++)
590 int regionFlag = 1 << region;
592 if (this->CroppingRegionFlags & regionFlag)
597 loc[1] = (region / 3) % 3;
598 loc[2] = (region / 9) % 3;
602 for (i = 0; i < 3; i++)
604 bounds[numRegions][i * 2] = limit[4 * i + loc[i]];
605 bounds[numRegions][i * 2 + 1] = limit[4 * i + loc[i] + 1];
606 center[i] = (bounds[numRegions][i * 2] + bounds[numRegions][i * 2 + 1]) / 2.0;
610 distance2[numRegions] = (camPos[0] - center[0]) * (camPos[0] - center[0]) +
611 (camPos[1] - center[1]) * (camPos[1] - center[1]) +
612 (camPos[2] - center[2]) * (camPos[2] - center[2]);
620 for (i = 1; i < numRegions; i++)
622 for (j = i; j > 0 && distance2[j] > distance2[j - 1]; j--)
627 for (k = 0; k < 6; k++)
629 tmpBounds[k] = bounds[j][k];
631 tmpDistance2 = distance2[j];
633 for (k = 0; k < 6; k++)
635 bounds[j][k] = bounds[j - 1][k];
637 distance2[j] = distance2[j - 1];
639 for (k = 0; k < 6; k++)
641 bounds[j - 1][k] = tmpBounds[k];
643 distance2[j - 1] = tmpDistance2;
647 numIterations = numRegions;
651 for (
int loop = 0; loop < numIterations; loop++)
660 if (renWin->CheckAbortStatus())
667 glBegin(GL_TRIANGLE_FAN);
669 for (j = 0; j < 6; j++)
676 for (k = 0; k < 4; k++)
680 vtkgl::MultiTexCoord3fv(vtkgl::TEXTURE0 + k, ptr);
683 glVertex3fv(ptr + 3);
718 class ScalarGradientCompute
721 unsigned char *tmpPtr;
722 unsigned char *tmpPtr2;
734 int currentChunkStart;
743 ScalarGradientCompute(T *_dataPtr,
744 unsigned char *_tmpPtr,
745 unsigned char *_tmpPtr2,
767 sizeXY = sizeX * sizeY;
772 fullXY = fullX * fullY;
775 inline float sample(
int x,
int y,
int z) {
return float(dataPtr[x + y * sizeX + z * sizeXY]); }
776 inline void fill(
int x,
int y,
int z)
778 int doff = x + y * fullX + (z - offZ) * fullXY;
780 tmpPtr[doff * 4 + 0] = 0;
781 tmpPtr[doff * 4 + 1] = 0;
782 tmpPtr[doff * 4 + 2] = 0;
783 tmpPtr[doff * 4 + 3] = 0;
791 inline int clamp(
int x)
800 inline void write(
int x,
int y,
int z,
float grayValue,
float gx,
float gy,
float gz)
809 int iGrayValue =
static_cast<int>((grayValue +
offset) * scale + 0.5f);
815 float t = sqrtf(gx * gx + gy * gy + gz * gz);
821 float fac = 2.0f / t;
828 float fac = 255.0f / t;
839 int nx =
static_cast<int>(0.5f * gx + 127.5f);
840 int ny =
static_cast<int>(0.5f * gy + 127.5f);
841 int nz =
static_cast<int>(0.5f * gz + 127.5f);
843 int doff = x + y * fullX + (z - offZ) * fullXY;
847 tmpPtr[doff * 4 + 0] = clamp(nx);
848 tmpPtr[doff * 4 + 1] = clamp(ny);
849 tmpPtr[doff * 4 + 2] = clamp(nz);
850 tmpPtr[doff * 4 + 3] = clamp(iGrayValue);
859 inline void compute(
int x,
int y,
int z)
861 float grayValue = sample(x, y, z);
864 gx = sample(x + 1, y, z) - sample(x - 1, y, z);
865 gy = sample(x, y + 1, z) - sample(x, y - 1, z);
866 gz = sample(x, y, z + 1) - sample(x, y, z - 1);
868 write(x, y, z, grayValue, gx, gy, gz);
871 inline void computeClamp(
int x,
int y,
int z)
873 float grayValue = sample(x, y, z);
877 gx = 2.0f * (sample(x + 1, y, z) - grayValue);
878 else if (x == sizeXm1)
879 gx = 2.0f * (grayValue - sample(x - 1, y, z));
881 gx = sample(x + 1, y, z) - sample(x - 1, y, z);
884 gy = 2.0f * (sample(x, y + 1, z) - grayValue);
885 else if (y == sizeYm1)
886 gy = 2.0f * (grayValue - sample(x, y - 1, z));
888 gy = sample(x, y + 1, z) - sample(x, y - 1, z);
891 gz = 2.0f * (sample(x, y, z + 1) - grayValue);
892 else if (z == sizeZm1)
893 gz = 2.0f * (grayValue - sample(x, y, z - 1));
895 gz = sample(x, y, z + 1) - sample(x, y, z - 1);
897 write(x, y, z, grayValue, gx, gy, gz);
900 inline void compute1D(
int y,
int z)
905 computeClamp(x, y, z);
908 while (x < sizeX - 1)
916 computeClamp(x, y, z);
927 inline void fill1D(
int y,
int z)
939 inline void computeClamp1D(
int y,
int z)
947 computeClamp(x, y, z);
958 inline void computeClamp2D(
int z)
966 computeClamp1D(y, z);
977 inline void compute2D(
int z)
982 computeClamp1D(y, z);
985 while (y < sizeY - 1)
993 computeClamp1D(y, z);
1004 inline void fill2D(
int z)
1016 inline void fillSlices(
int currentChunkStart,
int currentChunkEnd)
1018 offZ = currentChunkStart;
1025 #pragma omp parallel for
1026 for (
int z = currentChunkStart; z <= currentChunkEnd; z++)
1028 if (z == 0 || z == sizeZ - 1)
1030 else if (z >= sizeZ)
1047 int inputDimensions[3];
1048 double inputSpacing[3];
1049 vtkImageData *input = me->GetInput();
1051 input->GetDimensions(inputDimensions);
1052 input->GetSpacing(inputSpacing);
1054 int outputDimensions[3];
1055 float outputSpacing[3];
1056 me->GetVolumeDimensions(outputDimensions);
1057 me->GetVolumeSpacing(outputSpacing);
1070 int fullX = outputDimensions[0];
1071 int fullY = outputDimensions[1];
1072 int fullZ = outputDimensions[2];
1074 int sizeX = inputDimensions[0];
1075 int sizeY = inputDimensions[1];
1076 int sizeZ = inputDimensions[2];
1080 if (fullZ < chunkSize)
1083 int numChunks = (fullZ + (chunkSize - 1)) / chunkSize;
1087 unsigned char *tmpPtr =
new unsigned char[fullX * fullY * chunkSize * 4];
1088 unsigned char *tmpPtr2 = 0;
1092 ScalarGradientCompute<T> sgc(dataPtr, tmpPtr, tmpPtr2, sizeX, sizeY, sizeZ, fullX, fullY, fullZ, offset, scale);
1094 int currentChunk = 0;
1096 while (currentChunk < numChunks)
1098 int currentChunkStart = currentChunk * chunkSize;
1099 int currentChunkEnd = currentChunkStart + chunkSize - 1;
1101 if (currentChunkEnd > (fullZ - 1))
1102 currentChunkEnd = (fullZ - 1);
1104 int currentChunkSize = currentChunkEnd - currentChunkStart + 1;
1106 sgc.fillSlices(currentChunkStart, currentChunkEnd);
1108 glBindTexture(vtkgl::TEXTURE_3D, volume1);
1109 vtkgl::TexSubImage3D(vtkgl::TEXTURE_3D,
1129 unsigned char *dataPtr;
1130 unsigned char *tmpPtr;
1131 unsigned char *tmpPtr2;
1149 RGBACompute(
unsigned char *_dataPtr,
1150 unsigned char *_tmpPtr,
1151 unsigned char *_tmpPtr2,
1169 sizeXY = sizeX * sizeY;
1170 sizeXm1 = sizeX - 1;
1171 sizeYm1 = sizeY - 1;
1172 sizeZm1 = sizeZ - 1;
1174 fullXY = fullX * fullY;
1177 inline int sample(
int x,
int y,
int z) {
return dataPtr[(x + y * sizeX + z * sizeXY) * 4 + 3]; }
1178 inline void fill(
int x,
int y,
int z)
1180 int doff = x + y * fullX + (z - offZ) * fullXY;
1182 tmpPtr[doff * 4 + 0] = 0;
1183 tmpPtr[doff * 4 + 1] = 0;
1184 tmpPtr[doff * 4 + 2] = 0;
1185 tmpPtr[doff * 4 + 3] = 0;
1187 tmpPtr2[doff * 3 + 0] = 0;
1188 tmpPtr2[doff * 3 + 1] = 0;
1189 tmpPtr2[doff * 3 + 2] = 0;
1192 inline int clamp(
int x)
1201 inline void write(
int x,
int y,
int z,
int iGrayValue,
int gx,
int gy,
int gz)
1208 int nx =
static_cast<int>(0.5f * gx + 127.5f);
1209 int ny =
static_cast<int>(0.5f * gy + 127.5f);
1210 int nz =
static_cast<int>(0.5f * gz + 127.5f);
1212 int doff = x + y * fullX + (z - offZ) * fullXY;
1216 tmpPtr[doff * 4 + 0] = clamp(nx);
1217 tmpPtr[doff * 4 + 1] = clamp(ny);
1218 tmpPtr[doff * 4 + 2] = clamp(nz);
1219 tmpPtr[doff * 4 + 3] = clamp(iGrayValue);
1221 int soff = x + y * sizeX + z * sizeXY;
1223 tmpPtr2[doff * 3 + 0] = dataPtr[soff * 4 + 0];
1224 tmpPtr2[doff * 3 + 1] = dataPtr[soff * 4 + 1];
1225 tmpPtr2[doff * 3 + 2] = dataPtr[soff * 4 + 2];
1234 inline void compute(
int x,
int y,
int z)
1236 int grayValue = sample(x, y, z);
1239 gx = sample(x + 1, y, z) - sample(x - 1, y, z);
1240 gy = sample(x, y + 1, z) - sample(x, y - 1, z);
1241 gz = sample(x, y, z + 1) - sample(x, y, z - 1);
1243 write(x, y, z, grayValue, gx, gy, gz);
1246 inline void computeClamp(
int x,
int y,
int z)
1248 int grayValue = sample(x, y, z);
1252 gx = 2 * (sample(x + 1, y, z) - grayValue);
1253 else if (x == sizeXm1)
1254 gx = 2 * (grayValue - sample(x - 1, y, z));
1256 gx = sample(x + 1, y, z) - sample(x - 1, y, z);
1259 gy = 2 * (sample(x, y + 1, z) - grayValue);
1260 else if (y == sizeYm1)
1261 gy = 2 * (grayValue - sample(x, y - 1, z));
1263 gy = sample(x, y + 1, z) - sample(x, y - 1, z);
1266 gz = 2 * (sample(x, y, z + 1) - grayValue);
1267 else if (z == sizeZm1)
1268 gz = 2 * (grayValue - sample(x, y, z - 1));
1270 gz = sample(x, y, z + 1) - sample(x, y, z - 1);
1272 write(x, y, z, grayValue, gx, gy, gz);
1275 inline void compute1D(
int y,
int z)
1279 computeClamp(x, y, z);
1282 while (x < sizeX - 1)
1290 computeClamp(x, y, z);
1301 inline void fill1D(
int y,
int z)
1312 inline void computeClamp1D(
int y,
int z)
1318 computeClamp(x, y, z);
1329 inline void computeClamp2D(
int z)
1335 computeClamp1D(y, z);
1346 inline void compute2D(
int z)
1350 computeClamp1D(y, z);
1353 while (y < sizeY - 1)
1361 computeClamp1D(y, z);
1372 inline void fill2D(
int z)
1383 inline void fillSlices(
int currentChunkStart,
int currentChunkEnd)
1385 offZ = currentChunkStart;
1387 #pragma omp parallel for
1388 for (
int z = currentChunkStart; z <= currentChunkEnd; z++)
1390 if (z == 0 || z == sizeZ - 1)
1392 else if (z >= sizeZ)
1410 int inputDimensions[3];
1411 double inputSpacing[3];
1412 vtkImageData *input = me->GetInput();
1414 input->GetDimensions(inputDimensions);
1415 input->GetSpacing(inputSpacing);
1417 int outputDimensions[3];
1418 float outputSpacing[3];
1419 me->GetVolumeDimensions(outputDimensions);
1420 me->GetVolumeSpacing(outputSpacing);
1422 int components = input->GetNumberOfScalarComponents();
1424 MITK_INFO <<
"components are " << components;
1435 int fullX = outputDimensions[0];
1436 int fullY = outputDimensions[1];
1437 int fullZ = outputDimensions[2];
1439 int sizeX = inputDimensions[0];
1440 int sizeY = inputDimensions[1];
1441 int sizeZ = inputDimensions[2];
1445 if (fullZ < chunkSize)
1448 int numChunks = (fullZ + (chunkSize - 1)) / chunkSize;
1452 unsigned char *tmpPtr =
new unsigned char[fullX * fullY * chunkSize * 4];
1453 unsigned char *tmpPtr2 =
new unsigned char[fullX * fullY * chunkSize * 3];
1457 RGBACompute sgc(dataPtr, tmpPtr, tmpPtr2, sizeX, sizeY, sizeZ, fullX, fullY, fullZ);
1459 int currentChunk = 0;
1461 while (currentChunk < numChunks)
1465 int currentChunkStart = currentChunk * chunkSize;
1466 int currentChunkEnd = currentChunkStart + chunkSize - 1;
1468 if (currentChunkEnd > (fullZ - 1))
1469 currentChunkEnd = (fullZ - 1);
1471 int currentChunkSize = currentChunkEnd - currentChunkStart + 1;
1473 sgc.fillSlices(currentChunkStart, currentChunkEnd);
1475 glBindTexture(vtkgl::TEXTURE_3D, volume1);
1476 vtkgl::TexSubImage3D(vtkgl::TEXTURE_3D,
1488 glBindTexture(vtkgl::TEXTURE_3D, volume2);
1489 vtkgl::TexSubImage3D(vtkgl::TEXTURE_3D,
1513 vtkImageData *input = this->GetInput();
1517 input->GetDimensions(dim);
1519 int powerOfTwoDim[3];
1523 for (
int i = 0; i < 3; i++)
1524 powerOfTwoDim[i] = (dim[i] + 1) & ~1;
1532 for (
int i = 0; i < 3; i++)
1534 powerOfTwoDim[i] = 4;
1535 while (powerOfTwoDim[i] < dim[i])
1536 powerOfTwoDim[i] *= 2;
1539 MITK_WARN <<
"using power-two textures ("
1541 double(dim[0] * dim[1] * dim[2]) / double(powerOfTwoDim[0] * powerOfTwoDim[1] * powerOfTwoDim[2])) *
1543 <<
"% memory wasted)";
1553 input->GetSpacing(spacing);
1565 vtkImageData *input = this->GetInput();
1568 bool needUpdate =
false;
1583 int components = input->GetNumberOfScalarComponents();
1586 double scalarRange[2];
1587 input->GetPointData()->GetScalars()->GetRange(scalarRange, components - 1);
1598 int arraySizeNeeded;
1600 int scalarType = input->GetScalarType();
1602 if (scalarType == VTK_FLOAT || scalarType == VTK_DOUBLE || scalarRange[1] - scalarRange[0] > 255)
1604 arraySizeNeeded = 256;
1605 offset = -scalarRange[0];
1606 scale = 255.0 / (scalarRange[1] - scalarRange[0]);
1610 arraySizeNeeded =
static_cast<int>(scalarRange[1] - scalarRange[0] + 1);
1611 offset = -scalarRange[0];
1630 this->GetVolumeDimensions(dim);
1632 vtkgl::ActiveTexture(vtkgl::TEXTURE0);
1634 MITK_INFO <<
"allocating volume on gpu";
1636 GLint gradientScalarTextureFormat = GL_RGBA8;
1643 vtkgl::TEXTURE_3D, 0, gradientScalarTextureFormat, dim[0], dim[1], dim[2], 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1648 void *dataPtr = input->GetScalarPointer();
1666 vtkImageData *input = this->GetInput();
1669 bool needUpdate =
false;
1697 this->GetVolumeDimensions(dim);
1699 MITK_INFO <<
"allocating volume on gpu";
1701 GLint gradientScalarTextureFormat = GL_RGBA8;
1702 GLint colorTextureFormat = GL_RGB8;
1710 vtkgl::ActiveTexture(vtkgl::TEXTURE0);
1713 vtkgl::TEXTURE_3D, 0, gradientScalarTextureFormat, dim[0], dim[1], dim[2], 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
1717 vtkgl::TexImage3D(vtkgl::TEXTURE_3D, 0, colorTextureFormat, dim[0], dim[1], dim[2], 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
1722 unsigned char *dataPtr = (
unsigned char *)input->GetScalarPointer();
1737 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
1738 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
1742 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1743 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1746 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1747 glTexParameterf(vtkgl::TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1764 vtkgl::ActiveTexture(vtkgl::TEXTURE1);
1767 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
1768 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
1769 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
1770 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
1774 GLint colorLookupTextureFormat = GL_RGBA8;
1779 glTexImage2D(GL_TEXTURE_2D, 0, colorLookupTextureFormat, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, this->
ColorLookup);
1785 MITK_INFO <<
"SetupFourDependentTextures";
1886 glEnable(vtkgl::FRAGMENT_PROGRAM_ARB);
1894 vtkgl::ActiveTexture(vtkgl::TEXTURE0);
1895 glDisable(GL_TEXTURE_2D);
1896 glEnable(vtkgl::TEXTURE_3D);
1899 vtkgl::ActiveTexture(vtkgl::TEXTURE1);
1900 glEnable(GL_TEXTURE_2D);
1901 glDisable(vtkgl::TEXTURE_3D);
1904 vtkgl::ActiveTexture(vtkgl::TEXTURE2);
1905 glDisable(GL_TEXTURE_2D);
1906 glEnable(vtkgl::TEXTURE_3D);
1910 int stages[4] = {1, 1, 1, 0};
1913 glDisable(vtkgl::FRAGMENT_PROGRAM_ARB);
1920 glEnable(vtkgl::FRAGMENT_PROGRAM_ARB);
1922 vtkgl::BindProgramARB(vtkgl::FRAGMENT_PROGRAM_ARB,
prgRGBAShade);
1928 vtkgl::ActiveTexture(vtkgl::TEXTURE0);
1929 glDisable(GL_TEXTURE_2D);
1930 glEnable(vtkgl::TEXTURE_3D);
1933 vtkgl::ActiveTexture(vtkgl::TEXTURE1);
1934 glDisable(GL_TEXTURE_2D);
1935 glEnable(vtkgl::TEXTURE_3D);
1939 int stages[4] = {1, 1, 1, 0};
1942 glDisable(vtkgl::FRAGMENT_PROGRAM_ARB);
1947 GLfloat lightDirection[2][4],
1948 GLfloat lightDiffuseColor[2][4],
1949 GLfloat lightSpecularColor[2][4],
1950 GLfloat halfwayVector[2][4],
1951 GLfloat ambientColor[4])
1955 float ambient = vol->GetProperty()->GetAmbient();
1956 float diffuse = vol->GetProperty()->GetDiffuse();
1957 float specular = vol->GetProperty()->GetSpecular();
1961 volumeTransform->SetMatrix(vol->GetMatrix());
1962 volumeTransform->Inverse();
1964 vtkLightCollection *lights = ren->GetLights();
1965 lights->InitTraversal();
1968 light[0] = lights->GetNextItem();
1969 light[1] = lights->GetNextItem();
1973 double cameraPosition[3];
1974 double cameraFocalPoint[3];
1976 ren->GetActiveCamera()->GetPosition(cameraPosition);
1977 ren->GetActiveCamera()->GetFocalPoint(cameraFocalPoint);
1979 double viewDirection[3];
1981 volumeTransform->TransformPoint(cameraPosition, cameraPosition);
1982 volumeTransform->TransformPoint(cameraFocalPoint, cameraFocalPoint);
1984 viewDirection[0] = cameraFocalPoint[0] - cameraPosition[0];
1985 viewDirection[1] = cameraFocalPoint[1] - cameraPosition[1];
1986 viewDirection[2] = cameraFocalPoint[2] - cameraPosition[2];
1990 ambientColor[0] = 0.0;
1991 ambientColor[1] = 0.0;
1992 ambientColor[2] = 0.0;
1993 ambientColor[3] = 0.0;
1995 for (lightIndex = 0; lightIndex < 2; lightIndex++)
1997 float dir[3] = {0, 0, 0};
1998 float half[3] = {0, 0, 0};
2000 if (light[lightIndex] == NULL || light[lightIndex]->GetSwitch() == 0)
2002 lightDiffuseColor[lightIndex][0] = 0.0;
2003 lightDiffuseColor[lightIndex][1] = 0.0;
2004 lightDiffuseColor[lightIndex][2] = 0.0;
2005 lightDiffuseColor[lightIndex][3] = 0.0;
2007 lightSpecularColor[lightIndex][0] = 0.0;
2008 lightSpecularColor[lightIndex][1] = 0.0;
2009 lightSpecularColor[lightIndex][2] = 0.0;
2010 lightSpecularColor[lightIndex][3] = 0.0;
2014 float lightIntensity = light[lightIndex]->GetIntensity();
2015 double lightColor[3];
2017 light[lightIndex]->GetDiffuseColor(lightColor);
2019 double lightPosition[3];
2020 double lightFocalPoint[3];
2021 light[lightIndex]->GetTransformedPosition(lightPosition);
2022 light[lightIndex]->GetTransformedFocalPoint(lightFocalPoint);
2024 volumeTransform->TransformPoint(lightPosition, lightPosition);
2025 volumeTransform->TransformPoint(lightFocalPoint, lightFocalPoint);
2027 dir[0] = lightPosition[0] - lightFocalPoint[0];
2028 dir[1] = lightPosition[1] - lightFocalPoint[1];
2029 dir[2] = lightPosition[2] - lightFocalPoint[2];
2033 lightDiffuseColor[lightIndex][0] = lightColor[0] * diffuse * lightIntensity;
2034 lightDiffuseColor[lightIndex][1] = lightColor[1] * diffuse * lightIntensity;
2035 lightDiffuseColor[lightIndex][2] = lightColor[2] * diffuse * lightIntensity;
2036 lightDiffuseColor[lightIndex][3] = 1.0;
2038 lightSpecularColor[lightIndex][0] = lightColor[0] * specular * lightIntensity;
2039 lightSpecularColor[lightIndex][1] = lightColor[1] * specular * lightIntensity;
2040 lightSpecularColor[lightIndex][2] = lightColor[2] * specular * lightIntensity;
2041 lightSpecularColor[lightIndex][3] = 0.0;
2043 half[0] = dir[0] - viewDirection[0];
2044 half[1] = dir[1] - viewDirection[1];
2045 half[2] = dir[2] - viewDirection[2];
2049 ambientColor[0] += ambient * lightColor[0];
2050 ambientColor[1] += ambient * lightColor[1];
2051 ambientColor[2] += ambient * lightColor[2];
2054 lightDirection[lightIndex][0] = (dir[0] + 1.0) / 2.0;
2055 lightDirection[lightIndex][1] = (dir[1] + 1.0) / 2.0;
2056 lightDirection[lightIndex][2] = (dir[2] + 1.0) / 2.0;
2057 lightDirection[lightIndex][3] = 0.0;
2059 halfwayVector[lightIndex][0] = (half[0] + 1.0) / 2.0;
2060 halfwayVector[lightIndex][1] = (half[1] + 1.0) / 2.0;
2061 halfwayVector[lightIndex][2] = (half[2] + 1.0) / 2.0;
2062 halfwayVector[lightIndex][3] = 0.0;
2065 volumeTransform->Delete();
2072 GLfloat lightDirection[2][4];
2073 GLfloat lightDiffuseColor[2][4];
2074 GLfloat lightSpecularColor[2][4];
2075 GLfloat halfwayVector[2][4];
2076 GLfloat ambientColor[4];
2078 float ambient = vol->GetProperty()->GetAmbient();
2079 float diffuse = vol->GetProperty()->GetDiffuse();
2080 float specular = vol->GetProperty()->GetSpecular();
2081 float specularPower = vol->GetProperty()->GetSpecularPower();
2085 volumeTransform->SetMatrix(vol->GetMatrix());
2086 volumeTransform->Inverse();
2088 vtkLightCollection *lights = ren->GetLights();
2089 lights->InitTraversal();
2092 light[0] = lights->GetNextItem();
2093 light[1] = lights->GetNextItem();
2097 double cameraPosition[3];
2098 double cameraFocalPoint[3];
2100 ren->GetActiveCamera()->GetPosition(cameraPosition);
2101 ren->GetActiveCamera()->GetFocalPoint(cameraFocalPoint);
2103 volumeTransform->TransformPoint(cameraPosition, cameraPosition);
2104 volumeTransform->TransformPoint(cameraFocalPoint, cameraFocalPoint);
2106 double viewDirection[4];
2108 viewDirection[0] = cameraFocalPoint[0] - cameraPosition[0];
2109 viewDirection[1] = cameraFocalPoint[1] - cameraPosition[1];
2110 viewDirection[2] = cameraFocalPoint[2] - cameraPosition[2];
2111 viewDirection[3] = 0.0;
2115 ambientColor[0] = 0.0;
2116 ambientColor[1] = 0.0;
2117 ambientColor[2] = 0.0;
2118 ambientColor[3] = 0.0;
2120 for (lightIndex = 0; lightIndex < 2; lightIndex++)
2122 float dir[3] = {0, 0, 0};
2123 float half[3] = {0, 0, 0};
2125 if (light[lightIndex] == NULL || light[lightIndex]->GetSwitch() == 0)
2127 lightDiffuseColor[lightIndex][0] = 0.0;
2128 lightDiffuseColor[lightIndex][1] = 0.0;
2129 lightDiffuseColor[lightIndex][2] = 0.0;
2130 lightDiffuseColor[lightIndex][3] = 0.0;
2132 lightSpecularColor[lightIndex][0] = 0.0;
2133 lightSpecularColor[lightIndex][1] = 0.0;
2134 lightSpecularColor[lightIndex][2] = 0.0;
2135 lightSpecularColor[lightIndex][3] = 0.0;
2139 float lightIntensity = light[lightIndex]->GetIntensity();
2140 double lightColor[3];
2142 light[lightIndex]->GetDiffuseColor(lightColor);
2144 double lightPosition[3];
2145 double lightFocalPoint[3];
2146 light[lightIndex]->GetTransformedPosition(lightPosition);
2147 light[lightIndex]->GetTransformedFocalPoint(lightFocalPoint);
2149 volumeTransform->TransformPoint(lightPosition, lightPosition);
2150 volumeTransform->TransformPoint(lightFocalPoint, lightFocalPoint);
2152 dir[0] = lightPosition[0] - lightFocalPoint[0];
2153 dir[1] = lightPosition[1] - lightFocalPoint[1];
2154 dir[2] = lightPosition[2] - lightFocalPoint[2];
2158 lightDiffuseColor[lightIndex][0] = lightColor[0] * diffuse * lightIntensity;
2159 lightDiffuseColor[lightIndex][1] = lightColor[1] * diffuse * lightIntensity;
2160 lightDiffuseColor[lightIndex][2] = lightColor[2] * diffuse * lightIntensity;
2161 lightDiffuseColor[lightIndex][3] = 0.0;
2163 lightSpecularColor[lightIndex][0] = lightColor[0] * specular * lightIntensity;
2164 lightSpecularColor[lightIndex][1] = lightColor[1] * specular * lightIntensity;
2165 lightSpecularColor[lightIndex][2] = lightColor[2] * specular * lightIntensity;
2166 lightSpecularColor[lightIndex][3] = 0.0;
2168 half[0] = dir[0] - viewDirection[0];
2169 half[1] = dir[1] - viewDirection[1];
2170 half[2] = dir[2] - viewDirection[2];
2174 ambientColor[0] += ambient * lightColor[0];
2175 ambientColor[1] += ambient * lightColor[1];
2176 ambientColor[2] += ambient * lightColor[2];
2179 lightDirection[lightIndex][0] = dir[0];
2180 lightDirection[lightIndex][1] = dir[1];
2181 lightDirection[lightIndex][2] = dir[2];
2182 lightDirection[lightIndex][3] = 0.0;
2184 halfwayVector[lightIndex][0] = half[0];
2185 halfwayVector[lightIndex][1] = half[1];
2186 halfwayVector[lightIndex][2] = half[2];
2187 halfwayVector[lightIndex][3] = 0.0;
2190 volumeTransform->Delete();
2192 vtkgl::ProgramLocalParameter4fARB(vtkgl::FRAGMENT_PROGRAM_ARB,
2194 lightDirection[0][0],
2195 lightDirection[0][1],
2196 lightDirection[0][2],
2197 lightDirection[0][3]);
2199 vtkgl::ProgramLocalParameter4fARB(
2200 vtkgl::FRAGMENT_PROGRAM_ARB, 1, halfwayVector[0][0], halfwayVector[0][1], halfwayVector[0][2], halfwayVector[0][3]);
2202 vtkgl::ProgramLocalParameter4fARB(vtkgl::FRAGMENT_PROGRAM_ARB, 2, ambient, diffuse, specular, specularPower);
2204 vtkgl::ProgramLocalParameter4fARB(vtkgl::FRAGMENT_PROGRAM_ARB,
2206 lightDiffuseColor[0][0],
2207 lightDiffuseColor[0][1],
2208 lightDiffuseColor[0][2],
2209 lightDiffuseColor[0][3]);
2211 vtkgl::ProgramLocalParameter4fARB(vtkgl::FRAGMENT_PROGRAM_ARB,
2213 lightSpecularColor[0][0],
2214 lightSpecularColor[0][1],
2215 lightSpecularColor[0][2],
2216 lightSpecularColor[0][3]);
2218 vtkgl::ProgramLocalParameter4fARB(
2219 vtkgl::FRAGMENT_PROGRAM_ARB, 5, viewDirection[0], viewDirection[1], viewDirection[2], viewDirection[3]);
2221 vtkgl::ProgramLocalParameter4fARB(vtkgl::FRAGMENT_PROGRAM_ARB, 6, 2.0, -1.0, 0.0, 0.0);
2236 MITK_WARN <<
"vtkMitkOpenGLVolumeTextureMapper3D::IsRenderSupported Rendering not possible";
2240 if (!this->GetInput())
2242 MITK_WARN <<
"vtkMitkOpenGLVolumeTextureMapper3D::IsRenderSupported No input available";
2256 vtkOpenGLExtensionManager *extensions =
2257 static_cast<vtkOpenGLRenderWindow *
>(renderer->GetRenderWindow())->GetExtensionManager();
2259 int supports_texture3D = extensions->ExtensionSupported(
"GL_VERSION_1_2");
2260 if (supports_texture3D)
2262 extensions->LoadExtension(
"GL_VERSION_1_2");
2266 supports_texture3D = extensions->ExtensionSupported(
"GL_EXT_texture3D");
2267 if (supports_texture3D)
2269 extensions->LoadCorePromotedExtension(
"GL_EXT_texture3D");
2273 int supports_multitexture = extensions->ExtensionSupported(
"GL_VERSION_1_3");
2274 if (supports_multitexture)
2276 extensions->LoadExtension(
"GL_VERSION_1_3");
2280 supports_multitexture = extensions->ExtensionSupported(
"GL_ARB_multitexture");
2281 if (supports_multitexture)
2283 extensions->LoadCorePromotedExtension(
"GL_ARB_multitexture");
2293 extensions->LoadCorePromotedExtension(
"GL_ARB_texture_compression");
2299 extensions->ExtensionSupported(
"GL_ARB_texture_non_power_of_two");
2303 int supports_GL_ARB_fragment_program = extensions->ExtensionSupported(
"GL_ARB_fragment_program");
2304 if (supports_GL_ARB_fragment_program)
2306 extensions->LoadExtension(
"GL_ARB_fragment_program");
2309 int supports_GL_ARB_vertex_program = extensions->ExtensionSupported(
"GL_ARB_vertex_program");
2310 if (supports_GL_ARB_vertex_program)
2312 extensions->LoadExtension(
"GL_ARB_vertex_program");
2317 if (supports_texture3D && supports_multitexture && supports_GL_ARB_fragment_program &&
2318 supports_GL_ARB_vertex_program && vtkgl::TexImage3D && vtkgl::ActiveTexture && vtkgl::MultiTexCoord3fv &&
2319 vtkgl::GenProgramsARB && vtkgl::DeleteProgramsARB && vtkgl::BindProgramARB && vtkgl::ProgramStringARB &&
2320 vtkgl::ProgramLocalParameter4fARB)
2326 std::string errString =
2327 "no gpu-acceleration possible cause following extensions/methods are missing or unsupported:";
2328 if (!supports_texture3D)
2329 errString +=
" EXT_TEXTURE3D";
2330 if (!supports_multitexture)
2331 errString +=
" EXT_MULTITEXTURE";
2332 if (!supports_GL_ARB_fragment_program)
2333 errString +=
" ARB_FRAGMENT_PROGRAM";
2334 if (!supports_GL_ARB_vertex_program)
2335 errString +=
" ARB_VERTEX_PROGRAM";
2336 if (!vtkgl::TexImage3D)
2337 errString +=
" glTexImage3D";
2338 if (!vtkgl::ActiveTexture)
2339 errString +=
" glActiveTexture";
2340 if (!vtkgl::MultiTexCoord3fv)
2341 errString +=
" glMultiTexCoord3fv";
2342 if (!vtkgl::GenProgramsARB)
2343 errString +=
" glGenProgramsARB";
2344 if (!vtkgl::DeleteProgramsARB)
2345 errString +=
" glDeleteProgramsARB";
2346 if (!vtkgl::BindProgramARB)
2347 errString +=
" glBindProgramARB";
2348 if (!vtkgl::ProgramStringARB)
2349 errString +=
" glProgramStringARB";
2350 if (!vtkgl::ProgramLocalParameter4fARB)
2351 errString +=
" glProgramLocalParameter4fARB";
2359 vtkgl::ProgramStringARB(vtkgl::FRAGMENT_PROGRAM_ARB,
2360 vtkgl::PROGRAM_FORMAT_ASCII_ARB,
2365 vtkgl::BindProgramARB(vtkgl::FRAGMENT_PROGRAM_ARB,
prgRGBAShade);
2366 vtkgl::ProgramStringARB(vtkgl::FRAGMENT_PROGRAM_ARB,
2367 vtkgl::PROGRAM_FORMAT_ASCII_ARB,
2380 os << indent <<
"Initialized " << this->
Initialized << endl;
2415 vtkOpenGLExtensionManager *extensions =
2416 static_cast<vtkOpenGLRenderWindow *
>(this->
RenderWindow)->GetExtensionManager();
2420 os << indent <<
"Supports GL_VERSION_1_2:" << extensions->ExtensionSupported(
"GL_VERSION_1_2") << endl;
2421 os << indent <<
"Supports GL_EXT_texture3D:" << extensions->ExtensionSupported(
"GL_EXT_texture3D") << endl;
2422 os << indent <<
"Supports GL_VERSION_1_3:" << extensions->ExtensionSupported(
"GL_VERSION_1_3") << endl;
2423 os << indent <<
"Supports GL_ARB_multitexture: " << extensions->ExtensionSupported(
"GL_ARB_multitexture") << endl;
2424 os << indent <<
"Supports GL_NV_texture_shader2: " << extensions->ExtensionSupported(
"GL_NV_texture_shader2")
2427 <<
"Supports GL_NV_register_combiners2: " << extensions->ExtensionSupported(
"GL_NV_register_combiners2")
2429 os << indent <<
"Supports GL_ATI_fragment_shader: " << extensions->ExtensionSupported(
"GL_ATI_fragment_shader")
2431 os << indent <<
"Supports GL_ARB_fragment_program: " << extensions->ExtensionSupported(
"GL_ARB_fragment_program")
2434 <<
"Supports GL_ARB_texture_compression: " << extensions->ExtensionSupported(
"GL_ARB_texture_compression")
2436 os << indent <<
"Supports GL_VERSION_2_0:" << extensions->ExtensionSupported(
"GL_VERSION_2_0") << endl;
2437 os << indent <<
"Supports GL_ARB_texture_non_power_of_two:"
2438 << extensions->ExtensionSupported(
"GL_ARB_texture_non_power_of_two") << endl;
2442 this->Superclass::PrintSelf(os, indent);
void RenderPolygons(vtkRenderer *ren, vtkVolume *vol, int stages[4])
void CreateTextureIndex(GLuint *index)
const char * vtkMitkVolumeTextureMapper3D_FourDependentShadeFP
~vtkMitkOpenGLVolumeTextureMapper3D()
bool SupportsNonPowerOfTwoTextures
const char * vtkMitkVolumeTextureMapper3D_OneComponentShadeFP
Organizes the rendering process.
void vtkVolumeTextureMapper3DComputeScalars(T *dataPtr, vtkMitkVolumeTextureMapper3D *me, float offset, float scale, GLuint volume1, GLuint)
void SetupProgramLocalsForShadingFP(vtkRenderer *ren, vtkVolume *vol)
#define myGL_COMPRESSED_RGB_S3TC_DXT1_EXT
void ComputeVolumeDimensions()
void ComputePolygons(vtkRenderer *ren, vtkVolume *vol, double bounds[6])
#define myGL_COMPRESSED_RGBA_S3TC_DXT5_EXT
vtkImageData * SavedTextureInput
vtkTimeStamp SavedTextureMTime
void PrintSelf(ostream &os, vtkIndent indent) override
void RenderRGBAShadeFP(vtkRenderer *ren, vtkVolume *vol)
int UpdateColorLookup(vtkVolume *)
int IsRenderSupported(vtkRenderer *ren, vtkVolumeProperty *) override
GLuint prgOneComponentShade
void GetLightInformation(vtkRenderer *ren, vtkVolume *vol, GLfloat lightDirection[2][4], GLfloat lightDiffuseColor[2][4], GLfloat lightSpecularColor[2][4], GLfloat halfwayVector[2][4], GLfloat *ambient)
bool UpdateVolumesRGBA(vtkVolume *)
vtkStandardNewMacro(vtkMitkOpenGLVolumeTextureMapper3D)
bool UpdateVolumes(vtkVolume *)
unsigned char ColorLookup[65536 *4]
void Normalize(itk::Image< TPixel, VImageDimension > *itkImage, mitk::Image::Pointer im2, mitk::Image::Pointer mask1, std::string output)
bool SupportsCompressedTexture
bool UseCompressedTexture
virtual void RenderFP(vtkRenderer *ren, vtkVolume *vol)
void Setup3DTextureParameters(bool linear)
vtkRenderWindow * RenderWindow
virtual void Render(vtkRenderer *ren, vtkVolume *vol) override
vtkRenderer * GetVtkRenderer() const
vtkMitkOpenGLVolumeTextureMapper3D()
void DeleteTextureIndex(GLuint *index)
void RenderOneIndependentShadeFP(vtkRenderer *ren, vtkVolume *vol)
void vtkVolumeTextureMapper3DComputeRGBA(unsigned char *dataPtr, vtkMitkVolumeTextureMapper3D *me, GLuint volume1, GLuint volume2)
void ReleaseGraphicsResources(vtkWindow *) override
void SetupRGBATextures(vtkRenderer *ren, vtkVolume *vol)
void SetupOneIndependentTextures(vtkRenderer *ren, vtkVolume *vol)
void Initialize(vtkRenderer *r)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.