[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&nbsp; 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&nbsp;&nbsp; \
= /... get a&nbsp; vtkImageChangeInformation Filter from somewhere */<br>m_actor = \
vtkImageActor::New();<br> m_colormapper = vtkImageMapToColors::New();<br>m_lut = \
vtkLookupTable::New();<br><br><br>m_lut-&gt;SetHueRange(0.0, \
0.7);<br>&nbsp;&nbsp;&nbsp; m_lut-&gt;SetSaturationRange(0.7, \
0.7);<br>&nbsp;&nbsp;&nbsp; m_lut-&gt;SetValueRange(0.8,0.8);<br>&nbsp;&nbsp;&nbsp; \
m_lut-&gt;SetNumberOfColors(256);<br> &nbsp;&nbsp;&nbsp; \
m_lut-&gt;Build();<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;SetLookupTable(m_lut);<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;SetInputConnection(m_info-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;SetOutputFormatToRGBA();<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;DebugOn();<br> &nbsp;&nbsp;&nbsp; \
m_actor-&gt;SetInput(m_colormapper-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; \
m_renderer-&gt;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-&gt;UpdateWholeExtent();<br>&nbsp;&nbsp;&nbsp; \
double* l_range = m_info-&gt;GetOutput()-&gt;GetScalarRange();<br> &nbsp;&nbsp;&nbsp; \
m_info-&gt;Modified();<br>&nbsp;&nbsp;&nbsp; \
m_info-&gt;Update();<br>&nbsp;&nbsp;&nbsp; // TODO: is this step really necessary or \
is there an<br>&nbsp;&nbsp;&nbsp; // approach that does not change the \
pipeline.<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;RemoveAllInputs();<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;SetInputConnection(m_info-&gt;GetOutputPort());<br> \
&nbsp;&nbsp;&nbsp; m_lut-&gt;SetTableRange(l_range[0], \
l_range[1]);<br>&nbsp;&nbsp;&nbsp; m_lut-&gt;Build();<br>&nbsp;&nbsp;&nbsp; \
m_lut-&gt;Modified();<br>&nbsp;&nbsp;&nbsp; \
//m_colormapper-&gt;SetOutputFormatToRGBA();<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;UpdateWholeExtent();<br>&nbsp;&nbsp;&nbsp; \
m_info-&gt;Modified();<br> &nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;Modified();<br>&nbsp;&nbsp;&nbsp; \
m_info-&gt;Update();<br>&nbsp;&nbsp;&nbsp; \
m_colormapper-&gt;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