[prev in list] [next in list] [prev in thread] [next in thread]
List: vtkusers
Subject: [vtkusers] Do I really need to call RemoveAllInputs ?
From: "Oliver Kania" <ptw.freiburg () googlemail ! com>
Date: 2008-07-30 13:53:14
Message-ID: e22fb1100807300653h3a38e1fdw474f39afdd9a4573 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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.
[Attachment #5 (text/html)]
<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>
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic