<div dir="ltr">Hello dear VTK-users,<br>I have an example using a VTKImageMapToColors<br>and a vtkImageChangeInfo filter that only works when I remove<br>all inputs from the mapper and add the input again.<br><br>First, the code that initializes the pipeline:<br>
---------------------------------------------------------------------------------------------------------<br>m_Info = /... get a vtkImageChangeInformation Filter from somewhere */<br>m_actor = vtkImageActor::New();<br>
m_colormapper = vtkImageMapToColors::New();<br>m_lut = vtkLookupTable::New();<br><br><br>m_lut->SetHueRange(0.0, 0.7);<br> m_lut->SetSaturationRange(0.7, 0.7);<br> m_lut->SetValueRange(0.8,0.8);<br> m_lut->SetNumberOfColors(256);<br>
m_lut->Build();<br> m_colormapper->SetLookupTable(m_lut);<br> m_colormapper->SetInputConnection(m_info->GetOutputPort());<br> m_colormapper->SetOutputFormatToRGBA();<br> m_colormapper->DebugOn();<br>
m_actor->SetInput(m_colormapper->GetOutput());<br> m_renderer->AddActor(m_actor);<br>---------------------------------------------------------------------------------------------------------<br><br>Now, the image-data that is used by the Info-Filter changes and the<br>
following sequence is called:<br><br>---------------------------------------------------------------------------------------------------------<br>m_info->UpdateWholeExtent();<br> double* l_range = m_info->GetOutput()->GetScalarRange();<br>
m_info->Modified();<br> m_info->Update();<br> // TODO: is this step really necessary or is there an<br> // approach that does not change the pipeline.<br> m_colormapper->RemoveAllInputs();<br> m_colormapper->SetInputConnection(m_info->GetOutputPort());<br>
m_lut->SetTableRange(l_range[0], l_range[1]);<br> m_lut->Build();<br> m_lut->Modified();<br> //m_colormapper->SetOutputFormatToRGBA();<br> m_colormapper->UpdateWholeExtent();<br> m_info->Modified();<br>
m_colormapper->Modified();<br> m_info->Update();<br> m_colormapper->Update();<br>---------------------------------------------------------------------------------------------------------<br><br>My question is: Do I really need to remove all inputs ?<br>
(I tried to use Modified() and Update() everywhere )<br>Are there any unnecessary operations I am doing ?<br><br>Best regards, Oliver.<br><br><br><br><br><br></div>