1 #include "example_MPRViewer.h"
2 #include "ui_example_MPRViewer.h"
5 #include <vtkImageData.h>
7 // -------------------------------------------------------------------------
9 example_MPRViewer( int argc, char* argv[], QWidget* parent )
10 : Superclass( parent ),
11 m_UI( new Ui::example_MPRViewer )
13 this->m_UI->setupUi( this );
17 QMessageBox::critical(
19 QMessageBox::tr( "Error" ),
20 QMessageBox::tr( "Give some input image(s)." )
27 this->m_Interface.GuessAccesiblePlugins( );
30 this->m_Reader = this->m_Interface.Create( "IO", "ImageReader" );
31 if( this->m_Reader.IsNull( ) )
33 QMessageBox::critical(
35 QMessageBox::tr( "Error" ),
36 QMessageBox::tr( "\"IO::ImageReader\" creation failed." )
43 auto reader_params = this->m_Reader->GetParameters( );
44 for( int i = 1; i < argc; ++i )
45 reader_params->AddToOpenFileNameList( "FileNames", argv[ i ] );
46 this->m_Reader->Update( );
48 catch( itk::ExceptionObject& err1 )
50 QMessageBox::critical(
52 QMessageBox::tr( "Error" ),
53 QMessageBox::tr( err1.GetDescription( ) )
57 catch( std::exception& err2 )
59 QMessageBox::critical(
61 QMessageBox::tr( "Error" ),
62 QMessageBox::tr( err2.what( ) )
68 this->m_UI->Viewer->SetMainImage(
69 this->m_Reader->GetOutputData< vtkImageData >( "Output" )
73 // -------------------------------------------------------------------------