]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 9 Feb 2016 14:48:52 +0000 (09:48 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 9 Feb 2016 14:48:52 +0000 (09:48 -0500)
29 files changed:
lib/cpPipelineEditor/Block.cxx
lib/cpPipelineEditor/Editor.cxx
lib/cpPlugins/Interface/Interface.cxx
lib/cpPlugins/Interface/ParametersQtDialog.cxx
lib/cpPlugins/Interface/ProcessObject.cxx
lib/cpPlugins/Interface/ProcessObject.h
lib/cpPlugins/Interface/ProcessObject.hxx
lib/cpPlugins/Interface/Workspace.cxx
lib/cpPlugins/Interface/Workspace.h
lib/cpPlugins/Interface/WorkspaceIO.cxx
lib/cpPlugins/Plugins/BasicFilters/AppendMeshesFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/InputDataReproducer.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MacheteImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/MarchingCubes.cxx
lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/SignedMaurerDistanceMapImageFilter.cxx
lib/cpPlugins/Plugins/BasicFilters/SphereMeshSource.cxx
lib/cpPlugins/Plugins/BasicFilters/TriangleMeshToBinaryImageFilter.cxx
lib/cpPlugins/Plugins/IO/ImageReader.cxx
lib/cpPlugins/Plugins/IO/ImageWriter.cxx
lib/cpPlugins/Plugins/IO/MeshWriter.cxx
lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx

index 61938a7b9073545cb81db9700d7bb3af9a3318c5..3d3c0f8b76b750ba217ab4b3b2b852f965237b10 100644 (file)
@@ -38,7 +38,7 @@ Block( TFilter* filter, QGraphicsItem* parent, QGraphicsScene* scene )
   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
index 7dc6251618d039fcd0325da701ada99d6df5e4db..e15b68df827da2e33f9a7d2563d61986c36ac740 100644 (file)
@@ -222,7 +222,7 @@ _createBlock( TFilter* f, const QPointF& pnt )
   } // 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
index 65b7e0f723c128bf329285f34be7f656f943bd19..4db8f772bc1ac4a1aed4281c008ce8c2b4f95b65 100644 (file)
@@ -163,11 +163,7 @@ CreateObject( const std::string& name ) const
           this->m_Providers[ classIt->second ]
           );
       if( provider != NULL )
-      {
         po = provider->create( );
-        po->SetName( name );
-
-      } // fi
       catIt = this->m_Classes.end( );
     }
     else
index 32cd8c4bea84b706d1c7f7d83045a39f2831874c..409f4e7288c5f3ff844e7bd46b72cdb1e532276a 100644 (file)
@@ -299,7 +299,10 @@ _updateWidgets( )
   // 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
index f012f5701d3131a7b86d5f5acedf615a59137d99..1d922988c494c1b619da241e901357501cbc1c6e 100644 (file)
@@ -43,10 +43,10 @@ GetNumberOfOutputs( ) const
 
 // -------------------------------------------------------------------------
 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( ) )
   {
@@ -59,10 +59,10 @@ GetOutput( const std::string& id )
 
 // -------------------------------------------------------------------------
 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 );
@@ -72,7 +72,7 @@ GetOutput( const std::string& id ) const
 
 // -------------------------------------------------------------------------
 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( ) )
@@ -106,7 +106,7 @@ DisconnectOutputs( )
   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( );
 }
 
@@ -200,13 +200,14 @@ cpPlugins::Interface::ProcessObject::
 
 // -------------------------------------------------------------------------
 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
index e99e8fce440715735c5bf6f53f684b8f82bf231f..9489c35b6c8da1bb2f950df183b2dd4efdaf9845 100644 (file)
@@ -61,8 +61,8 @@ namespace cpPlugins
       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 );
@@ -73,7 +73,9 @@ namespace cpPlugins
       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( );
@@ -103,9 +105,10 @@ namespace cpPlugins
       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;
index 9c5b764c5f79e3bacf89fb88e0def60ed48252fb..ccddc04d9506ce3369b4e09f01c0f48d069107b6 100644 (file)
@@ -54,7 +54,6 @@ template< class O >
 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( ) )
   {
index c56897e2b1cbc317f67b6397d2736d35fb42505e..0abe92778d8596f4e75b69089fdddad8f2c0b0db 100644 (file)
@@ -119,7 +119,6 @@ CreateFilter( const std::string& filter, const std::string& name )
     TFilter::Pointer f = this->m_Plugins->CreateObject( filter );
     if( f.IsNotNull( ) )
     {
-      f->SetName( name );
       f->SetSingleInteractor( this->m_SingleInteractor );
       f->SetMPRViewer( this->m_MPRViewer );
       
@@ -137,14 +136,7 @@ CreateFilter( const std::string& filter, const std::string& name )
 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 ) );
 }
 
 // -------------------------------------------------------------------------
@@ -226,15 +218,15 @@ Connect(
 // -------------------------------------------------------------------------
 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 );
   }
index be85418dac277ad54389fc0b1d89ccea75018c79..dedb8b4f37db57edc4e829a7c53a04c05d7f5653 100644 (file)
@@ -93,7 +93,7 @@ namespace cpPlugins
         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
index dcf6c6852f17af9a26f509d494d1bf852ebcac0a..f811a5e9b6f57640e0ac9bdf196266e818df2e07 100644 (file)
@@ -117,7 +117,7 @@ SaveWorkspace( const std::string& fname ) const
     {
       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( ) );
 
index 9121540c938213897b4b02a1b7046df9035ed40e..8ea415453b735ac0ea1845e80c7f8be15f68069b 100644 (file)
@@ -8,8 +8,8 @@ cpPlugins::BasicFilters::AppendMeshesFilter::
 AppendMeshesFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input0" );
-  this->_AddInput( "Input1" );
+  this->_AddInput( "Input0", true );
+  this->_AddInput( "Input1", true );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 }
 
index 1bab79d5a70ac9279ad80411b7d03eb4f9fbd412..91402f5b4b1595a8e850a2b7b775c2ee10867a08 100644 (file)
@@ -10,7 +10,7 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter::
 BinaryErodeImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Radius" );
index 5f159ce6410de2384beb69fd40b0a54e926be5be..98926796d276469c85df76d22fa845d7a1a2d2f6 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter::
 BinaryThresholdImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" );
index fcb0269e9841002dee52812de0fd121081acef2d..a0b051d16c7d173977a9894edc5458f17f9c2b62 100644 (file)
@@ -13,8 +13,8 @@ cpPlugins::BasicFilters::Cutter::
 Cutter( )
   : Superclass( )
 {
-  this->_AddInput( "InputMesh" );
-  this->_AddInput( "InputFunction" );
+  this->_AddInput( "InputMesh", true );
+  this->_AddInput( "InputFunction", true );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 }
 
index de007796337bc4cc84eb0f84467daf4a7ded6024..0e553fd1bca1a6fe31e9e4868c2e064042f5f23d 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 ExtractSliceImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Axis" );
index 957136d3187879ce34c35c1105b1d4dff64f436a..022d46921e154debfed27bab97b292b75f0f44f5 100644 (file)
@@ -5,7 +5,7 @@ cpPlugins::BasicFilters::InputDataReproducer::
 InputDataReproducer( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "Output" );
   this->m_Parameters->Clear( );
 }
index 4dfcd5a09be548afabfbc31dd74f52fbca6e85d7..6877a3d3e2ee65134f72dca8f3d90c9906ad56f8 100644 (file)
@@ -194,7 +194,7 @@ MacheteFilter( )
   : Superclass( ),
     m_PlaneWidget( NULL )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "PositiveOutput" );
   this->_AddOutput< cpPlugins::Interface::DataObject >( "NegativeOutput" );
 
@@ -285,17 +285,12 @@ _RealImage( itk::DataObject* dobj )
   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" );
@@ -303,7 +298,6 @@ _RealImage( itk::DataObject* dobj )
   {
     this->_AddOutput< _TImage >( "NegativeOutput" );
     neg_out = this->GetOutputData< _TImage >( "NegativeOutput" );
-    neg_out->SetName( neg_name );
 
   } // fi
 
index a488ba9772f971cd8c8a463ab2ff18a247ddefd9..772b9c289ac402350f2b7201648146e5c748bbd7 100644 (file)
@@ -12,7 +12,7 @@ cpPlugins::BasicFilters::MacheteImageFilter::
 MacheteImageFilter()
 : Superclass()
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >("Output");
 
   this->m_Parameters->ConfigureAsReal("Radius");
index 95ede25066c8db58751483cac71ea0d71a7f9464..0203b099288d6c47f0646c243cacece3d886ed96 100644 (file)
@@ -11,7 +11,7 @@ cpPlugins::BasicFilters::MarchingCubes::
 MarchingCubes( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 
   this->m_Parameters->ConfigureAsRealList( "Thresholds" );
index 02eed731418a90726004d466725161087068b050..2e4c763fd61ab6c9470300de7bb89d364e50c08f 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::MedianImageFilter::
 MedianImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Radius" );
index 3a3f12c12fe4dce14bbf9f7aa04ad622a285ddba..0c4852bfd0107a35132403fcea796aec2484d4dc 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter::
 OtsuThresholdImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" );
index f06cda81fff5b0c477b35c6ea3e9a9606c3dfe3b..700043d032dc1f5920cc275fbc05fbc647f65e4f 100644 (file)
@@ -13,7 +13,7 @@ RGBImageToOtherChannelsFilter( )
 {
   typedef cpPlugins::Interface::Parameters TParameters;
 
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   std::vector< std::string > choices;
index 1487e387c6ecb957024676b214385a6a6f679926..474867517de476607183479b8a3b501a915d706e 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::BasicFilters::SignedMaurerDistanceMapImageFilter::
 SignedMaurerDistanceMapImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "BackgroundValue" );
index 53e39f0581b9ca1829a530995662d07be191dd37..df01a691e34cb3a56ae4dedccdcffd32ebf03d98 100644 (file)
@@ -10,7 +10,7 @@ cpPlugins::BasicFilters::SphereMeshSource::
 SphereMeshSource( )
   : Superclass( )
 {
-  // TODO: this->_AddInput( "Center" );
+  this->_AddInput( "Center", false );
   this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" );
 
   this->m_Parameters->ConfigureAsReal( "Radius" );
index 8ede24e9ff6d6331bd07e1165eafa505c82d7796..e3800292ca6086db6cae1e3d1670c5c793de5371 100644 (file)
@@ -10,7 +10,7 @@ cpPlugins::BasicFilters::TriangleMeshToBinaryImageFilter::
 TriangleMeshToBinaryImageFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "InsideValue" );
index cd0d6c9d41e26526596a9af595bc3e5c05f7a4ca..66231c451e73042f85399dbcc6e714cc6fada814 100644 (file)
@@ -332,13 +332,11 @@ _RealGD( const TStringList& names )
     {
       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
   }
@@ -353,13 +351,11 @@ _RealGD( const TStringList& names )
     {
       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
   }
index df72f66e7e5e86892bd7902a68d3a240edb91c9a..29334e148a6b96caadc683bbfce9a70ca7cea591 100644 (file)
@@ -8,7 +8,7 @@ cpPlugins::IO::ImageWriter::
 ImageWriter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
   this->m_Parameters->SetAcceptedFileExtensions(
     "FileName",
index b0b7227ba7897b4b24b77bed685d409f81a40fad..46f983309100d80414c2a93eda2d348031c43ea2 100644 (file)
@@ -10,7 +10,7 @@ cpPlugins::IO::MeshWriter::
 MeshWriter( )
   : Superclass( )
 {
-  this->_AddInput( "Input" );
+  this->_AddInput( "Input", true );
   this->m_Parameters->ConfigureAsSaveFileName( "FileName" );
   this->m_Parameters->SetAcceptedFileExtensions(
     "FileName",
index 97e96fa2353c512d9c0c0adf535f77adcd8403a8..383b4a202804249da69d0187b3caf6729938a3b6 100644 (file)
@@ -13,7 +13,7 @@ SeedWidget( )
   : Superclass( ),
     m_Configured( false )
 {
-  this->_AddInput( "ReferenceImage" );
+  this->_AddInput( "ReferenceImage", true );
   this->_AddOutput< cpPlugins::Interface::PointList >( "Output" );
 
   this->m_Parameters->ConfigureAsBool( "SeedsAreInRealSpace" );