[vtkusers] vtk pipeline problem
Johnson
jgadel2 at uic.edu
Thu Jun 27 19:21:43 EDT 2013
I followed your suggestion, I created the pipeline outside, updated the
labels ID that should be visualized in the loop, this have affected two
steps: the threshold and the MarchingCubes
threshold->ThresholdBetween(lblValues(i),lblValues(i));
mcubes->SetValue(0,lblValues(i));
I then update the last step which is the stripper:
stripper->Update();
At each instant of the loop I create a mapper and an actor
vtkSmartPointer<vtkPolyDataMapper> isoMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
isoMapper->SetInputConnection(stripper->GetOutputPort());
isoMapper->ScalarVisibilityOff();
isoMapper->ReleaseDataFlagOn();
// create actor
vtkSmartPointer<vtkActor> isoActor = vtkSmartPointer<vtkActor>::New();
isoActor->SetMapper(isoMapper);
QColor c = ctable.at(lblValues(i)); // set a color for the actor
isoActor->GetProperty()->SetColor(c.red()/255.0,c.green()/255.0,c.blue()/255.0);
lblsActors.append(isoActor); // save the actor in a list to control it later
MainRenderer->AddActor(isoActor); // add the actor to the renderer
vtkWidget->GetRenderWindow()->Render(); // render
I have also removed the memory clearing part as you suggested, the memory issue is fixed, but the labels are created then disappear from the visualization, also the actors that I save in the lblsActor list
can not be controllable anymore. I believe you are correct in getting the pipeline outside the loop, however, I don't know the correct steps to make
the visualization work.
Regards
Johnson
On 6/27/2013 5:25 PM, Shawn Waldon wrote:
> Unfortunately that is as much as I know. I found it a few weeks ago
> here:
> http://www.vtk.org/Wiki/VTK/FAQ#Using_ReleaseDataFlag
>
> You should not need to clear the input with NULL as far as I know, but
> keep in mind that the filter is set to delete its output, not its
> input. So you would need to set the flag on the filter that is
> creating the brain3D in order to have the brain3D output data deleted.
>
> If you are declaring the same pipeline each time through the loop, you
> may be able to set up the pipeline initially and have the loop only
> feed it different input data each time, modify parameters on filters
> (remember to call Update()) and do something with the output.
> However, depending on what you are doing with the resulting data you
> may need to copy the output if using this approach.
>
> Shawn
>
>
> On Thu, Jun 27, 2013 at 6:05 PM, johnsonjonaris <jgadel2 at uic.edu
> <mailto:jgadel2 at uic.edu>> wrote:
>
> HI
> Thanks Shawn for your reply, that was quick.
> I tried to do as you suggested with no luck :(
> for example, I did the following for the vtkImageThreshold filter:
>
> threshold = vtkSmartPointer<vtkImageThreshold>::New();
> threshold->ThresholdBetween(lblValues(i),lblValues(i)); // lblValues
> is a vector of the labels
> threshold->SetOutValue(0);
> threshold->SetInput(brain3D);
> threshold->ReleaseDataFlagOn();
>
> Note that every time in the loop I declare the pipeline elements
> with New()
> Also, at the end of the loop I need to clear the input with NULL
> in order to
> clean the memory.
> Any suggestions ?
> Regards
>
>
>
>
> -----
> Johnson Jonaris
> PhD Candidate
> Electrical & Computer Eng
> University of IL at Chicago
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/vtk-pipeline-problem-tp5721639p5721642.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130627/24d5f8c0/attachment.htm>
More information about the vtkusers
mailing list