Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
vtkNeverTranslucentTexture Class Reference

VTK Fix to speed up our image rendering. More...

#include <vtkNeverTranslucentTexture.h>

Inheritance diagram for vtkNeverTranslucentTexture:
Collaboration diagram for vtkNeverTranslucentTexture:

Public Member Functions

 vtkTypeMacro (vtkNeverTranslucentTexture, vtkOpenGLTexture)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Print the object state to the given output stream. More...
 
int IsTranslucent () override
 Always returns 0 (not translucent) to avoid the expensive per-pixel check. More...
 

Static Public Member Functions

static vtkNeverTranslucentTexture * New ()
 Create a new instance of vtkNeverTranslucentTexture. More...
 

Protected Member Functions

 vtkNeverTranslucentTexture ()
 Constructor. More...
 

Detailed Description

VTK Fix to speed up our image rendering.

The way we render images while changing the contrast via level/window extremely slows down rendering.

The cause of this slowdown is that VTK asks a texture (via a call to IsTranslucent) if it is translucent. When the texture refers to a lookup table this question is answered in a most expensive way: pushing every pixel through the lookup table to see whether it would render translucent.

We can speed this up extremely by always answering NO. 2D Image rendering in the context of MITK is still correct.

This class is injected into the VTK system by registering it with vtkObjectFactory as a replacement for vtkTexture.

We chose vtkOpenGLTexture as super class, because it seems that the other texture super class is deprecated: http://www.cmake.org/Wiki/VTK:How_I_mangled_Mesa

See also
ImageVtkMapper2D

Definition at line 49 of file vtkNeverTranslucentTexture.h.

Constructor & Destructor Documentation

◆ vtkNeverTranslucentTexture()

vtkNeverTranslucentTexture::vtkNeverTranslucentTexture ( )
protected

Constructor.

Member Function Documentation

◆ IsTranslucent()

int vtkNeverTranslucentTexture::IsTranslucent ( )
override

Always returns 0 (not translucent) to avoid the expensive per-pixel check.

This is the core fix: VTK normally pushes every pixel through the lookup table to determine translucency, which is extremely slow during level/window operations. By always returning 0, this check is bypassed entirely.

Returns
Always 0 (not translucent).
See also
ImageVtkMapper2D

◆ New()

static vtkNeverTranslucentTexture* vtkNeverTranslucentTexture::New ( )
static

Create a new instance of vtkNeverTranslucentTexture.

◆ PrintSelf()

void vtkNeverTranslucentTexture::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

Print the object state to the given output stream.

◆ vtkTypeMacro()

vtkNeverTranslucentTexture::vtkTypeMacro ( vtkNeverTranslucentTexture  ,
vtkOpenGLTexture   
)

The documentation for this class was generated from the following file: