[vtkusers] Memory leak in vtkImageReslice
Jothybasu Selvaraj
jothybasu at gmail.com
Tue Nov 29 00:08:02 EST 2016
Hi Guys
I am reslicing an image at several location continuously. Every time I
slice the image with the below code the memory increases.
I only thing I am skeptical about is reslice->SetInputData(this->ImageData);
Should this be SetInputConnection(this->ImageData.TakeReference()). But
this doesn't seem to work. this->ImageSlice is instantiated int he
constructor of the slicing class as vtkSmartPointer<vtkImageActor>New();
Any hints?
// Extract a slice in the desired orientation
vtkSmartPointer<vtkImageReslice>reslice =
vtkSmartPointer<vtkImageReslice>::New();
reslice->SetInputData(this->ImageData);
reslice->SetOutputDimensionality(2);
reslice->SetResliceAxes(resliceAxes);
reslice->SetInterpolationModeToCubic();
reslice->Update();
// Create a greyscale lookup table
vtkSmartPointer<vtkLookupTable> table =
vtkSmartPointer<vtkLookupTable>::New();
table->SetRange(this->WindowLow,this->WindowUp); // image intensity range
table->SetValueRange(0.0,1.0); // from black to white
table->SetSaturationRange(0,0); // no color saturation
table->SetRampToSCurve();
table->Build();
// Map the image through the lookup table
vtkSmartPointer<vtkImageMapToColors> color =
vtkSmartPointer<vtkImageMapToColors>::New();
color->SetLookupTable(table);
color->SetInputConnection(reslice->GetOutputPort());
color->Update();
this->ImageSlice->GetMapper()->SetInputConnection(color->GetOutputPort());
Thanks
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161129/49d194f3/attachment.html>
More information about the vtkusers
mailing list