this->m_Height = this->m_VertMargin;\r
\r
// Configure names\r
- this->setNamePort( this->m_Filter->GetName( ) );\r
+ this->setNamePort( this->m_Filter->GetClassName( ) ); // TODO\r
this->_setTypeInfo( this->m_Filter->GetClassName( ) );\r
\r
// Add input ports\r
} // rof\r
\r
// Keep a trace of this visual graph\r
- this->m_Graph->SetVertex( f->GetName( ), b );\r
+ // TODO: this->m_Graph->SetVertex( f->GetName( ), b );\r
return( b );\r
}\r
\r
this->m_Providers[ classIt->second ]
);
if( provider != NULL )
- {
po = provider->create( );
- po->SetName( name );
-
- } // fi
catIt = this->m_Classes.end( );
}
else
// Set dialog title
auto filter = this->m_Parameters->GetProcessObject( );
std::stringstream title;
- title << "Parameters for \"" << filter->GetName( ) << "\"";
+ title
+ << "Parameters for an object of class \""
+ << filter->GetClassName( )
+ << "\"";
this->m_Title->setText( title.str( ).c_str( ) );
// Put values
// -------------------------------------------------------------------------
cpPlugins::Interface::
-ProcessObjectPort& cpPlugins::Interface::ProcessObject::
+OutputProcessObjectPort& cpPlugins::Interface::ProcessObject::
GetOutput( const std::string& id )
{
- static ProcessObjectPort null_port;
+ static OutputProcessObjectPort null_port;
auto i = this->m_Outputs.find( id );
if( i == this->m_Outputs.end( ) )
{
// -------------------------------------------------------------------------
const cpPlugins::Interface::
-ProcessObjectPort& cpPlugins::Interface::ProcessObject::
+OutputProcessObjectPort& cpPlugins::Interface::ProcessObject::
GetOutput( const std::string& id ) const
{
- static const ProcessObjectPort null_port;
+ static const OutputProcessObjectPort null_port;
auto i = this->m_Outputs.find( id );
if( i == this->m_Outputs.end( ) )
return( null_port );
// -------------------------------------------------------------------------
bool cpPlugins::Interface::ProcessObject::
-SetInput( const std::string& id, const ProcessObjectPort& port )
+SetInput( const std::string& id, const OutputProcessObjectPort& port )
{
auto i = this->m_Inputs.find( id );
if( i != this->m_Inputs.end( ) )
auto i = this->m_Outputs.begin( );
for( ; i != this->m_Outputs.end( ); ++i )
if( i->second.IsValid( ) )
- i->second->DisconnectPipeline( );
+ i->second->DisconnectFromPipeline( );
this->Modified( );
}
// -------------------------------------------------------------------------
void cpPlugins::Interface::ProcessObject::
-_AddInput( const std::string& name )
+_AddInput( const std::string& name, bool required )
{
- typedef typename _TDataContainer::value_type _TValue;
+ typedef typename _TInputs::value_type _TValue;
auto i = this->m_Inputs.find( name );
if( i == this->m_Inputs.end( ) )
{
- i = this->m_Inputs.insert( _TValue( name, NULL ) ).first;
+ InputProcessObjectPort new_port( required );
+ this->m_Inputs[ name ] = new_port;
this->Modified( );
} // fi
unsigned int GetNumberOfInputs( ) const;
unsigned int GetNumberOfOutputs( ) const;
- ProcessObjectPort& GetOutput( const std::string& id );
- const ProcessObjectPort& GetOutput( const std::string& id ) const;
+ OutputProcessObjectPort& GetOutput( const std::string& id );
+ const OutputProcessObjectPort& GetOutput( const std::string& id ) const;
template< class T >
inline T* GetInputData( const std::string& id );
template< class T >
inline const T* GetOutputData( const std::string& id ) const;
- bool SetInput( const std::string& id, const ProcessObjectPort& port );
+ bool SetInput(
+ const std::string& id, const OutputProcessObjectPort& port
+ );
void DisconnectInputs( );
void DisconnectOutputs( );
Self& operator=( const Self& );
protected:
- typedef std::map< std::string, ProcessObjectPort > _TDataContainer;
- _TDataContainer m_Inputs;
- _TDataContainer m_Outputs;
+ typedef std::map< std::string, InputProcessObjectPort > _TInputs;
+ typedef std::map< std::string, OutputProcessObjectPort > _TOutputs;
+ _TInputs m_Inputs;
+ _TOutputs m_Outputs;
Parameters::Pointer m_Parameters;
itk::ModifiedTimeType m_LastExecutionTime;
void cpPlugins::Interface::ProcessObject::
_AddOutput( const std::string& name )
{
- typedef typename _TDataContainer::value_type _TValue;
auto i = this->m_Outputs.find( name );
if( i == this->m_Outputs.end( ) )
{
TFilter::Pointer f = this->m_Plugins->CreateObject( filter );
if( f.IsNotNull( ) )
{
- f->SetName( name );
f->SetSingleInteractor( this->m_SingleInteractor );
f->SetMPRViewer( this->m_MPRViewer );
bool cpPlugins::Interface::Workspace::
RenameFilter( const std::string& old_name, const std::string& new_name )
{
- if( this->m_Graph->RenameVertex( old_name, new_name ) )
- {
- TFilter* f = this->GetFilter( new_name );
- f->SetName( new_name );
- return( true );
- }
- else
- return( false );
+ return( this->m_Graph->RenameVertex( old_name, new_name ) );
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
bool cpPlugins::Interface::Workspace::
Connect(
- const ProcessObjectPort& input_port, const std::string& exposed_port
+ const OutputProcessObjectPort& port, const std::string& exposed_port
)
{
- auto port = this->m_ExposedInputPorts.find( exposed_port );
- if( port != this->m_ExposedInputPorts.end( ) )
+ auto i = this->m_ExposedInputPorts.find( exposed_port );
+ if( i != this->m_ExposedInputPorts.end( ) )
{
- TFilter* filter = this->GetFilter( port->second.first );
+ TFilter* filter = this->GetFilter( i->second.first );
if( filter != NULL )
- return( filter->SetInput( port->second.second, input_port ) );
+ return( filter->SetInput( i->second.second, port ) );
else
return( false );
}
const std::string& output_name, const std::string& input_name
);
bool Connect(
- const ProcessObjectPort& input_port, const std::string& exposed_port
+ const OutputProcessObjectPort& port, const std::string& exposed_port
);
void RemoveConnection(
const std::string& dest_filter, const std::string& input_name
{
TiXmlElement* e = new TiXmlElement( "filter" );
e->SetAttribute( "class", filter->GetClassName( ) );
- e->SetAttribute( "name", filter->GetName( ) );
+ e->SetAttribute( "name", vIt->first.c_str( ) );
e->SetAttribute( "ViewX", filter->GetViewX( ) );
e->SetAttribute( "ViewY", filter->GetViewY( ) );
AppendMeshesFilter( )
: Superclass( )
{
- this->_AddInput( "Input0" );
- this->_AddInput( "Input1" );
+ this->_AddInput( "Input0", true );
+ this->_AddInput( "Input1", true );
this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
}
BinaryErodeImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Radius" );
BinaryThresholdImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" );
Cutter( )
: Superclass( )
{
- this->_AddInput( "InputMesh" );
- this->_AddInput( "InputFunction" );
+ this->_AddInput( "InputMesh", true );
+ this->_AddInput( "InputFunction", true );
this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
}
ExtractSliceImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Axis" );
InputDataReproducer( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" );
this->m_Parameters->Clear( );
}
: Superclass( ),
m_PlaneWidget( NULL )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" );
this->_AddOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" );
filter->SetOutsideValue( _TPixel( 0 ) );
filter->Update( );
- // Get output names
- auto pos_name = this->GetOutputData< _TObj >( "PositiveOutput" )->GetName( );
- auto neg_name = this->GetOutputData< _TObj >( "NegativeOutput" )->GetName( );
-
// Connect outputs (and correct their types and names)
_TImage* pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
if( pos_out == NULL )
{
this->_AddOutput< _TImage >( "PositiveOutput" );
pos_out = this->GetOutputData< _TImage >( "PositiveOutput" );
- pos_out->SetName( pos_name );
} // fi
_TImage* neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
{
this->_AddOutput< _TImage >( "NegativeOutput" );
neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
- neg_out->SetName( neg_name );
} // fi
MacheteImageFilter()
: Superclass()
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >("Output");
this->m_Parameters->ConfigureAsReal("Radius");
MarchingCubes( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
this->m_Parameters->ConfigureAsRealList( "Thresholds" );
MedianImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "Radius" );
OtsuThresholdImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
{
typedef cpPlugins::Interface::Parameters TParameters;
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
std::vector< std::string > choices;
SignedMaurerDistanceMapImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsReal( "BackgroundValue" );
SphereMeshSource( )
: Superclass( )
{
- // TODO: this->_AddInput( "Center" );
+ this->_AddInput( "Center", false );
this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
this->m_Parameters->ConfigureAsReal( "Radius" );
TriangleMeshToBinaryImageFilter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
this->m_Parameters->ConfigureAsUint( "InsideValue" );
{
reader->Update( );
out->SetITK< I >( reader->GetOutput( ) );
- out->SetName( names[ 0 ] );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
out->SetITK< I >( NULL );
- out->SetName( "" );
} // yrt
}
{
reader->Update( );
out->SetITK< I >( reader->GetOutput( ) );
- out->SetName( names[ 0 ] );
}
catch( itk::ExceptionObject& err )
{
r = "ImageReader: " + std::string( err.GetDescription( ) );
out->SetITK< I >( NULL );
- out->SetName( "" );
} // yrt
}
ImageWriter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
this->m_Parameters->SetAcceptedFileExtensions(
"FileName",
MeshWriter( )
: Superclass( )
{
- this->_AddInput( "Input" );
+ this->_AddInput( "Input", true );
this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
this->m_Parameters->SetAcceptedFileExtensions(
"FileName",
: Superclass( ),
m_Configured( false )
{
- this->_AddInput( "ReferenceImage" );
+ this->_AddInput( "ReferenceImage", true );
this->_AddOutput< cpPlugins::Interface::PointList >( "Output" );
this->m_Parameters->ConfigureAsBool( "SeedsAreInRealSpace" );