[vtkusers] What is the order of calling delete methods on a pipeline?

Chasan KIOUTSOUKMOUSTAFA chasank at gmail.com
Sat May 7 12:49:51 EDT 2011


I have a volume rendering pipeline and I want to release all the memory
resources of pipeline on runtime .
How can I release memory resources of the pipeline safely?
It seems the iren is the end of pipeline, if I call the iren->Delete(), will
it delete recursively all of the pipeline?
What is the solution ? Pipeline is below. Thanks for answers!!

    renderer = vtkSmartPointer < vtkRenderer > :: New();
    renderWindow = vtkSmartPointer < vtkWin32OpenGLRenderWindow > :: New();
    renderWindow->AddRenderer(renderer);
    renderWindow->SetSize(width, height);

    iren = vtkSmartPointer < vtkWin32RenderWindowInteractor > :: New();
    iren->SetRenderWindow(renderWindow);

    volumeMapper = vtkSmartPointer<vtkFixedPointVolumeRayCastMapper>::New();
    volumeMapper->SetInputConnection(reader->GetOutputPort());
    volumeMapper->SetBlendModeToComposite();

    volumeColor = vtkSmartPointer<vtkColorTransferFunction>::New();
    volumeColor->AddRGBPoint(0,    0.0, 0.0, 0.0);
    volumeColor->AddRGBPoint(500,  1.0, 0.5, 0.3);
    volumeColor->AddRGBPoint(1000, 1.0, 0.5, 0.3);
    volumeColor->AddRGBPoint(1150, 1.0, 1.0, 0.9);

    volumeScalarOpacity =  vtkSmartPointer<vtkPiecewiseFunction>::New();
    volumeScalarOpacity->AddPoint(0,    0.00);
    volumeScalarOpacity->AddPoint(500,  0.15);
    volumeScalarOpacity->AddPoint(1000, 0.15);
    volumeScalarOpacity->AddPoint(1150, 0.90);

    volumeGradientOpacity = vtkSmartPointer<vtkPiecewiseFunction>::New();
    volumeGradientOpacity->AddPoint(0,   0.0);
    volumeGradientOpacity->AddPoint(90,  0.5);
    volumeGradientOpacity->AddPoint(100, 1.0);

    volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
    volumeProperty->SetColor(volumeColor);
    volumeProperty->SetScalarOpacity(volumeScalarOpacity);
    volumeProperty->SetGradientOpacity(volumeGradientOpacity);
    volumeProperty->SetInterpolationTypeToLinear();
    volumeProperty->ShadeOff();
    volumeProperty->SetAmbient(0.4);
    volumeProperty->SetDiffuse(0.6);
    volumeProperty->SetSpecular(0.2);

    LODProperty = vtkSmartPointer <vtkLODProp3D>::New();
    int id = LODProperty->AddLOD(volumeMapper, volumeProperty, 0.0);
    LODProperty->SetLODLevel(id, 0.0);

    renderer->AddViewProp(LODProperty);
    renderer->ResetCamera();
    renderer->Render();

    iren->Initialize();

-- 
Chasan KIOUTSOUKMOUSTAFA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110507/13fca9b9/attachment.htm>


More information about the vtkusers mailing list