]> Creatis software - creaVtk.git/blob - bbtk_creaVtk_PKG/src/bbcreaVtkImageConnectivityFilter.cxx
#3437 creaVtk Feature New Normal - Connectivity Filter (s) box and LstOfVoxels box
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkImageConnectivityFilter.cxx
1 //===== 
2 // 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)
3 //===== 
4 #include "bbcreaVtkImageConnectivityFilter.h"
5 #include "bbcreaVtkPackage.h"
6
7 namespace bbcreaVtk
8 {
9
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageConnectivityFilter)
11 BBTK_BLACK_BOX_IMPLEMENTATION(ImageConnectivityFilter,bbtk::AtomicBlackBox);
12 //===== 
13 // 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)
14 //===== 
15 void ImageConnectivityFilter::Process()
16 {
17
18 // THE MAIN PROCESSING METHOD BODY
19 //   Here we simply set the input 'In' value to the output 'Out'
20 //   And print out the output value
21 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
22 //    void bbSet{Input|Output}NAME(const TYPE&)
23 //    const TYPE& bbGet{Input|Output}NAME() const 
24 //    Where :
25 //    * NAME is the name of the input/output
26 //      (the one provided in the attribute 'name' of the tag 'input')
27 //    * TYPE is the C++ type of the input/output
28 //      (the one provided in the attribute 'type' of the tag 'input')
29
30
31         if (bbGetInputIn()!=NULL){
32                 if (imgConnfilter) {imgConnfilter->Delete();}
33                 imgConnfilter=vtkImageConnectivityFilter::New();
34                 imgConnfilter->SetInputData( bbGetInputIn() );
35                 if (bbGetInputExtractionMode()==0)  // LargestRegion
36                 {
37                         imgConnfilter->SetExtractionModeToLargestRegion();
38                 } // ExtractionMode
39
40                 if (bbGetInputExtractionMode()==1) // AllRegions   
41                 {
42                         printf("EED Warning!!!! ImageConnectivityFilter - AllRegions Not Implemented\n ");
43                 } // ExtractionMode
44                 if (bbGetInputExtractionMode()==2)  // SeededRegions
45                 {
46                         printf("EED Warning!!!! ImageConnectivityFilter  - SeededRegions Not Implemented\n ");
47                 } // ExtractionMode
48
49                 if (bbGetInputScalarRange().size()==2)  
50                 {
51                         imgConnfilter->SetScalarRange( bbGetInputScalarRange()[0], bbGetInputScalarRange()[1] );
52                 } // Range
53                 imgConnfilter->Update();
54                 bbSetOutputOut( imgConnfilter->GetOutput() );
55         } else {
56                         printf("EED Warning!!!! ImageConnectivityFilter  - Input image not defined.\n ");
57         }// In
58   
59 }
60 //===== 
61 // 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)
62 //===== 
63 void ImageConnectivityFilter::bbUserSetDefaultValues()
64 {
65
66 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
67 //    Here we initialize the input 'In' to 0
68         bbSetInputIn(NULL);
69 //      bbSetInputScalarRange();
70         imgConnfilter=NULL;
71         bbSetInputExtractionMode(0);
72
73 }
74 //===== 
75 // 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)
76 //===== 
77 void ImageConnectivityFilter::bbUserInitializeProcessing()
78 {
79
80 //  THE INITIALIZATION METHOD BODY :
81 //    Here does nothing 
82 //    but this is where you should allocate the internal/output pointers 
83 //    if any 
84
85   
86 }
87 //===== 
88 // 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)
89 //===== 
90 void ImageConnectivityFilter::bbUserFinalizeProcessing()
91 {
92
93 //  THE FINALIZATION METHOD BODY :
94 //    Here does nothing 
95 //    but this is where you should desallocate the internal/output pointers 
96 //    if any
97   
98 }
99 }
100 // EO namespace bbcreaVtk
101
102