[vtkusers] Do I really need to call RemoveAllInputs ?

Oliver Kania ptw.freiburg at googlemail.com
Wed Jul 30 09:53:14 EDT 2008


Hello dear VTK-users,
I have an example using a VTKImageMapToColors
and a vtkImageChangeInfo filter that  only works when I remove
all inputs from the mapper and add the input again.

First, the code that initializes the pipeline:
---------------------------------------------------------------------------------------------------------
m_Info   = /... get a  vtkImageChangeInformation Filter from somewhere */
m_actor = vtkImageActor::New();
m_colormapper = vtkImageMapToColors::New();
m_lut = vtkLookupTable::New();


m_lut->SetHueRange(0.0, 0.7);
    m_lut->SetSaturationRange(0.7, 0.7);
    m_lut->SetValueRange(0.8,0.8);
    m_lut->SetNumberOfColors(256);
    m_lut->Build();
    m_colormapper->SetLookupTable(m_lut);
    m_colormapper->SetInputConnection(m_info->GetOutputPort());
    m_colormapper->SetOutputFormatToRGBA();
    m_colormapper->DebugOn();
    m_actor->SetInput(m_colormapper->GetOutput());
    m_renderer->AddActor(m_actor);
---------------------------------------------------------------------------------------------------------

Now, the image-data that is used by the Info-Filter changes and the
following sequence is called:

---------------------------------------------------------------------------------------------------------
m_info->UpdateWholeExtent();
    double* l_range = m_info->GetOutput()->GetScalarRange();
    m_info->Modified();
    m_info->Update();
    // TODO: is this step really necessary or is there an
    // approach that does not change the pipeline.
    m_colormapper->RemoveAllInputs();
    m_colormapper->SetInputConnection(m_info->GetOutputPort());
    m_lut->SetTableRange(l_range[0], l_range[1]);
    m_lut->Build();
    m_lut->Modified();
    //m_colormapper->SetOutputFormatToRGBA();
    m_colormapper->UpdateWholeExtent();
    m_info->Modified();
    m_colormapper->Modified();
    m_info->Update();
    m_colormapper->Update();
---------------------------------------------------------------------------------------------------------

My question is: Do I really need to remove all inputs ?
(I tried to use Modified() and Update() everywhere )
Are there any unnecessary operations I am doing ?

Best regards, Oliver.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080730/6b2932c9/attachment.htm>


More information about the vtkusers mailing list