[vtkusers] Memory management
Jothybasu Selvaraj
jothybasu at gmail.com
Fri Apr 15 01:55:55 EDT 2016
Dear All
I am not familiar with c++, so I would like to have your suggestion in
memory management in VTK/Qt.
I have a class to read a series of CT images constructed like this
DICOMReader::DICOMReader(QWidget *parent)
{
this->ImageSet=vtkSmartPointer<vtkImageData>::New();
}
DICOMReader::~DICOMReader()
{
}
void DICOMReader::readImageSeries()
{//reading code goes here, only the last filter is shown here
typedef itk::ImageToVTKImageFilter<InputImageType> ConnectorType;
ConnectorType::Pointer Converter = ConnectorType::New();
Converter->SetInput(reader->GetOutput());
Converter->Update();
this->ImageSet=Converter->GetOutput();
}
then I pass this image to a viewer class like this:
//Read image
DICOMReader *reader=new DICOMReader(this);
reader->readImageSeries();
ImageViewer2D *ViewerEBRT= new ImageViewer2D();
ViewerEBRT->SetImageData(reader->ImageSet);
SetImageData is defined as
void ImageViewer2D::SetImageData(vtkImageData *Img)
{
this->ImageData=Img;
}
Looks likes there is some silly mistake they way data is passed on.
Can anyone suggest me a better way.
Thanks
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160415/96ca7fe0/attachment.html>
More information about the vtkusers
mailing list