// -------------------------------------------------------------------------
MainWnd::MainWnd( QWidget* parent )
+{}
+ /*
: QMainWindow( parent ),
m_UI( new Ui::MainWnd ),
m_InputImage( NULL ),
- m_SegmentedImage( NULL )
+ m_SegmentedImage( NULL ),
+ m_ActivePlugin( NULL ),
+ m_ActiveParameters( NULL ),
+ m_ActivePluginType( Self::NonePluginType ),
+ m_ActivePluginCategory( Self::NonePluginCategory )
{
this->m_UI->setupUi( this );
this->m_PluginsConfigurationFile = "idms.plugins";
this->_LoadApplicationPreferences( );
- // Create and associate renderers
- this->m_3DRenderer = vtkSmartPointer< vtkRenderer >::New( );
- this->m_XPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
- this->m_YPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
- this->m_ZPlaneRenderer = vtkSmartPointer< vtkRenderer >::New( );
- this->m_AuxRenderer = vtkSmartPointer< vtkRenderer >::New( );
- this->m_3DRenderer->SetBackground( 0.2, 0.2, 0.2 );
- this->m_XPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
- this->m_YPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
- this->m_ZPlaneRenderer->SetBackground( 0.1, 0.3, 0.8 );
- this->m_AuxRenderer->SetBackground( 0.1, 0.3, 0.8 );
- this->m_UI->m_3DVTK->GetRenderWindow( )->
- AddRenderer( this->m_3DRenderer );
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->
- AddRenderer( this->m_XPlaneRenderer );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->
- AddRenderer( this->m_YPlaneRenderer );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->
- AddRenderer( this->m_ZPlaneRenderer );
- this->m_UI->m_AuxVTK->GetRenderWindow( )->
- AddRenderer( this->m_AuxRenderer );
-
- // Configure MPR actors
- this->m_ImageActors = vtkSmartPointer< idms::VolumeActors >::New( );
-
- // Interaction styles
- this->m_XStyle = vtkSmartPointer< idms::InteractorStyleImage >::New( );
- this->m_YStyle = vtkSmartPointer< idms::InteractorStyleImage >::New( );
- this->m_ZStyle = vtkSmartPointer< idms::InteractorStyleImage >::New( );
- this->m_XStyle->Configure( this->m_ImageActors, 0 );
- this->m_YStyle->Configure( this->m_ImageActors, 1 );
- this->m_ZStyle->Configure( this->m_ImageActors, 2 );
- this->m_UI->m_XPlaneVTK->GetInteractor( )->
- SetInteractorStyle( this->m_XStyle );
- this->m_UI->m_YPlaneVTK->GetInteractor( )->
- SetInteractorStyle( this->m_YStyle );
- this->m_UI->m_ZPlaneVTK->GetInteractor( )->
- SetInteractorStyle( this->m_ZStyle );
+ // Create MPR objects
+ this->m_MPR = new TMPR(
+ this->m_UI->m_XPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_YPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_ZPlaneVTK->GetRenderWindow( ),
+ this->m_UI->m_3DVTK->GetRenderWindow( )
+ );
+
+ // Associate observer
+ this->m_DoubleClickCommand =
+ vtkSmartPointer< DoubleClickCommand >::New( );
+ this->m_DoubleClickCommand->SetMainWnd( this );
+ // this->m_MPR->AddDoubleClickObserver( this->m_DoubleClickCommand );
// Orientation marks
- vtkSmartPointer< vtkAnnotatedCubeActor > oCube =
- vtkSmartPointer< vtkAnnotatedCubeActor >::New( );
- oCube->GetCubeProperty( )->SetColor( 0.9, 0.7, 0.2 );
- oCube->GetTextEdgesProperty( )->SetLineWidth( 1 );
- oCube->GetTextEdgesProperty( )->SetDiffuse( 0 );
- oCube->GetTextEdgesProperty( )->SetAmbient( 1 );
- oCube->GetTextEdgesProperty( )->SetColor( 0.18, 0.28, 0.23 );
- oCube->GetXPlusFaceProperty( )->SetColor( 1, 0, 0 );
- oCube->GetXPlusFaceProperty( )->SetInterpolationToFlat( );
- oCube->GetXMinusFaceProperty( )->SetColor( 1, 0, 0 );
- oCube->GetXMinusFaceProperty( )->SetInterpolationToFlat( );
- oCube->GetYPlusFaceProperty( )->SetColor( 0, 1, 0 );
- oCube->GetYPlusFaceProperty( )->SetInterpolationToFlat( );
- oCube->GetYMinusFaceProperty( )->SetColor( 0, 1, 0 );
- oCube->GetYMinusFaceProperty( )->SetInterpolationToFlat( );
- oCube->GetZPlusFaceProperty( )->SetColor( 0, 0, 1 );
- oCube->GetZPlusFaceProperty( )->SetInterpolationToFlat( );
- oCube->GetZMinusFaceProperty( )->SetColor( 0, 0, 1 );
- oCube->GetZMinusFaceProperty( )->SetInterpolationToFlat( );
-
- vtkSmartPointer< vtkAxesActor > oAxes =
- vtkSmartPointer< vtkAxesActor >::New( );
- oAxes->AxisLabelsOff( );
- oAxes->SetShaftTypeToCylinder( );
- oAxes->SetTotalLength( 2.5, 2.5, 2.5 );
-
- vtkSmartPointer< vtkPropAssembly > oActors =
- vtkSmartPointer< vtkPropAssembly >::New( );
- oActors->AddPart( oCube );
- oActors->AddPart( oAxes );
-
- this->m_3DOrientationWidget =
- vtkSmartPointer< vtkOrientationMarkerWidget >::New( );
- this->m_3DOrientationWidget->SetOutlineColor( 0.93, 0.57, 0.13 );
- this->m_3DOrientationWidget->SetOrientationMarker( oActors );
- this->m_3DOrientationWidget->SetViewport( 0.0, 0.0, 0.2, 0.2 );
-
- // Add actors, widgets, stuff, ...
- this->m_3DOrientationWidget->
- SetInteractor( this->m_UI->m_3DVTK->GetInteractor( ) );
- this->m_3DOrientationWidget->SetEnabled( 1 );
- this->m_3DOrientationWidget->InteractiveOff( );
+ vtkSmartPointer< vtkAnnotatedCubeActor > oCube =
+ vtkSmartPointer< vtkAnnotatedCubeActor >::New( );
+ oCube->GetCubeProperty( )->SetColor( 0.9, 0.7, 0.2 );
+ oCube->GetTextEdgesProperty( )->SetLineWidth( 1 );
+ oCube->GetTextEdgesProperty( )->SetDiffuse( 0 );
+ oCube->GetTextEdgesProperty( )->SetAmbient( 1 );
+ oCube->GetTextEdgesProperty( )->SetColor( 0.18, 0.28, 0.23 );
+ oCube->GetXPlusFaceProperty( )->SetColor( 1, 0, 0 );
+ oCube->GetXPlusFaceProperty( )->SetInterpolationToFlat( );
+ oCube->GetXMinusFaceProperty( )->SetColor( 1, 0, 0 );
+ oCube->GetXMinusFaceProperty( )->SetInterpolationToFlat( );
+ oCube->GetYPlusFaceProperty( )->SetColor( 0, 1, 0 );
+ oCube->GetYPlusFaceProperty( )->SetInterpolationToFlat( );
+ oCube->GetYMinusFaceProperty( )->SetColor( 0, 1, 0 );
+ oCube->GetYMinusFaceProperty( )->SetInterpolationToFlat( );
+ oCube->GetZPlusFaceProperty( )->SetColor( 0, 0, 1 );
+ oCube->GetZPlusFaceProperty( )->SetInterpolationToFlat( );
+ oCube->GetZMinusFaceProperty( )->SetColor( 0, 0, 1 );
+ oCube->GetZMinusFaceProperty( )->SetInterpolationToFlat( );
+
+ vtkSmartPointer< vtkAxesActor > oAxes =
+ vtkSmartPointer< vtkAxesActor >::New( );
+ oAxes->AxisLabelsOff( );
+ oAxes->SetShaftTypeToCylinder( );
+ oAxes->SetTotalLength( 2.5, 2.5, 2.5 );
+
+ vtkSmartPointer< vtkPropAssembly > oActors =
+ vtkSmartPointer< vtkPropAssembly >::New( );
+ oActors->AddPart( oCube );
+ oActors->AddPart( oAxes );
+
+ this->m_3DOrientationWidget =
+ vtkSmartPointer< vtkOrientationMarkerWidget >::New( );
+ this->m_3DOrientationWidget->SetOutlineColor( 0.93, 0.57, 0.13 );
+ this->m_3DOrientationWidget->SetOrientationMarker( oActors );
+ this->m_3DOrientationWidget->SetViewport( 0.0, 0.0, 0.2, 0.2 );
+
+ // Add actors, widgets, stuff, ...
+ this->m_3DOrientationWidget->
+ SetInteractor( this->m_UI->m_3DVTK->GetInteractor( ) );
+ this->m_3DOrientationWidget->SetEnabled( 1 );
+ this->m_3DOrientationWidget->InteractiveOff( );
// Qt signals <-> slots
IDMS_QT_ACTION( ReloadPlugins );
// Start: load all disponible plugins
this->_triggered_actionReloadPlugins( );
}
-
+*/
// -------------------------------------------------------------------------
MainWnd::
~MainWnd( )
{
- // Close all connections
- this->m_Plugins.UnloadAll( );
-
- // Delete objects
- delete this->m_UI;
- if( this->m_InputImage != NULL ) delete this->m_InputImage;
- if( this->m_SegmentedImage != NULL ) delete this->m_SegmentedImage;
+// // Close all connections
+// this->m_Plugins.UnloadAll( );
+
+// // Delete objects
+// delete this->m_UI;
+// // delete this->m_MPR;
+// if( this->m_ActiveParameters != NULL )
+// {
+// this->m_ActiveParameters->close( );
+// delete this->m_ActiveParameters;
+
+// } // fi
+// if( this->m_ActivePlugin != NULL ) delete this->m_ActivePlugin;
+// if( this->m_InputImage != NULL ) delete this->m_InputImage;
+// if( this->m_SegmentedImage != NULL ) delete this->m_SegmentedImage;
}
// -------------------------------------------------------------------------
void MainWnd::
_LoadApplicationPreferences( )
{
- this->m_ApplicationPreferences.clear( );
- std::ifstream in( this->m_ApplicationPreferencesFile.c_str( ) );
- if( in )
- {
- std::string line;
- std::getline( in, line );
- while( !( in.eof( ) ) )
- {
- long pos = line.find_last_of( "=" );
- std::string key = line.substr( 0, pos );
- std::string value = line.substr( pos + 1 );
- key.erase(
- std::remove_if( key.begin( ), key.end( ), isspace ), key.end( )
- );
- value.erase(
- std::remove_if( value.begin( ), value.end( ), isspace ), value.end( )
- );
- this->m_ApplicationPreferences[ key ] = value;
- std::getline( in, line );
-
- } // elihw
- }
- else
- {
- this->m_ApplicationPreferences[ "data_dimensions" ] = "3";
- this->m_ApplicationPreferences[ "input_image_type" ] = "short";
- this->m_ApplicationPreferences[ "segmented_image_type" ] = "uchar";
- this->m_ApplicationPreferences[ "mesh_type" ] = "double";
-
- } // fi
- in.close( );
+// this->m_ApplicationPreferences.clear( );
+// std::ifstream in( this->m_ApplicationPreferencesFile.c_str( ) );
+// if( in )
+// {
+// std::string line;
+// std::getline( in, line );
+// while( !( in.eof( ) ) )
+// {
+// long pos = line.find_last_of( "=" );
+// std::string key = line.substr( 0, pos );
+// std::string value = line.substr( pos + 1 );
+// key.erase(
+// std::remove_if( key.begin( ), key.end( ), isspace ), key.end( )
+// );
+// value.erase(
+// std::remove_if( value.begin( ), value.end( ), isspace ), value.end( )
+// );
+// this->m_ApplicationPreferences[ key ] = value;
+// std::getline( in, line );
+
+// } // elihw
+// }
+// else
+// {
+// this->m_ApplicationPreferences[ "data_dimensions" ] = "3";
+// this->m_ApplicationPreferences[ "input_image_type" ] = "short";
+// this->m_ApplicationPreferences[ "segmented_image_type" ] = "uchar";
+// this->m_ApplicationPreferences[ "mesh_type" ] = "double";
+
+// } // fi
+// in.close( );
}
// -------------------------------------------------------------------------
MainWnd::
-TPluginData* MainWnd::
+TPluginImage* MainWnd::
_LoadImage( const std::string& image_type, const std::string& image_dim )
{
-/*
- // Show dialog and check if it was accepted
- QFileDialog dialog( this );
- dialog.setFileMode( QFileDialog::ExistingFiles );
- dialog.setDirectory( tr( this->m_LastOpenedFile.c_str( ) ) );
- dialog.setNameFilter(
- tr( "Medical image files (*.mhd *.bin *.dcm);;All files (*)" )
- );
- dialog.setDefaultSuffix( tr( "mhd" ) );
- if( !( dialog.exec( ) ) )
- return( NULL );
-
- TPluginData* ret = NULL;
- unsigned int nFiles = dialog.selectedFiles( ).size( );
- if( nFiles == 1 )
- {
- if( this->m_ImageReaderClassName == "" )
- {
- QMessageBox::critical(
- this,
- tr( "No plugin to read a single image file found!" ),
- tr( "No plugin to read a single image file found!" )
- );
- return( ret );
-
- } // fi
-
- std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_LastOpenedFile = fname;
-
- TPlugin* reader =
- dynamic_cast< TPlugin* >(
- this->m_Plugins.CreateObject( this->m_ImageReaderClassName )
- );
-
- TParameters reader_params = reader->GetDefaultParameters( );
- reader_params[ "FileName" ].second = fname;
- reader_params[ "PixelType" ].second = image_type;
- reader_params[ "ImageDimension" ].second = image_dim;
- reader_params[ "IsColorImage" ].second = "0";
- reader->SetParameters( reader_params );
- std::string err = reader->Update( );
-
- if( err == "" )
- {
- ret = reader->GetOutput( 0 );
- reader->DisconnectOutputs( );
- }
- else
- QMessageBox::critical(
- this,
- tr( "Error reading single image" ),
- tr( err.c_str( ) )
- );
- delete reader;
- return( ret );
- }
- else if( nFiles > 1 )
- {
- if( this->m_ImageSeriesReaderClassName == "" )
- {
- QMessageBox::critical(
- this,
- tr( "No plugin to read an image series found!" ),
- tr( "No plugin to read an image series found!" )
- );
- return( ret );
-
- } // fi
- std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
- this->m_LastOpenedFile = fname;
- return( ret );
-
- } // fi
- return( ret );
-*/
+// // Show dialog and check if it was accepted
+// QFileDialog dialog( this );
+// dialog.setFileMode( QFileDialog::ExistingFiles );
+// dialog.setDirectory( tr( this->m_LastOpenedFile.c_str( ) ) );
+// dialog.setNameFilter(
+// tr( "Medical image files (*.mhd *.bin *.dcm);;All files (*)" )
+// );
+// dialog.setDefaultSuffix( tr( "mhd" ) );
+// if( !( dialog.exec( ) ) )
+// return( NULL );
+
+// TPluginImage* ret = NULL;
+// unsigned int nFiles = dialog.selectedFiles( ).size( );
+// if( nFiles == 1 )
+// {
+// if( this->m_BaseClasses[ "ImageReader" ] == "" )
+// {
+// QMessageBox::critical(
+// this,
+// tr( "No plugin to read a single image file found!" ),
+// tr( "No plugin to read a single image file found!" )
+// );
+// return( ret );
+
+// } // fi
+
+// std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
+// this->m_LastOpenedFile = fname;
+
+// TPlugin* reader =
+// dynamic_cast< TPlugin* >(
+// this->m_Plugins.CreateObject( this->m_BaseClasses[ "ImageReader" ] )
+// );
+
+// TParameters reader_params = reader->GetDefaultParameters( );
+// reader_params[ "FileName" ].second = fname;
+// reader_params[ "PixelType" ].second = image_type;
+// reader_params[ "ImageDimension" ].second = image_dim;
+// reader_params[ "IsColorImage" ].second = "0";
+// reader->SetParameters( reader_params );
+// std::string err = reader->Update( );
+
+// if( err == "" )
+// {
+// ret = dynamic_cast< TPluginImage* >( reader->GetOutput( 0 ) );
+// reader->DisconnectOutputs( );
+// }
+// else
+// QMessageBox::critical(
+// this,
+// tr( "Error reading single image" ),
+// tr( err.c_str( ) )
+// );
+// delete reader;
+// }
+// else if( nFiles > 1 )
+// {
+// /* TODO
+// if( this->m_ImageSeriesReaderClassName == "" )
+// {
+// QMessageBox::critical(
+// this,
+// tr( "No plugin to read an image series found!" ),
+// tr( "No plugin to read an image series found!" )
+// );
+// return( ret );
+
+// } // fi
+// std::string fname = dialog.selectedFiles( ).at( 0 ).toStdString( );
+// this->m_LastOpenedFile = fname;
+// */
+
+// } // fi
+// return( ret );
}
// -------------------------------------------------------------------------
void MainWnd::
_UpdateEnabledFlags( )
{
- bool img = ( this->m_InputImage != NULL );
- this->m_UI->menuSegmentInputImage->setEnabled( img );
- this->m_UI->actionOpenSegmentedImage->setEnabled( img );
- this->m_UI->m_3DVTK->setEnabled( img );
- this->m_UI->m_XPlaneVTK->setEnabled( img );
- this->m_UI->m_YPlaneVTK->setEnabled( img );
- this->m_UI->m_ZPlaneVTK->setEnabled( img );
- this->m_UI->m_AuxVTK->setEnabled( img );
-
- /* TODO
- bool seg = this->m_Segmentation.IsNotNull( );
- this->m_UI->menuFilterSegmentedImage->setEnabled( seg );
- this->m_UI->menuExtractMesh->setEnabled( seg );
- this->m_UI->actionOpenMesh->setEnabled( seg );
-
- this->m_UI->actionNavigation->setEnabled( img && seg );
- this->m_UI->actionSegmentationInteractiveDeformation->
- setEnabled( img && seg );
- */
+// bool img = ( this->m_InputImage != NULL );
+// this->m_UI->menuSegmentInputImage->setEnabled( img );
+// this->m_UI->actionOpenSegmentedImage->setEnabled( img );
+// this->m_UI->m_3DVTK->setEnabled( img );
+// this->m_UI->m_XPlaneVTK->setEnabled( img );
+// this->m_UI->m_YPlaneVTK->setEnabled( img );
+// this->m_UI->m_ZPlaneVTK->setEnabled( img );
+// this->m_UI->m_AuxVTK->setEnabled( img );
+
+// bool seg = ( this->m_SegmentedImage != NULL );
+// this->m_UI->menuFilterSegmentedImage->setEnabled( seg );
+// this->m_UI->menuExtractMesh->setEnabled( seg );
+// this->m_UI->menuProcessMesh->setEnabled( seg );
+// this->m_UI->actionOpenMesh->setEnabled( seg );
+
+// this->m_UI->actionNavigation->setEnabled( img && seg );
+// this->m_UI->actionSegmentationInteractiveDeformation->
+// setEnabled( img && seg );
}
// -------------------------------------------------------------------------
void MainWnd::
_triggered_actionReloadPlugins( )
{
- if( this->_LoadPlugins( ) )
- {
- this->_UpdateEnabledFlags( );
- }
- else
- {
- QMessageBox::critical(
- this,
- tr( "Could not load plugins from given file." ),
- tr( "Could not load plugins from given file." )
- );
-
- } // fi
- /*
- this->m_Plugins.UnloadAll( );
-
- this->m_ImageReaderClassName = "";
- this->m_ImageSeriesReaderClassName = "";
- this->m_ImageWriterClassName = "";
-
- std::ifstream in( this->m_PluginsConfigurationFile.c_str( ) );
- if( in )
- {
- std::string plugin;
- std::getline( in, plugin );
- while( !( in.eof( ) ) )
- {
- if( this->m_Plugins.Load( plugin ) )
- {
- TPluginsInterface::TClassesIterator cIt =
- this->m_Plugins.GetClasses( ).begin( );
- TPluginsInterface::TClassesIterator end_cIt =
- this->m_Plugins.GetClasses( ).end( );
- for( ; cIt != end_cIt; ++cIt )
- {
- std::string c_name = cIt->first;
- c_name = c_name.substr( c_name.find_last_of( ":" ) + 1 );
- if( c_name == "ImageReader" )
- {
- this->m_ImageReaderClassName = cIt->first;
- }
- else if( c_name == "ImageSeriesReader" )
- {
- this->m_ImageSeriesReaderClassName = cIt->first;
- }
- else if( c_name == "ImageWriter" )
- {
- this->m_ImageWriterClassName = cIt->first;
- }
- else
- {
- } // fi
-
- } // rof
-
- TFilterPlugins::TClassesIterator cIt =
- this->m_Plugins.BeginClasses( );
- for( ; cIt != this->m_Plugins.EndClasses( ); ++cIt )
- {
- TFilterObject* filter =
- this->m_Plugins.CreateObject( cIt->first );
- if( filter == NULL )
- continue;
- std::string cat = filter->GetCategory( );
- std::string catType = cat.substr( cat.find_last_of( ":" ) );
- if( catType == ":BinaryImageToBinaryImageFilter" )
- {
- QAction* action = this->m_UI->menuFilterSegmentedImage->
- addAction( QString( cIt->first.c_str( ) ) );
- QObject::connect(
- action, SIGNAL( triggered( ) ),
- this, SLOT( triggered_aFilterSegmentedImage( ) )
- );
- }
- else if( catType == ":ImageToMeshFilter" )
- {
- QAction* action = this->m_UI->menuExtractMesh->
- addAction( QString( cIt->first.c_str( ) ) );
- QObject::connect(
- action, SIGNAL( triggered( ) ),
- this, SLOT( triggered_aSegmentedImageToMesh( ) )
- );
-
- } // fi
- delete filter;
- } // rof
- }
- else
- {
- QMessageBox::warning(
- this,
- tr( "Ignoring plugin" ),
- tr( plugin.c_str( ) )
- );
-
- } // fi
- std::getline( in, plugin );
-
- } // elihw
- }
- else
- {
- QMessageBox::critical(
- this,
- tr( "No plugins file loaded!" ),
- tr( this->m_PluginsConfigurationFile.c_str( ) )
- );
-
- } // fi
- in.close( );
-
- if( this->m_ImageReaderClassName == "" )
- {
- QMessageBox::critical(
- this,
- tr( "No ImageReader found in plugins!" ),
- tr( this->m_PluginsConfigurationFile.c_str( ) )
- );
-
- } // fi
-
- if( this->m_ImageWriterClassName == "" )
- {
- QMessageBox::critical(
- this,
- tr( "No ImageWriter found in plugins!" ),
- tr( this->m_PluginsConfigurationFile.c_str( ) )
- );
-
- } // fi
- this->_UpdateEnabledFlags( );
- */
+// if( !( this->_LoadPlugins( ) ) )
+// {
+// QMessageBox::critical(
+// this,
+// tr( "Could not load plugins from given file." ),
+// tr( "Could not load plugins from given file." )
+// );
+
+// } // fi
+// this->_UpdateEnabledFlags( );
}
// -------------------------------------------------------------------------
void MainWnd::
_triggered_actionOpenInputImage( )
{
- if( this->m_InputImage != NULL )
- delete this->m_InputImage;
- this->m_InputImage =
- this->_LoadImage(
- this->m_ApplicationPreferences[ "input_image_type" ],
- this->m_ApplicationPreferences[ "data_dimensions" ]
- );
- if( this->m_InputImage != NULL )
- {
- cpPlugins::Interface::Image* img =
- dynamic_cast< cpPlugins::Interface::Image* >( this->m_InputImage );
- this->m_ImageActors->Configure(
- img->GetVTKImageData( ),
- this->m_UI->m_XPlaneVTK->GetInteractor( ),
- this->m_UI->m_YPlaneVTK->GetInteractor( ),
- this->m_UI->m_ZPlaneVTK->GetInteractor( )
- );
- this->m_ImageActors->
- AddAuxiliaryInteractor( this->m_UI->m_3DVTK->GetInteractor( ) );
-
- // Associate actors
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetImageOutlineActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetXBoundsActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetYBoundsActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetZBoundsActor( )
- );
-
- // Reset all cameras
- this->m_3DRenderer->ResetCamera( );
- this->m_ImageActors->ResetCameras( );
-
- // Ok, start!
- this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
-
- // Update activations
- this->_UpdateEnabledFlags( );
- this->m_UI->actionNavigation->setChecked( true );
- this->_triggered_actionSwitchMode( );
-
- } // fi
+// if( this->m_InputImage != NULL )
+// delete this->m_InputImage;
+// this->m_InputImage =
+// this->_LoadImage(
+// this->m_ApplicationPreferences[ "input_image_type" ],
+// this->m_ApplicationPreferences[ "data_dimensions" ]
+// );
+// if( this->m_InputImage != NULL )
+// {
+// // this->m_MPR->SetImage( this->m_InputImage->GetVTKImageData( ) );
+
+// // Update activations
+// this->_UpdateEnabledFlags( );
+// this->m_UI->actionNavigation->setChecked( true );
+// this->_triggered_actionSwitchMode( );
+
+// } // fi
}
// -------------------------------------------------------------------------
void MainWnd::
_triggered_actionOpenSegmentedImage( )
{
- if( this->m_SegmentedImage != NULL )
- delete this->m_SegmentedImage;
- this->m_SegmentedImage =
- this->_LoadImage(
- this->m_ApplicationPreferences[ "segmented_image_type" ],
- this->m_ApplicationPreferences[ "data_dimensions" ]
- );
- if( this->m_SegmentedImage != NULL )
- {
- cpPlugins::Interface::Image* img =
- dynamic_cast< cpPlugins::Interface::Image* >( this->m_SegmentedImage );
- this->m_ImageActors->SetSegmentation( img->GetVTKImageData( ) );
-
- // Ok, start!
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
- this->_UpdateEnabledFlags( );
-
- } // fi
+// if( this->m_SegmentedImage != NULL )
+// delete this->m_SegmentedImage;
+// this->m_SegmentedImage =
+// this->_LoadImage(
+// this->m_ApplicationPreferences[ "segmented_image_type" ],
+// this->m_ApplicationPreferences[ "data_dimensions" ]
+// );
+// if( this->m_SegmentedImage != NULL )
+// {
+// /*
+// this->m_MPR->SetSegmentation(
+// this->m_SegmentedImage->GetVTKImageData( )
+// );
+// */
+// /* TODO
+// cpPlugins::Interface::Image* img =
+// dynamic_cast< cpPlugins::Interface::Image* >( this->m_SegmentedImage );
+// this->m_ImageActors->SetSegmentation( img->GetVTKImageData( ) );
+// */
+
+// // Ok, start!
+// /*
+// this->m_MPR->Render( 0 );
+// this->m_MPR->Render( 1 );
+// this->m_MPR->Render( 2 );
+// */
+// this->_UpdateEnabledFlags( );
+
+// } // fi
}
// -------------------------------------------------------------------------
void MainWnd::
_triggered_actionSwitchMode( )
{
- QAction* snd = dynamic_cast< QAction* >( this->sender( ) );
- if( snd == this->m_UI->actionNavigation )
- {
- this->m_UI->actionSegmentationInteractiveDeformation->setChecked(
- !( this->m_UI->actionNavigation->isChecked( ) )
- );
- }
- else if( snd == this->m_UI->actionSegmentationInteractiveDeformation )
- {
- this->m_UI->actionNavigation->setChecked(
- !( this->m_UI->actionSegmentationInteractiveDeformation->isChecked( ) )
- );
- }
- else
- {
- this->m_UI->actionNavigation->setChecked( true );
- this->m_UI->actionSegmentationInteractiveDeformation->setChecked( false );
-
- } // fi
-
- /* TODO
- if( this->m_UI->aNavigation->isChecked( ) )
- {
- this->m_XStyle->SetModeToNavigation( );
- this->m_YStyle->SetModeToNavigation( );
- this->m_ZStyle->SetModeToNavigation( );
- this->m_ImageActors->HideRegion( 0 );
- this->m_ImageActors->HideRegion( 1 );
- this->m_ImageActors->HideRegion( 2 );
- this->m_3DRenderer->RemoveActor(
- this->m_ImageActors->GetCursorActor( )
- );
- this->m_3DRenderer->RemoveActor(
- this->m_ImageActors->GetRegionActor( )
- );
- this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
- }
- else if( this->m_UI->aSegmentationInteractiveDeformation->isChecked( ) )
- {
- this->m_XStyle->SetModeToDeformation( );
- this->m_YStyle->SetModeToDeformation( );
- this->m_ZStyle->SetModeToDeformation( );
- this->m_ImageActors->ShowRegion( 0 );
- this->m_ImageActors->ShowRegion( 1 );
- this->m_ImageActors->ShowRegion( 2 );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetCursorActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetRegionActor( )
- );
- this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
-
- } // fi
- */
+// QAction* snd = dynamic_cast< QAction* >( this->sender( ) );
+// if( snd == this->m_UI->actionNavigation )
+// {
+// this->m_UI->actionSegmentationInteractiveDeformation->setChecked(
+// !( this->m_UI->actionNavigation->isChecked( ) )
+// );
+// }
+// else if( snd == this->m_UI->actionSegmentationInteractiveDeformation )
+// {
+// this->m_UI->actionNavigation->setChecked(
+// !( this->m_UI->actionSegmentationInteractiveDeformation->isChecked( ) )
+// );
+// }
+// else
+// {
+// this->m_UI->actionNavigation->setChecked( true );
+// this->m_UI->actionSegmentationInteractiveDeformation->setChecked( false );
+
+// } // fi
+
+// /* TODO
+// if( this->m_UI->aNavigation->isChecked( ) )
+// {
+// this->m_XStyle->SetModeToNavigation( );
+// this->m_YStyle->SetModeToNavigation( );
+// this->m_ZStyle->SetModeToNavigation( );
+// this->m_ImageActors->HideRegion( 0 );
+// this->m_ImageActors->HideRegion( 1 );
+// this->m_ImageActors->HideRegion( 2 );
+// this->m_3DRenderer->RemoveActor(
+// this->m_ImageActors->GetCursorActor( )
+// );
+// this->m_3DRenderer->RemoveActor(
+// this->m_ImageActors->GetRegionActor( )
+// );
+// this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
+// }
+// else if( this->m_UI->aSegmentationInteractiveDeformation->isChecked( ) )
+// {
+// this->m_XStyle->SetModeToDeformation( );
+// this->m_YStyle->SetModeToDeformation( );
+// this->m_ZStyle->SetModeToDeformation( );
+// this->m_ImageActors->ShowRegion( 0 );
+// this->m_ImageActors->ShowRegion( 1 );
+// this->m_ImageActors->ShowRegion( 2 );
+// this->m_3DRenderer->AddActor(
+// this->m_ImageActors->GetCursorActor( )
+// );
+// this->m_3DRenderer->AddActor(
+// this->m_ImageActors->GetRegionActor( )
+// );
+// this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
+
+// } // fi
+// */
}
// -------------------------------------------------------------------------
return( false );
}
- // -------------------------------------------------------------------------
- template< class I >
- bool MainWnd::
- _LoadImage( typename I::Pointer& image )
- {
- QStringList qList =
- QFileDialog::getOpenFileNames(
- this,
- tr( "Open an image" ),
- tr( this->m_LastOpenedFile.c_str( ) ),
- tr( "Medical image files (*.mhd *.bin *.dcm);;All files (*)" )
- );
- if( qList.size( ) == 0 )
- return( false );
-
- bool ret = true;
- QStringList::Iterator fIt = qList.begin( );
- if( qList.size( ) == 1 )
- {
- // Read a single image
- std::string fn = fIt->toStdString( );
- this->m_LastOpenedFile = fn;
-
- typename itk::ImageFileReader< I >::Pointer reader =
- itk::ImageFileReader< I >::New( );
- reader->SetFileName( fn );
- try
- {
- reader->Update( );
- }
- catch( itk::ExceptionObject& err )
- {
- QMessageBox::critical(
- this,
- tr( "Error opening single image!" ),
- tr( err.GetDescription( ) )
- );
- ret = false;
-
- } // yrt
- image = reader->GetOutput( );
- image->DisconnectPipeline( );
- }
- else if( qList.size( ) > 1 )
- {
- typedef std::set< std::string > _TOrderedStringList;
-
- // Read a slice set
- _TOrderedStringList filenames;
- for( ; fIt != qList.end( ); ++fIt )
- filenames.insert( fIt->toStdString( ) );
- typename itk::ImageSeriesReader< I >::Pointer reader =
- itk::ImageSeriesReader< I >::New( );
- reader->SetImageIO( itk::GDCMImageIO::New( ) );
- _TOrderedStringList::const_iterator oIt = filenames.begin( );
- for( ; oIt != filenames.end( ); ++oIt )
- {
- reader->AddFileName( *oIt );
- this->m_LastOpenedFile = *oIt;
-
- } // rof
- try
- {
- reader->Update( );
- }
- catch( itk::ExceptionObject& err )
- {
- QMessageBox::critical(
- this,
- tr( "Error opening image series!" ),
- tr( err.GetDescription( ) )
- );
- ret = false;
-
- } // yrt
- image = reader->GetOutput( );
- image->DisconnectPipeline( );
-
- } // fi
- return( ret );
- }
-
-// -------------------------------------------------------------------------
-void MainWnd::
-triggered_aReloadPlugins( )
-{
-}
-
-// -------------------------------------------------------------------------
-void MainWnd::
-triggered_aOpenInputImage( )
-{
- if( this->_LoadImage< TImage >( this->m_Image ) )
- {
- // Connect image to VTK
- this->m_VTKImage = TVTKImage::New( );
- this->m_VTKImage->SetInput( this->m_Image );
- this->m_VTKImage->Update( );
-
- this->m_ImageActors->Configure(
- this->m_VTKImage->GetOutput( ),
- this->m_UI->m_XPlaneVTK->GetInteractor( ),
- this->m_UI->m_YPlaneVTK->GetInteractor( ),
- this->m_UI->m_ZPlaneVTK->GetInteractor( )
- );
- this->m_ImageActors->
- AddAuxiliaryInteractor( this->m_UI->m_3DVTK->GetInteractor( ) );
-
- // Associate actors
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetImageOutlineActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetXBoundsActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetYBoundsActor( )
- );
- this->m_3DRenderer->AddActor(
- this->m_ImageActors->GetZBoundsActor( )
- );
-
- // Reset all cameras
- this->m_3DRenderer->ResetCamera( );
- this->m_ImageActors->ResetCameras( );
-
- // Ok, start!
- this->m_UI->m_3DVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
- this->_UpdateEnabledFlags( );
- this->m_UI->aNavigation->setChecked( true );
- this->triggered_aSwitchMode( );
-
- } // fi
-}
-
-// -------------------------------------------------------------------------
-void MainWnd::
-triggered_aOpenSegmentedImage( )
-{
- if( this->_LoadImage< TImage >( this->m_Segmentation ) )
- {
- // Connect image to VTK
- this->m_VTKSegmentation = TVTKImage::New( );
- this->m_VTKSegmentation->SetInput( this->m_Segmentation );
- this->m_VTKSegmentation->Update( );
-
- this->m_ImageActors->SetSegmentation(
- this->m_VTKSegmentation->GetOutput( )
- );
-
- // Ok, start!
- this->m_UI->m_XPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_YPlaneVTK->GetRenderWindow( )->Render( );
- this->m_UI->m_ZPlaneVTK->GetRenderWindow( )->Render( );
- this->_UpdateEnabledFlags( );
-
- } // fi
-}
-
// -------------------------------------------------------------------------
void MainWnd::
triggered_aFilterSegmentedImage( )