}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
+std::string cpPlugins::Interface::BaseMPRWindow::
LoadImage( )
{
std::string msg = "";
- bool ret = true;
+ std::string ret = "";
if( this->m_ImageReader.IsNull( ) )
- {
msg = "No valid image reader. Please load a valid plugin file.";
- ret = false;
-
- } // fi
if( this->m_ImageReader->ExecConfigurationDialog( this ) )
{
msg = this->m_ImageReader->Update( );
if( msg == "" )
{
- this->m_Images.push_back(
- this->m_ImageReader->GetOutput< TImage >( 0 )
- );
+ TImage::Pointer image =
+ this->m_ImageReader->GetOutput< TImage >( "Output" );
+ if( this->m_Images.size( ) == 0 )
+ ret = image->GetName( );
+ else
+ ret = "Segmentation";
+ this->m_Images[ ret ] = image;
this->m_ImageReader->DisconnectOutputs( );
this->m_ImageReader->GetParameters( )->ClearStringList( "FileNames" );
- vtkImageData* vtk_id =
- this->m_Images.rbegin( )->GetPointer( )->GetVTK< vtkImageData >( );
+ vtkImageData* vtk_id = image->GetVTK< vtkImageData >( );
if( vtk_id != NULL )
{
this->m_MPRObjects->AddImage( vtk_id );
msg = "Read image does not have a valid VTK converter.";
}
else
- ret = false;
+ ret = "";
} // fi
}
// -------------------------------------------------------------------------
-bool cpPlugins::Interface::BaseMPRWindow::
+std::string cpPlugins::Interface::BaseMPRWindow::
LoadMesh( )
{
- return( false );
+ return( "" );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::BaseMPRWindow::
-ExecuteFilter( const std::string& name, int input_id, int output_id )
+ExecuteFilter(
+ const std::string& name,
+ const std::string& input_id,
+ const std::string& output_id
+ )
{
TProcessObject::Pointer filter =
this->m_Interface.CreateProcessObject( name );
std::string category = filter->GetClassCategory( );
if( category == "ImageToBinaryImageFilter" )
{
- if( input_id < this->m_Images.size( ) )
+ TImages::iterator iIt = this->m_Images.find( input_id );
+ if( iIt != this->m_Images.end( ) )
{
- filter->SetInput( 0, this->m_Images[ input_id ] );
+ filter->SetInput( "Input", this->m_Images[ input_id ] );
bool dlg_ok = filter->ExecConfigurationDialog( NULL );
if( !dlg_ok )
return;
+ std::string err = filter->Update( );
+ std::cout << "ERR: " << err << std::endl;
+ if( err == "" )
+ {
+ this->m_Images[ "Segmentation" ] =
+ filter->GetOutput< TImage >( "Output" );
+ filter->DisconnectOutputs( );
+
+ vtkImageData* vtk_id =
+ this->m_Images[ "Segmentation" ]->GetVTK< vtkImageData >( );
+ if( vtk_id != NULL )
+ this->m_MPRObjects->AddImage( vtk_id );
+ }
+ else
+ QMessageBox::critical(
+ this, tr( "Error with plugin" ), tr( err.c_str( ) )
+ );
+
} // fi
} // fi
}
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::BaseMPRWindow::
+AddImage( const std::string& name, TImage* image )
+{
+ this->m_Images[ name ] = image;
+ vtkImageData* vtk_id =
+ this->m_Images[ name ]->GetVTK< vtkImageData >( );
+ if( vtk_id != NULL )
+ this->m_MPRObjects->AddImage( vtk_id );
+}
+
// -------------------------------------------------------------------------
void cpPlugins::Interface::BaseMPRWindow::
ClearAll( )