Decision Tree For 3-D Connected Components Labeling

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

2012 INTERNATIONAL SYMPOSIUM ON INFORMATION TECHNOLOGY IN MEDICINE AND EDUCATION

Decision Tree for 3-D Connected Components Labeling

Phaisam Sutheebanjard
Chalermkamchana College
Phetchabun 67000, Thailand
dr. phaisam@gmail.com

the

The equivalences resolution: This is an operation that

fundamental technique in Magnetic Resonance Imaging (MRl).

creates an equivalence table containing the information needed

This research presents the decision tree for

to assign unique labels to each connected component. In the

Abstract-3-D

connected

components

labeling

is

3-D connected

components labeling operation (26-connectivity) in 3-D binary

first image scan, all those labels that belong to one component

images. This method will be used at the first round of the two

are declared equivalent. In the second image scan, one label

scan connected components labeling process. The distinctive

from an equivalent class is selected to be assigned to all pixels

characteristic of this method is its simplicity of the model by

of a component.

using the widely used fundamental algorithm which is the binary


decision tree approach. This is very useful for developers to

P(x.l.V.11

P(X.1.)"1) P(x.y.1)

understand and implement the model rapidly. Moreover, this


model can work correctly and rapidly with less time-consuming.
It spends processing time just a little bit more than the fastest

p(x.l.y)

processing model. Therefore, this method can be considered as


components labeling algorithm.

Figure

Keywords-connected components, decision


processing, labeling algorithm, pattern recognition

tree,

INTRODUCTION

(b) I dentifiers of the single pixels


scan
I. 2 D
mask (8-connectivity)

a:P(x.1.V.l zj)

b:P(x.v.l zj)

d: P(x.l.v.z.1)

e: P(x.v.z.1)

h:P(x.v+l zl)

g: P(xLv+l z1)

Connected components labeling in binary image is one of

p:p(X'I 'LZl
. S,. P(x.l_z1

The labeling operation finds all connected components in an


image and assigns a unique label to all points in the same
component. There have been many algorithms proposed for
Generally,

image

the most fundamental operations in many image processing.

addressing this operation.

(a) PIxels coordmate

one of the interesting techniques to perform 3-D connected

1.

p(x.y)

::

q:P x .1 z)

: ;

c:p(x+1.v.l zj)
fP(x+l.v.z.1)
i:P(x+Lv+1 z1)
r:P(x+Ly.Lz)

. x:p.x _z

(a) Pixels coordinate

these algorithms are

categorized into four classes as the following: (i) one-scan [12J , (ii) two-scan [3-11J, (iii) multi-scan [12J and (iv) contour
tracing [13J algorithms.
Accordingly to Grana et at. [3J , two-scan is the fastest
algorithm for labeling the 2-dimension connected components.
Two-scan is a simple and efficient algorithm in computation
time that was previously introduced by Rosenfeld and Pfaltz in
1966 [4]. It consists of three classical operations:
1.

First image scan: (provisional label assignment

(b) I dentifiers of the single pixels


Figure 2. 3-D scan mask (26-connectivity)

and collection of label equivalences)


2.

Equivalences

resolution:

(equivalence

classes

creation)
3.

Recently, He et al. [16J presented the algorithm for 3-D

Second image scan: (final label assignment)

connected

component

labeling

(26-connectivity)

which

is

considered to be the fastest approach. However, this approach

First image scan: This is an operation in the classical two

might not be simple for developers to use this method for

scan labeling algorithm which accesses the pixels sequentially

further developing.

in raster scan order to find the 8-connectivity in 2-D binary

Therefore, this paper will propose the

simpler method by using fundamental algorithm which is the

image by using the scan mask as shown in Fig. 1 [5J , and find
the 26-connectivity in 3-D binary image by using the scan

binary decision tree model. The advantages of this model are it


is not only easy for developers but also spends just a little

mask as shown in Fig 2.

processing time more than the fastest approach which is


presented by He et al.

978-1-4673-2108-2112/$31.00 2012 IEEE

709

II.

TWO-SCAN ALGORITHM

Instead of using the decision tree, He et al. [7], in 2009,


analyzed the mask for 8-connectivity containing 16 possible

The two-scan algorithm is a method used for labeling the

cases (not including

connected components in a binary image. There are three

"x",

which is the background), as shown

in Fig. 4. Case 1 is the new label action, cases 2-9 and 13-16

classical operations in the two-scan algorithm: first image scan,


equivalences resolution and second image scan. This section

are the assign action and cases 10-12 are the merge action.

presents the literature related to first image scan operations.

Based on these cases, they proposed the algorithm as shown in

The algorithms used in the first scan image operation are

Fig. 5.

classified into 2-dimension and 3-dimension.

A.

2-dimension

This operation accesses the pixels sequentially in raster

(1)

scan order for finding the 8-connectivity by using the pixel

(4)

(3)

(2)

based scan mask as shown in Fig. 1. The conditions outcomes


are

given

by

variables (''p'',

all possible combinations of five Boolean


" "
q , "r", "s", "x") . The actions belong to four

classes: no action, new label, assign, and merge [3].


1.

No action:

is

performed

if

the current

(7)

(8)

(9)

current pixel can take on any


existing provisional label in the mask without the

(10)

(12)

(11)

Assign action:
need

for

consideration

of

label

equivalences

(13)

(either only one pixel is foreground or all pixels


share the same label).
4.

(6)

New label: is created when the neighborhood is


only composed of background pixels.

3.

pixel

belongs to the background.


2.

(5)

Figure 4.

Merge action: is performed to solve equivalence

(14)

(15)

(16)

Sixteen possible cases for the current object pixel in the


mask for eight-connectivity proposed by He et al.

between two or more classes and a representative


is assigned to the current pixel.
In 2005, Wu et al. [6] proposed a decision tree as shown in

1: If (x==Foreground)

Fig. 3 to examine the neighbors of the connected components.

2:

A decision tree is a binary tree whose non-terminal nodes are

3:

conditional variables and whose terminal nodes are actions to

4:

be performed. A decision tree will be defined as being optimal


if it has a minimal number of non-terminal nodes and terminal
nodes. Wu et al. [6J suggested the idea that every pixel in the

If (q==Foreground)
x=q
else if (s==Foreground)

5:

x=s

6:

if (r==Foreground)
x=r+s

7:

scan mask is always the neighbor of " q" (see Fig. 1). If there is

8:

enough equivalence information to access the correct label of


" "
q , there is no need to examine the rest of the neighbors.

else if (p==Foreground)
x=p

9:

if (r==Foreground)

10:

Therefore, their decision tree minimizes the number of scanned

11:

neighbors.

12:

x=p+r
else if (r==Foreground)
x=r

13:
14:

else
x=new label

15:
16: else
17:

no action
Figure 5.

B.

He et al. first-scan algorithm

3-dimension
Labeling of connected components in 3-D binary images

has been studied from the Lumia et al. in 1983 [14J and Shirai
in 1987 [15]. Recently, He et al. in 2010 [16J present an
efficient method of deciding the order for checking voxels in
the mask. They analyze number of the neighbor voxels that
need to be checked. The number of the neighbor voxels of each
Figure 3.

voxel in the mask is shown in Table 1.

The decision tree used in scanning for 8-connectivity.

710

TABLE I.

THE NUMBER OF NEIGHBORING VOXELS TO A VOXEL IN THE

III.

SCAN MASK.

PROPOSED DECISION TREE

When considering the pixel "x" in terms of provisional


label, it can be seen that Suzuki's algorithm [12J scrutinize in
all neighbors within the area of scan masks. In Fig 2, it can be
seen that the area of scan masks contains all neighbors of "e".
If the label of "e" can be accessed precisely, it is not necessary
to consider other neighbors. By neglecting the accuracy aspect,

They can reduce number of voxel to be check, but in the

the decision tree can be presented as a method for organizing

worst case, their algorithm working on all neighbors.

scan operation in a particular order [6]. The proposed model


was shown in Table II. Please note that dash ( ) indicate the
' - '

indent.

TABLE II. THE PROPOSED DECISION TREE ALGORITHM.

if (condition_x) {
-if (condition_e) {
--goto Assign E;
-} else {
--if (condition_q) {
---if (condition_h) {
----if (condition_d) {
-----goto Assign Q;
----) else (
-----if (condition_f) (
------goto Assign Q;
-----) else {
------goto Merge HQ;
-----) Ilelse f
----} Ilelse d
---) else (
----if (condition_g) {
-----if (condition_d) {
------if (condition_i) {
-------goto Merge QI;
------} else (
-------goto Assign Q;
------) Ilelse i
-----} else {
------if (condition_i) {
-------goto Merge GIQ;
------) else {
-------goto Merge GQ;
------) Ilelse i
-----) Ilelse g
----} else {
-----if (condition_i) (
------if (condition_f) {
-------goto Assign Q;
------} else {
-------goto Merge IQ;
------} Ilelse f
-----) else {
------goto Assign Q;
-----) Ilelse i
----) Ilelse g
---) Ilelse h
--) else {
---if (condition_b) (
----if (condition_h) {
-----if (condition_d) {
------goto Assign B;

-----} else {

------} else {

------if (condition_f) {
-------goto Assign B;
------} else {
-------goto Merge BH;
------} Ilelse f
-----) Ilelse d
----) else (
-----if (condition_g) (
------if (condition_d) (
-------if (conditionj) (
--------if (condition_f) {
---------goto Assign B;
--------} else {
---------goto Merge BI;
--------} Ilelse f
-------} else {
--------goto Assign B;
-------} Ilelse i
------} else {
-------if (condition_i) {
--------if (condition_f) {
---------goto Merge BG;
--------} else {
---------goto Merge BGI;
--------} Ilelse f
-------} else {
--------goto Merge BG;
-------) Ilelse i
------) Ilelse d
-----} else {
------if (condition_i) {
-------if (condition_f) {
--------goto Assign B;
-------} else {
--------goto Merge BI;
-------} Ilelse f
------) else {
-------goto Assign B;
------) Ilelse i
-----) Ilelse g
----) Ilelse h
---) else (
----if (condition_d) {
-----if (condition_f) (
------if (condition_h) {
-------goto Assign D;

-------goto Merge DF;


------} Ilelse h
-----} else {
------if (condition_i) {
-------if (condition_h) {
--------if (condition_c) (
---------goto Merge CD;
--------} else {
---------if (conditionJ) {
----------goto Merge DR;
---------} else (
----------goto Assign D;
---------} Ilelse r
--------} Ilelse c
-------) else {
--------if (condition_c) {
---------goto Merge CDl;
--------} else {
---------if (conditionJ) {
----------goto Merge DlR;
---------} else {
----------goto Merge Dl;
---------} Ilelse r
--------} Ilelse c
-------) Ilelse h
------) else {
-------if (condition_c) {
--------goto Merge CD;
-------) else {
--------if (conditionJ) {
---------goto Merge DR;
--------} else {
---------goto Assign D;
--------} Ilelse r
-------} Ilelse c
------} Ilelse i
-----) Ilelse f
----} else (
-----if (condition_h) {
------if (condition_a) (
-------if (condition_s) {
--------if (condition_c) (
---------if (condition_f) (
----------goto Assign H;
---------) else {
----------goto Merge CH;

711

---------} Ilelse f
--------} else {

---------if (conditionJ) {
----------if (condition_f) {
-----------goto Assign H;
----------} else {
-----------goto Merge HR;
----------} Ilelse f
---------} else {
----------goto Assign H;
---------} Ilelse r
--------} Ilelse c
-------) else {
--------if (condition_c) (
---------if (condition_f) {
----------goto Merge AH;
---------} else {
----------goto Merge ACH;
---------} Ilelse f
--------} else {
---------if (conditionJ) {
----------if (condition_f) {
-----------goto Merge AH;
----------} else {
-----------goto Merge AHR;
----------} Ilelse f
---------} else {
----------goto Merge AH;
---------} Ilelse r
--------} Ilelse c
-------} Ilelse s
------) else (
-------if (condition) {
--------if (condition_s) {
---------if (condition_c) {
----------if (condition_f) {
-----------goto Assign H;
----------} else (
-----------goto Merge CH;
----------} Ilelse f
---------} else {
----------if (conditionJ) {
-----------if (condition_f) (
------------goto Assign H;
-----------) else (
------------goto Merge HR;
-----------} Ilelse f

----------) else (
-----------goto Assign H;
----------) Ileise r
---------} Ileise c
--------} else {
---------if (condition_c) {
----------if (condition_f) {
-----------goto Merge HP;
----------} else {
-----------goto Merge CHP;
----------} Ileise f
---------} else {
----------if (conditionJ) {
-----------if (condition_f) (
------------goto Merge HP;
-----------) else (
------------goto Merge HPR;
-----------) Ileise f
----------) else (
-----------goto Merge HP;
----------) Ileise r
---------} Ileise c
--------} Ileise s
-------} else {
--------if (condition_c) {
---------if (condition_f) {
----------goto Assign H;
---------} else {
----------goto Merge CH;
---------} Ileise f
--------} else {
---------if (conditionJ) {
----------if (condition_f) {
-----------goto Assign H;
----------) else (
-----------goto Merge HR;
----------) Ileise f
---------} else (
----------goto Assign H;
---------) Ileise r
--------} Ileise c
-------} Ilelse p
------} Ilelse a
-----} else {
------if (condition_f) {
-------if (condition_s) {
--------goto Merge FS;
-------} else (
--------if (condition_g) {
---------if (condition_a) {
----------goto Merge AFG;
---------} else (
----------if (condition) (
-----------goto Merge FGP;
----------} else {
-----------goto Merge FG;
----------} Ileise p
---------} Ileise a
--------} else {
---------if (condition_a) {
----------goto Merge AF;
---------} else (
----------if (condition) (
-----------goto Merge FP;

------------) else (
-------------goto Merge AG;
------------) Ileise i
-----------) else (
------------if (condition_i) {
-------------goto Merge AI;
------------) else (
-------------goto Assign A;
------------} Ileise i
-----------} Ileise g
----------} Ileise r
---------} Ilelse c
--------} else (
---------if (condition_c) {
----------if (condition) {
-----------if (condition_g) (
------------if (condition_i) {
-------------goto Merge CGIP;
------------) else (
-------------goto Merge CGP;
------------) Ileise i
-----------) else (
------------if (condition_i) {
-------------goto Merge CIP;
------------} else {
-------------goto Merge CP;
------------} Ileise i
-----------} Ileise g
----------} else {
-----------if (condition_g) {
------------if (condition_i) {
-------------goto Merge CGI;
------------) else (
-------------goto Merge CG;
------------) Ileise i
-----------) else (
------------if (condition_i) {
-------------goto Merge CI;
------------} else {
-------------goto Assign C;
------------} Ileise i
-----------} Ileise g
----------} Ileise p
---------} else {
----------if (condition_g) {
-----------if (condition_i) {
------------if (condition) {
-------------if (condition_r) {
--------------goto Merge GIPR;
-------------) else (
--------------goto Merge GIP;
-------------) Ilelse r
------------) else (
-------------if (condition_r) {
--------------goto Merge GIR;
-------------} else {
--------------goto Merge Gl;
-------------} Ilelse r
------------} Ileise p
-----------} else {
------------if (condition) {
-------------if (condition_r) {
--------------goto Merge GPR;
1 else (

----------) else (
-----------goto Assign F;
----------} Ileise p
---------} Ileise a
--------} Ileise g
-------} Ileise s
------) else {
-------if (condition_s) {
--------if (condition_i) {
---------if (condition_c) {
----------goto Merge CIS;
---------} else {
----------if (conditionJ) {
-----------goto Merge IRS;
----------} else {
-----------goto Merge IS;
----------} Ileise r
---------} Ileise c
--------} else {
---------if (condition_c) {
----------goto Merge CS;
---------} else (
----------if (conditionJ) (
-----------goto Merge RS;
----------} else {
-----------goto Assign S;
----------} Ileise r
---------} Ileise c
--------} Ileise i
-------} else (
--------if (condition_a) (
---------if (condition_c) (
----------if (condition_g) (
-----------if (condition_i) {
------------goto Merge ACGI;
-----------) else (
------------goto Merge ACG;
-----------) Ileise i
----------} else {
-----------if (condition_i) {
------------goto Merge ACI;
-----------} else {
------------goto Merge AC;
-----------} Ileise i
----------} Ileise g
---------} else {
----------if (conditionJ) (
-----------if (condition_g) (
------------if (condition_i) {
-------------goto Merge AGIR;
------------) else (
-------------goto Merge AGR;
------------) Ileise i
-----------) else (
------------if (condition_i) {
-------------goto Merge AIR;
------------} else {
-------------goto Merge AR;
------------} Ileise i
-----------} Ileise g
----------} else {
-----------if (condition_g) (
------------if (condition_i) {
-------------goto Merge AGI;

_____________

712

--------------goto Merge GP;


-------------) Ileise r
------------} else (
-------------if (condition_r) {
--------------goto Merge GR;
-------------) else (
--------------goto Assign G;
-------------} Ileise r
------------} Ileise p
-----------} Ileise i
----------} else {
-----------if (condition_i) {
------------if (condition) {
-------------if (conditionJ) (
--------------goto Merge IPR;
-------------) else (
--------------goto Merge IP;
-------------) Ileise r
------------} else (
-------------if (condition_r) {
--------------goto Merge IR;
-------------) else (
--------------goto Assign I;
-------------} Ileise r
------------} Ileise p
-----------} else {
------------if (condition) {
-------------if (conditionJ) {
--------------goto Merge PR;
-------------} else {
--------------goto Assign P;
-------------) Ileise condition_r
------------} else (
-------------if (condition_r) {
--------------goto Assign R;
-------------) else (
--------------goto action_NLB;
-------------) Ileise condition_r
------------} Ilelse condition
-----------} Ileise condition_i
----------} Ileise condition_g
---------} Ileise condition_c
--------} Ileise condition_a
-------} Ilelse condition_s
------} Ilelse conditionj
-----} Ileise condition_h
----) Ileise condition3
---} Ileise condition_b
--} Ileise condition_q
-} Ileise condition_e
) else {
-goto action_NO;
1

IV.

[3]

EXPERIMENTAL RESULTS

The experiment was performed on Ubuntu 12.04 OS with


an Intel Core i5-2450M Processor, 2.50 GHz, 4 cores,

[4]
[5]

our comparison were implemented in C++ using OpenCV

J. L. Pfaltz, "Sequential operations


J. ACM, vol. 13,no. 4,pp. 471-494,1966

in digital picture

A. Rosenfeld, A.C. Kak, "Digital Picture Processing," Academic

Press,

second ed.,vol. 2,San Diego,CA,1982.

library, the compiler is g++. All experimental results presented

[6]

in this section were obtained by averaging the execution time


run

A. Rosenfeld and
processing,"

using a single core for the processing. All algorithms used for

for 100 runs. To prevent one

c. Grana, D. Borghesani and R. Cucchiara, "Optimized block-based


IEEE Transactions
on Image Processing, vol. 19, issue 6,2010.

connected components labeling with decision trees,"

K. Wu, E. Otoo and A. Shoshani, "Optimizing Connected Component


Labeling Algorithms,"

from filling the cache to make

Proceedings of the SPIE,

vol. 5747, pp. 1965-

1976,2005.

subsequent runs faster, we deallocated the image header and

[7]

the image data at the end of each run by calling the standard

L. He, Y. Chao, K. Suzuki, and K. Wu, "Fast connected-component


labeling,"

function (cvReleaseImage()) of OpenCV. On the other hand, all

[8]

algorithms produced the same number of labels and the same

Pattern Recog, vol.

42,no. 9,Sep. 2009.

L. He, Y. Chao, and K. Suzuki, "An Efficient First-Scan Method for


Label-Equivalence-Based Labeling Algorithms,"

Letters, vol.

labeling on all images.


[9]

I used the synthetic dataset of black and white random noise

L. He, Y. Chao, and K. Suzuki, "A Run-based Two-Scan Labeling


Algorithm,"

square images with seven different image sizes from a low

Pattern Recognition

31,2010,pp. 28-35

IEEE

Transactions on Image

Processing,

voLl7, No. 5,

pp. 749-756,2008

resolution of 32x32x10 pixels to a maximum resolution of

[10] L. He, Y. Chao, and K. Suzuki, "A Rtill-Based One-and-a-Half-Scan

2048x2048x10 pixels collected from [3]. The experimental

Connected-Component Labeling Algorithm,"

International Journal of

results show that the proposed method consumes nearly the

Pattern Recognition and Artificial Intelligence,

vol. 24, No. 4, 2010, pp.

557-579.

same computation time as He et al. [16] for all image sizes as

[11] L. He, Y. Chao, and K. Suzuki, "A linear-time two-scan labeling

2007 IEEE International Conference on Image Processing


(ICIP), San Antonio,Texas,USA,September 2007,pp. V-241-V-244.

shown in Table III.

algorithm,"

TABLE III. PERFORMANCE OF EACH ALGORITHM WITH VARYING

[12] K. Suzuki, 1. Horiba, and N. Sugie, "Linear-time connected-component


labeling based on sequential local operations,"

SIZE OF THE IMAGE.

Understand, vol.

Comput Vision Image

89,pp. 1-23,2003.

[13] F. Chang,

Image size

c.J. Chen and c.J. Lu, "A linear-time component-labeling


Computer Vision and Image
Understanding, vol. 93,2004.

algorithm using contour tracing technique,"

Time (ms)
He et aI.

DT

32x32x10

0.465

0.503

64x64xlO

1.583

l .619

128x128x10

5. l 44

5.227

256x256x10

19.615

19.658

512x512x10

77.636

78.014

1024x1024x10

306. l 39

307.581

2048x2048x10

1226.077

1230.73

V.

[14] R. Lumia, L. Shapiro, and O. Zungia, "A new connected components


algorithm for virtual memory computers,"

Process., vol.
[15] Y.

IEEE Transactions on Image Processing,

CONCLUSION

this technique is also used in 2-D connected

and simple aspect of this method, this paper presents the


decision tree model for 3-D connected components labeling
algorithm of binary image. The result indicates that this model
spends a short processing time just a little bit more than the
fastest method [16]. Although this approach does not provide
processing

time,

it

can

be

considered

as

an

interesting technique
REFERENCES
[1]

A. AbuBaker, R. Qahwaji,S. Ipson, and M. Saleh, "One scan connected


component labeling technique," IEEE International Conference on
Signal Processing and Communications (ICSPC 2007), Dubai, United
Arab Emirates,2007,pp. 1283-1286.

[2]

regions,"

in

Three-Dimensional

Springer-Verlag,pp. 86-89,1987.

Connected-Component Labeling Algorithms for 3-D Binary Images,"

components labeling algorithm [6]. Therefore, from the popular

fastest

connected

[16] He, L. Chao, Y. Suzuki, K. ''Two Efficient Label-Equivalence-Based

Decision trees are commonly used as a predictive model in

the

Shirai, "Labeling

Computer Vision. New York:

statistics, data mining and machine learning. In digital image


processing,

Comput. Vis., Graph., Image

22,no. 2,pp. 287-300,1983.

J. Trein, A. T. Schwarzbacher,and B. Hoppe, "FPGA implementation of


a single pass real-time blob analysis using run length encoding," MPC
Workshop. Ravenshurg-Weingarten, Germany,2008,pp. 71-77.

713

Vol. 20 No. 8. August,2011.

You might also like