bbSetOutputOut2( NULL );
bbSetOutputOut3( NULL );
- if (bbGetInputComponent0()!=-1)
- {
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- IEC0->SetInput( bbGetInputIn() );
-#else
- IEC0->SetInputData( bbGetInputIn() );
-#endif
- IEC0->SetComponents( bbGetInputComponent0() );
- IEC0->Update();
- bbSetOutputOut0( IEC0->GetOutput() );
- }
-
- if (bbGetInputComponent1()!=-1)
- {
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- IEC1->SetInput( bbGetInputIn() );
-#else
- IEC1->SetInputData( bbGetInputIn() );
-#endif
- IEC1->SetComponents( bbGetInputComponent1() );
- IEC1->Update();
- bbSetOutputOut1( IEC1->GetOutput() );
- }
-
- if (bbGetInputComponent2()!=-1)
- {
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- IEC2->SetInput( bbGetInputIn() );
-#else
- IEC2->SetInputData( bbGetInputIn() );
-#endif
- IEC2->SetComponents( bbGetInputComponent2() );
- IEC2->Update();
- bbSetOutputOut2( IEC2->GetOutput() );
- }
-
- if (bbGetInputComponent3()!=-1)
- {
-
-//EED 2017-01-01 Migration VTK7
-#if VTK_MAJOR_VERSION <= 5
- IEC3->SetInput( bbGetInputIn() );
-#else
- IEC3->SetInputData( bbGetInputIn() );
-#endif
- IEC3->SetComponents( bbGetInputComponent2() );
- IEC3->Update();
- bbSetOutputOut3( IEC3->GetOutput() );
- }
-
+// InputComponent 0..3
+ if (bbGetInputType()==0)
+ {
+
+ if (bbGetInputComponent0()!=-1)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ IEC0->SetInput( bbGetInputIn() );
+ #else
+ IEC0->SetInputData( bbGetInputIn() );
+ #endif
+ IEC0->SetComponents( bbGetInputComponent0() );
+ IEC0->Update();
+ bbSetOutputOut0( IEC0->GetOutput() );
+ }
+
+ if (bbGetInputComponent1()!=-1)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ IEC1->SetInput( bbGetInputIn() );
+ #else
+ IEC1->SetInputData( bbGetInputIn() );
+ #endif
+ IEC1->SetComponents( bbGetInputComponent1() );
+ IEC1->Update();
+ bbSetOutputOut1( IEC1->GetOutput() );
+ }
+
+ if (bbGetInputComponent2()!=-1)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ IEC2->SetInput( bbGetInputIn() );
+ #else
+ IEC2->SetInputData( bbGetInputIn() );
+ #endif
+ IEC2->SetComponents( bbGetInputComponent2() );
+ IEC2->Update();
+ bbSetOutputOut2( IEC2->GetOutput() );
+ }
+
+ if (bbGetInputComponent3()!=-1)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if VTK_MAJOR_VERSION <= 5
+ IEC3->SetInput( bbGetInputIn() );
+ #else
+ IEC3->SetInputData( bbGetInputIn() );
+ #endif
+ IEC3->SetComponents( bbGetInputComponent2() );
+ IEC3->Update();
+ bbSetOutputOut3( IEC3->GetOutput() );
+ }
+ } // Type 0
+
+// List of components
+ if (bbGetInputType()==1)
+ {
+ int i,size=lstIEC.size();
+ for (i=0; i<size; i++)
+ {
+ lstIEC[i]->Delete();
+ } // for i
+ lstIEC.clear();
+ lstOut.clear();
+ int nrCmp = bbGetInputIn()->GetNumberOfScalarComponents();
+ for (i=0; i<nrCmp; i++)
+ {
+ vtkImageExtractComponents* IEC;
+ IEC=vtkImageExtractComponents::New();
+ IEC->SetInputData( bbGetInputIn() );
+ IEC->SetComponents( bbGetInputComponent2() );
+ IEC->Update();
+ lstIEC.push_back( IEC);
+ lstOut.push_back( IEC->GetOutput() );
+ IEC->Delete();
+ } // for i
+ bbSetOutputLstOut( lstOut );
+ } // Type 1
}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
void ImageExtractComponents::bbUserSetDefaultValues()
{
-
// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
// Here we initialize the input 'In' to 0
bbSetInputIn(NULL);
bbSetInputComponent1(-1);
bbSetInputComponent2(-1);
bbSetInputComponent3(-1);
-
+ bbSetInputType(0);
}
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
//=====
void ImageExtractComponents::bbUserFinalizeProcessing()
{
-
// THE FINALIZATION METHOD BODY :
// Here does nothing
// but this is where you should desallocate the internal/output pointers
// if any
-
IEC0->Delete();
IEC1->Delete();
IEC2->Delete();
IEC3->Delete();
-
+ int i,size=lstIEC.size();
+ for (i=0; i<size; i++)
+ {
+ lstIEC[i]->Delete();
+ } // for i
+ lstIEC.clear();
}
-
}
// EO namespace bbcreaVtk
//=====
#ifndef __bbcreaVtkImageExtractComponents_h_INCLUDED__
#define __bbcreaVtkImageExtractComponents_h_INCLUDED__
+
#include "bbcreaVtk_EXPORT.h"
#include "bbtkAtomicBlackBox.h"
#include "iostream"
+#include <vector>
#include <vtkImageData.h>
#include <vtkImageExtractComponents.h>
BBTK_DECLARE_INPUT(Component1,int);
BBTK_DECLARE_INPUT(Component2,int);
BBTK_DECLARE_INPUT(Component3,int);
- BBTK_DECLARE_OUTPUT(Out0,vtkImageData *);
- BBTK_DECLARE_OUTPUT(Out1,vtkImageData *);
- BBTK_DECLARE_OUTPUT(Out2,vtkImageData *);
- BBTK_DECLARE_OUTPUT(Out3,vtkImageData *);
+ BBTK_DECLARE_INPUT(Type,int);
+ BBTK_DECLARE_OUTPUT(Out0,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out1,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out2,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(Out3,vtkImageData*);
+ BBTK_DECLARE_OUTPUT(LstOut,std::vector< vtkImageData* >);
+
BBTK_PROCESS(Process);
void Process();
vtkImageExtractComponents* IEC1;
vtkImageExtractComponents* IEC2;
vtkImageExtractComponents* IEC3;
+ std::vector<vtkImageExtractComponents*> lstIEC;
+ std::vector<vtkImageData*> lstOut;
+
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
BBTK_AUTHOR("InfoDev");
BBTK_DESCRIPTION("No Description.");
BBTK_CATEGORY("empty");
+
BBTK_INPUT(ImageExtractComponents,In,"Input image",vtkImageData*,"");
BBTK_INPUT(ImageExtractComponents,Component0,"Component 0 (default -1)",int,"");
BBTK_INPUT(ImageExtractComponents,Component1,"Component 1 (default -1)",int,"");
BBTK_INPUT(ImageExtractComponents,Component2,"Component 2 (default -1)",int,"");
BBTK_INPUT(ImageExtractComponents,Component3,"Component 3 (default -1)",int,"");
+ BBTK_INPUT(ImageExtractComponents,Type,"(default 0) 0=Out comp.0..3 , 1=Out List of all components",int,"");
+
BBTK_OUTPUT(ImageExtractComponents,Out0,"Output image 0",vtkImageData*,"");
BBTK_OUTPUT(ImageExtractComponents,Out1,"Output image 1",vtkImageData*,"");
BBTK_OUTPUT(ImageExtractComponents,Out2,"Output image 2",vtkImageData*,"");
BBTK_OUTPUT(ImageExtractComponents,Out3,"Output image 3",vtkImageData*,"");
-BBTK_END_DESCRIBE_BLACK_BOX(ImageExtractComponents);
+ BBTK_OUTPUT(ImageExtractComponents,LstOut,"List of all components by single images",std::vector< vtkImageData* >,"");
+
+ BBTK_END_DESCRIBE_BLACK_BOX(ImageExtractComponents);
//=====
// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
//=====
-}
-// EO namespace bbcreaVtk
+
+
+} // EO namespace bbcreaVtk
#endif // __bbcreaVtkImageExtractComponents_h_INCLUDED__