[vtkusers] Value-independent blending

speedy markenjodsalz at gmx.net
Wed Apr 18 11:44:03 EDT 2012


Hi, 
I've been trying for days to figure this one out. My GUI contains a QVTK
widget and a vtkImageViewer2 to display a CT image. I'd like to superpose a
binary segmentation to that image. The binary segmentation contains values
of -1, 0 and 1. I need all pixels of value -1 to be coloured red, the +1
ones to be coloured green, and the zeroes should be "invisible". I can do
all this using a vtkLookupTable:

  m_LookupTableLabels = vtkSmartPointer<vtkLookupTable>::New();
  m_LookupTableLabels->SetNumberOfTableValues( 3 );
  m_LookupTableLabels->SetTableRange(-1.0,1.0);
  m_LookupTableLabels->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 ); //label 0 is
transparent
  m_LookupTableLabels->SetTableValue( 1, 1.0, 0.0, 0.0, 1.0 ); //label 1 is
opaque and red
  m_LookupTableLabels->SetTableValue( 2, 0.0, 1.0, 0.0, 1.0 ); //label 2 is
opaque and green

  m_MapColorLabels = vtkSmartPointer<vtkImageMapToColors>::New();
  m_MapColorLabels->SetLookupTable( m_LookupTableLabels );

  m_ImageBlend = vtkSmartPointer<vtkImageBlend>::New();
  m_ImageBlend->AddInputConnection( 0, m_MapColorLabels->GetOutputPort() );

The problem is that all of the segmentation is invisible now because of the
low values. I have to apply a threshold operation to adapt the -1/+1 values
to the maximum and maximum-1 values of the CT image because here the values
range up to about 3000. This problem I can fix using a
vtkColorTransferFunction instead of the LUT; it displays the segmentation
with full intensity without the thresholding. However, I haven't found a way
to make the zero-values transparent since vtkImageMapToColors does not
support setting a vtkPiecewiseFunction.. 

So, to sum up: Is there a way to display the segmentation with full
intensity without changing the data itself?

Thanks for your time!
Falk

--
View this message in context: http://vtk.1045678.n5.nabble.com/Value-independent-blending-tp5649489p5649489.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list