[vtkusers] vtk class error
Jothy
jothybasu at gmail.com
Thu Oct 7 16:42:58 EDT 2010
Hi Guys,
I am trying to create a c++ class to read a dicom image set. But,my app is
crashing with out any errors during building.
here is the header and source of that class, I am using Qt creator.
Header:
#ifndef MYDCMIMPORTER_H
#define MYDCMIMPORTER_H
#include<vtkImageData.h>
#include<QString>
class myDcmImporter
{
public:
myDcmImporter();
vtkImageData* imageData;
vtkImageData* readImage();
};
#endif // MYDCMIMPORTER_H
Source:
#include "mydcmimporter.h"
#include<QFileDialog>
#include<QString>
#include<vtkDICOMImageReader.h>
#include<vtkSmartPointer.h>
#include<QDebug>
myDcmImporter::myDcmImporter()
{
}
vtkImageData* myDcmImporter::readImage()
{
QString imageDirName=QFileDialog::getExistingDirectory();
vtkSmartPointer <vtkDICOMImageReader> reader=
vtkSmartPointer<vtkDICOMImageReader>::New();
reader->SetDirectoryName(imageDirName.toLatin1());
reader->Update();
this->imageData= reader->GetOutput();
}
App crashes only while executing
myDcmImporter dcmImporter;
dcmImporter.readImage();
// vtkImageData *img=dcmImporter.imageData;
int dims[3];
dcmImporter.imageData->GetDimensions(dims);
// dcmImporter.imageData->GetDimensions(dims);
qDebug()<<dims[0]<<"running...";
Since I am new to c++, could be a silly mistake somewhere.
Thank you
Jothy
--
Research Scholar
Dept. of Medical Physics
Clatterbridge Centre for Oncology
UK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101007/197c5c95/attachment.htm>
More information about the vtkusers
mailing list