]> Creatis software - cpPlugins.git/blobdiff - plugins/GenericFilters/JoinBoundingBoxes.cxx
...
[cpPlugins.git] / plugins / GenericFilters / JoinBoundingBoxes.cxx
index 43850723b721acd05f583c3ada61a742d6c5750d..32b0a64ab254704842806a9bb57d0328c963669c 100644 (file)
@@ -7,12 +7,7 @@ cpPluginsGenericFilters::JoinBoundingBoxes::
 JoinBoundingBoxes( )
   : Superclass( )
 {
-  this->_ConfigureInput( "Input0", true, false );
-  this->_ConfigureInput( "Input1", false, false );
-  this->_ConfigureInput( "Input2", false, false );
-  this->_ConfigureInput( "Input3", false, false );
-  this->_ConfigureInput( "Input4", false, false );
-  this->_ConfigureInput( "Input5", false, false );
+  this->_ConfigureInput( "Inputs", true, true );
   this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" );
 }
 
@@ -28,26 +23,20 @@ _GenerateData( )
 {
   typedef cpPlugins::BaseObjects::DataObject _TDO;
   typedef cpPlugins::DataObjects::BoundingBox _TBB;
-  _TDO* dobjs[ 5 ];
-  
-  auto do0   = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) );
-  dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) );
-  dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) );
-  dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) );
-  dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) );
-  dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) );
-  auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
 
-  out->SetDataObject( do0 );
-  for( unsigned int d = 0; d < 5; ++d )
+  auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
+  unsigned int nInputs = this->GetInputSize( "Inputs" );
+  for( unsigned int i = 0; i < nInputs; ++i )
   {
-    if( dobjs[ d ] != NULL )
+    auto in = dynamic_cast< _TDO* >( this->GetInput( "Inputs", i ) );
+    if( i > 0 )
     {
       _TBB::Pointer bb = _TBB::New( );
-      bb->SetDataObject( dobjs[ d ] );
+      bb->SetDataObject( in );
       out->Blend( bb );
-
-    } // fi
+    }
+    else
+      out->SetDataObject( in );
 
   } // rof
 }