this->m_UI->actionOpenInputImage, SIGNAL( triggered( ) ),
this, SLOT( _triggered_actionOpenInputImage( ) )
);
+ QObject::connect(
+ this->m_UI->actionOpenSegmentation, SIGNAL( triggered( ) ),
+ this, SLOT( _triggered_actionOpenSegmentation( ) )
+ );
QObject::connect(
this->m_UI->actionOpenInputPolyData, SIGNAL( triggered( ) ),
this, SLOT( _triggered_actionOpenInputPolyData( ) )
);
}
+// -------------------------------------------------------------------------
+void ImageMPR::
+_triggered_actionOpenSegmentation( )
+{
+ // Show dialog and check if it was accepted
+ QFileDialog dialog( this );
+ dialog.setFileMode( QFileDialog::ExistingFiles );
+ dialog.setDirectory( tr( "." ) );
+ dialog.setNameFilter(
+ tr( "Medical image files (*.mhd *.bin *.dcm);;All files (*)" )
+ );
+ dialog.setDefaultSuffix( tr( "mhd" ) );
+ if( !( dialog.exec( ) ) )
+ return;
+
+ this->m_InputImage = NULL;
+
+ // Get a reader from plugins
+ TPluginFilter::Pointer reader =
+ this->m_Plugins.CreateProcessObject( this->m_ImageReaderClass );
+
+ // Configure reader
+ TParameters reader_params = reader->GetDefaultParameters( );
+ QStringList q_fnames = dialog.selectedFiles( );
+ QStringList::const_iterator qIt = q_fnames.begin( );
+ for( ; qIt != q_fnames.end( ); ++qIt )
+ reader_params.AddValueToStringList( "FileNames", qIt->toStdString( ) );
+ reader->SetParameters( reader_params );
+
+ // Execute and get error message, if any
+ QApplication::setOverrideCursor( Qt::WaitCursor );
+ this->setEnabled( false );
+ std::string err = reader->Update( );
+ QApplication::restoreOverrideCursor( );
+ this->setEnabled( true );
+
+ // Assign fresh image, if any
+ if( err == "" )
+ {
+ this->m_InputSegmentation = reader->GetOutput< TPluginImage >( 0 );
+ reader->DisconnectOutputs( );
+ if( this->m_InputSegmentation.IsNotNull( ) )
+ {
+ vtkImageData* vtk_id = this->m_InputSegmentation->GetVTKImageData( );
+ if( vtk_id != NULL )
+ {
+ /*
+ this->m_MPRObjects->SetImage( vtk_id );
+ this->m_MPRObjects->ResetCameras( );
+ this->m_MPRObjects->RenderAll( );
+ */
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error message" ),
+ tr( "Read image does not have a valid VTK converter." )
+ );
+
+ } // fi
+ }
+ else
+ QMessageBox::critical(
+ this,
+ tr( "Error reading single image" ),
+ tr( err.c_str( ) )
+ );
+}
+
// -------------------------------------------------------------------------
void ImageMPR::
_triggered_actionOpenInputPolyData( )
<x>0</x>
<y>0</y>
<width>718</width>
- <height>25</height>
+ <height>27</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<addaction name="actionOpenPlugins"/>
<addaction name="separator"/>
<addaction name="actionOpenInputImage"/>
+ <addaction name="actionOpenSegmentation"/>
<addaction name="actionOpenInputPolyData"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
<string>dasdasd</string>
</property>
</action>
+ <action name="actionOpenSegmentation">
+ <property name="text">
+ <string>Open segmentation</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>