Hi Felix,
your code looks good, but in the end some information is missing. You set the 
LUT to the LookupTableProperty and do you set the LookupTableProperty to the 
respective Data Node?

I did something similar (with LUT) for surfaces, maybe you want to try setting 
the properties in your DataNode.

    mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
    mitkLut->SetVtkLookupTable(vtkLut);

    mitk::LookupTableProperty::Pointer mitkLutProp = 
mitk::LookupTableProperty::New(mitkLut);

    mitk::DataNode::Pointer resultSurfaceNode = mitk::DataNode::New();
    resultSurfaceNode->SetProperty( "LookupTable", mitkLutProp);
    resultSurfaceNode->SetBoolProperty("use color",false);
    resultSurfaceNode->SetBoolProperty("scalar visibility", true);
    resultSurfaceNode->SetFloatProperty("ScalarsRangeMaximum", max);
    resultSurfaceNode->SetFloatProperty("ScalarsRangeMinimum", min);
    resultSurfaceNode->SetData(resultSurface);
    resultSurfaceNode->SetName("ResultSurface");
    resultSurfaceNode->Update();
    this->GetDataStorage()->Add(resultSurfaceNode);

Let me know if this helps you, if not I need to investigate this issue in 
detail.

Best regards
Sven


Von: Félix C. Morency [mailto:[email protected]]
Gesendet: Freitag, 15. Februar 2013 17:51
An: [email protected]
Betreff: [mitk-users] LUT and LevelWindow to highlight voxel range

Hi list,

I am trying to highlight a specific voxel range using LevelWindow and custom 
LUT function but without any luck. I would like the values between the [a, b] 
range to display in red and the values [imgMin, a[ and ]b, imgMax] to be 
transparent. The image voxels are scalars.

First, I set my level to (a+b/2.0) and my window to (b-a). I build a custom LUT 
that looks like the following

  vtkColorTransferFunction* vtkColorFct = vtkColorTransferFunction::New();
  vtkColorFct->AddRGBSegment(m_LowerBound, 0., 0., 0.,
    lower, 0., 0., 0.);
  vtkColorFct->AddRGBSegment(lower, 1., 0., 0.,
    upper, 1., 0., 0.);
  vtkColorFct->AddRGBSegment(upper, 1., 0., 0.,
    m_UpperBound, 1., 0., 0.);

  vtkPiecewiseFunction* vtkOpacity = vtkPiecewiseFunction::New();
  vtkOpacity->AddPoint(m_LowerBound, 0.);
  vtkOpacity->AddPoint(lower-0.001, 0.);
  vtkOpacity->AddPoint(lower, 1.);
  vtkOpacity->AddPoint(upper, 1.);
  vtkOpacity->AddPoint(upper+0.001, 0.);
  vtkOpacity->AddPoint(m_UpperBound, 0.);

  mitk::LookupTable::Pointer lt = mitk::LookupTable::New();
  lt->CreateColorTransferFunction(vtkColorFct);
  lt->CreateOpacityTransferFunction(vtkOpacity);
  lt->CreateGradientTransferFunction(vtkOpacity);

and set the LookupTable property accordingly. However, it doesn't display as 
expected (mostly garbage). I also built another custom LUT using

  vtkSmartPointer<vtkLookupTable> vtkLUT = 
vtkSmartPointer<vtkLookupTable>::New();
  vtkLUT->SetTableRange(lower, upper);
  vtkLUT->SetNumberOfTableValues(2);
  vtkLUT->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 );
  vtkLUT->SetTableValue( 1, 1.0, 0.0, 0.0, 1.0 );
  vtkLUT->Build();

but it also doesn't work because the values higher than upper are clamped to 
the maximum display value.

Any hints? Is this the right approach to achieve this?

Regards,
--
Félix C. Morency, M.Sc.
Plateforme d’analyse et de visualisation d’images
Centre Hospitalier Universitaire de Sherbrooke
Centre de recherche clinique Étienne-Le Bel
Local Z5-3031 | 819.346.1110 ext 16634<tel:819.346.1110%20ext%2016634>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to