[Insight-users] About DICOM loading with VTK, ITK and QT

Xiaopeng Yang yxp233 at postech.ac.kr
Tue Jun 15 06:23:55 EDT 2010


Dear ITK users,

 

 I made a simple UI with QT for loading a DICOM image by ITK and visualize
it by VTK. Even I successfully debugged the code, but when I ran the
executable file, errors occurred: "An unhandled win32 exception occurred in
SimpleView.exe [448]". Could you help me to check whether there is any
problem in my code?

 

SimpleView::SimpleView() 

{

  this->ui = new Ui_SimpleView;

this->ui->setupUi(this);

 

//Define ITK DICOM loader

  typedef itk::Image <unsigned short, 2> ImageType;

  typedef itk::ImageFileReader<ImageType>ReaderType;

 

  //Connect ITK to VTK

  typedef itk::ImageToVTKImageFilter<ImageType>FilterType;

 

  ReaderType::Pointer reader = ReaderType::New();

  FilterType::Pointer connector = FilterType::New();

  reader->SetFileName("C:/Documents and Settings/edt/Desktop/QT
Test3/ImageViewer/DICOM/portal47.dcm");

  connector->SetInput(reader->GetOutput());

 

vtkImageViewer *viewer = vtkImageViewer::New();

 

  this->ui->qvtkWidget_2->SetRenderWindow(viewer->GetRenderWindow());

 
viewer->SetupInteractor(this->ui->qvtkWidget_2->GetRenderWindow()->GetIntera
ctor());

  viewer->SetInput(connector->GetOutput());

  viewer->Render();

  viewer->SetColorLevel(255);

viewer->SetColorWindow(128);

  

  connect(this->ui->actionOpenFile, SIGNAL(triggered()), this,
SLOT(slotOpenFile()));

  connect(this->ui->actionExit, SIGNAL(triggered()), this,
SLOT(slotExit()));

};

 

 

Thanks.

 

Xiaopeng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100615/8dd35871/attachment.htm>


More information about the Insight-users mailing list