MCPcopy Create free account
hub / github.com/Kitware/VTK / Execute

Method Execute

Rendering/OpenGL2/vtkOpenGLImageAlgorithmHelper.cxx:51–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void vtkOpenGLImageAlgorithmHelper::Execute(vtkOpenGLImageAlgorithmCallback* cb,
52 vtkImageData* inImage, vtkDataArray* inArray, vtkImageData* outImage, int outExt[6],
53 const char* vertexCode, const char* fragmentCode, const char* geometryCode)
54{
55 // make sure it is initialized
56 if (!this->RenderWindow)
57 {
58 this->SetRenderWindow(vtkRenderWindow::New());
59 this->RenderWindow->SetShowWindow(false);
60 this->RenderWindow->UnRegister(this);
61 }
62 this->RenderWindow->Initialize();
63
64 // Is it a 2D or 3D image
65 int dims[3];
66 inImage->GetDimensions(dims);
67 int dimensions = 0;
68 for (int i = 0; i < 3; i++)
69 {
70 if (dims[i] > 1)
71 {
72 dimensions++;
73 }
74 }
75
76 // no 1D or 2D support yet
77 if (dimensions < 3)
78 {
79 vtkErrorMacro("no 1D or 2D processing support yet");
80 return;
81 }
82
83 // send vector data to a texture
84 int inputExt[6];
85 inImage->GetExtent(inputExt);
86 void* inPtr = inArray->GetVoidPointer(0);
87
88 // could do shortcut here if the input volume is
89 // exactly what we want (updateExtent == wholeExtent)
90 // vtkIdType incX, incY, incZ;
91 // inImage->GetContinuousIncrements(inArray, extent, incX, incY, incZ);
92 // tmpImage->CopyAndCastFrom(inImage, inUpdateExtent)
93
94 vtkNew<vtkTextureObject> inputTex;
95 inputTex->SetContext(this->RenderWindow);
96 inputTex->Create3DFromRaw(
97 dims[0], dims[1], dims[2], inArray->GetNumberOfComponents(), inArray->GetDataType(), inPtr);
98
99 float shift = 0.0;
100 float scale = 1.0;
101 inputTex->GetShiftAndScale(shift, scale);
102
103 // now create the framebuffer for the output
104 int outDims[3];
105 outDims[0] = outExt[1] - outExt[0] + 1;
106 outDims[1] = outExt[3] - outExt[2] + 1;
107 outDims[2] = outExt[5] - outExt[4] + 1;
108

Callers

nothing calls this directly

Calls 15

SetRenderWindowMethod · 0.95
Create3DFromRawMethod · 0.80
GetShiftAndScaleMethod · 0.80
Create2DMethod · 0.80
AddColorAttachmentMethod · 0.80
ActivateDrawBufferMethod · 0.80
StartNonOrthoMethod · 0.80
vtkglViewportMethod · 0.80
vtkglScissorMethod · 0.80
vtkglDisableMethod · 0.80
vtkglDepthMaskMethod · 0.80
vtkglClearColorMethod · 0.80

Tested by

no test coverage detected