]> Creatis software - cpPlugins.git/blobdiff - plugins/GenericFilters/JoinBoundingBoxes.cxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / plugins / GenericFilters / JoinBoundingBoxes.cxx
index d3a0708a1fc03ff711be447e42c2b77e54518331..73f390bde5e71b635afbeb5144c709ee68b048f9 100644 (file)
@@ -1,19 +1,14 @@
-#include <plugins/GenericFilters/JoinBoundingBoxes.h>
-#include <cpPlugins/DataObject.h>
-#include <cpPlugins/BoundingBox.h>
+#include <GenericFilters/JoinBoundingBoxes.h>
+#include <cpPlugins/BaseObjects/DataObject.h>
+#include <cpInstances/BoundingBox.h>
 
 // -------------------------------------------------------------------------
 cpPluginsGenericFilters::JoinBoundingBoxes::
 JoinBoundingBoxes( )
   : Superclass( )
 {
-  this->_AddInput( "Input0" );
-  this->_AddInput( "Input1", false );
-  this->_AddInput( "Input2", false );
-  this->_AddInput( "Input3", false );
-  this->_AddInput( "Input4", false );
-  this->_AddInput( "Input5", false );
-  this->_AddOutput< cpPlugins::BoundingBox >( "Output" );
+  this->_ConfigureInput( "Inputs", true, true );
+  this->_ConfigureOutput< cpInstances::BoundingBox >( "Output" );
 }
 
 // -------------------------------------------------------------------------
@@ -26,28 +21,22 @@ cpPluginsGenericFilters::JoinBoundingBoxes::
 void cpPluginsGenericFilters::JoinBoundingBoxes::
 _GenerateData( )
 {
-  typedef cpPlugins::DataObject _TDO;
-  typedef cpPlugins::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" ) );
+  typedef cpPlugins::BaseObjects::DataObject _TDO;
+  typedef cpInstances::BoundingBox _TBB;
 
-  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
 }