[vtkusers] What is the order of calling delete methods on a pipeline?
chasank
chasank at gmail.com
Mon May 9 00:43:55 EDT 2011
Hi Peter,
I have designed a class containing many vtk objects, that's why I do not
want
to release memory resources by scope. The other vtk objects have to live.
I want to release only volume rendering pipeline on runtime. How can I do it
safely?
Thanks!
Peter F Bradshaw wrote:
>
> Hi Chasan;
>
> If you wish to release the pipeline below why not encase it in its own
> scope? If you are using vtkSmartPointer, which you are, then the
> pipeline will be destroyed when it goes out of scope.
>
> On Sat, 7 May 2011, Chasan KIOUTSOUKMOUSTAFA wrote:
>
>> 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();
>>
>
> Cheers
>
> --
> Peter F Bradshaw: http://www.exadios.com (public keys avaliable there).
> Personal site: http://personal.exadios.com
> "I love truth, and the way the government still uses it occasionally to
> keep us guessing." - Sam Kekovich.
> _______________________________________________
> Powered by 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
>
--
View this message in context: http://vtk.1045678.n5.nabble.com/What-is-the-order-of-calling-delete-methods-on-a-pipeline-tp4378671p4381076.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list