lib/PDL/Image2D-pp-ccNcompt.c

filter: Statementstmt 17.2% 108 / 626 Branchbran 12.8% 146 / 1138 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 14.4% 254 / 1764 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/PDL/Primitive-pp-random.c ↑ Summary lib/PDL/Ops-pp-and2.c »
1  
2 #line 453 "lib/PDL/PP.pm"
3 /*
4 * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/Image2D.pd! Do not modify!
5 */
6  
7 #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8 if (destroy) { \
9 comp_free_code \
10 } \
11 if ((trans)->dims_redone) { \
12 ntpriv_free_code \
13 }
14  
15 #include "EXTERN.h"
16 #include "perl.h"
17 #include "XSUB.h"
18 #include "pdl.h"
19 #include "pdlcore.h"
20 #define PDL PDL_Image2D
21 extern Core* PDL; /* Structure hold core C functions */
22 #line 23 "lib/PDL/Image2D-pp-ccNcompt.c"
23  
24 /* Fast Modulus with proper negative behaviour */
25  
26 #define REALMOD(a,b) {while ((a)>=(b)) (a) -= (b); while ((a)<0) (a) += (b);}
27  
28 #define X(symbol, ctype, ppsym, ...) \
29 ctype quick_select_ ## ppsym(ctype arr[], int n);
30 PDL_TYPELIST_REAL(X)
31 #undef X
32 #define EZ(x) ez ? 0 : (x)
33 void AddEquiv(PDL_Long* equiv, PDL_Long i, PDL_Long j);
34  
35  
36  
37 #line 1877 "lib/PDL/PP.pm"
38 typedef struct pdl_params_ccNcompt {
39 #line 40 "lib/PDL/Image2D-pp-ccNcompt.c"
40 int con;
41 } pdl_params_ccNcompt;
42  
43  
44 #line 1888 "lib/PDL/PP.pm"
45 pdl_error pdl_ccNcompt_readdata(pdl_trans *__privtrans) {
46 pdl_error PDL_err = {0, NULL, 0};
47 #line 48 "lib/PDL/Image2D-pp-ccNcompt.c"
48 6 pdl_params_ccNcompt *__params = __privtrans->params; (void)__params;
49 6 register PDL_Indx __m_size = __privtrans->ind_sizes[0];
50 6 register PDL_Indx __n_size = __privtrans->ind_sizes[1];
51 6 ▶ if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "broadcast.incs NULL");
Branch: 1 branch
BranchTrueFalseTotal
if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "broadcast.incs NULL"); 0 6 6
52 /* broadcastloop declarations */
53 int __brcloopval;
54 register PDL_Indx __tind0,__tind1; /* counters along dim */
55 6 register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
56 /* dims here are how many steps along those dims */
57 6 register PDL_Indx __tinc0_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
58 6 register PDL_Indx __tinc0_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
59 6 register PDL_Indx __tinc1_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
60 6 register PDL_Indx __tinc1_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
61 #define PDL_BROADCASTLOOP_START_ccNcompt_readdata PDL_BROADCASTLOOP_START( \
62 readdata, \
63 __privtrans->broadcast, \
64 __privtrans->vtable, \
65 a_datap += __offsp[0]; \
66 b_datap += __offsp[1]; \
67 , \
68 ( ,a_datap += __tinc1_a - __tinc0_a * __tdims0 \
69 ,b_datap += __tinc1_b - __tinc0_b * __tdims0 \
70 ), \
71 ( ,a_datap += __tinc0_a \
72 ,b_datap += __tinc0_b \
73 ) \
74 )
75 #define PDL_BROADCASTLOOP_END_ccNcompt_readdata PDL_BROADCASTLOOP_END( \
76 __privtrans->broadcast, \
77 a_datap -= __tinc1_a * __tdims1 + __offsp[0]; \
78 b_datap -= __tinc1_b * __tdims1 + __offsp[1]; \
79 )
80 6 register PDL_Indx __inc_a_m = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_a_m;register PDL_Indx __inc_a_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_a_n;
81 6 register PDL_Indx __inc_b_m = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_b_m;register PDL_Indx __inc_b_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,1)]; (void)__inc_b_n;
82 #ifndef PDL_DECLARE_PARAMS_ccNcompt_1
83 #define PDL_DECLARE_PARAMS_ccNcompt_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_b,PDL_PPSYM_PARAM_b) \
84 PDL_DECLARE_PARAMETER(PDL_TYPE_OP, a, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
85 PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_b, b, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_b)
86 #endif
87 #define PDL_IF_BAD(t,f) f
88 6 switch (__privtrans->__datatype) { /* Start generic switch */
89 0 case PDL_SB: {
90 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_SByte,A,PDL_Long,L) 0 0 0
91 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
92  
93 PDL_Long i,k;
94 PDL_Long newlabel;
95 PDL_Long neighbour[4];
96 PDL_Long nfound;
97 PDL_Long pass,count,next,this;
98 0 PDL_Long *equiv = NULL;
99 PDL_Long i1,j1,i2;
100  
101 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
102 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
103 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
104 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
105 }} /* Close n */}} /* Close m */
106  
107 /* 1st pass counts max possible compts, 2nd records equivalences */
108  
109 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
110  
111 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
112 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
113 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
114 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
115 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
116 0 equiv[i]=i;
117 }
118  
119 0 newlabel = 1; /* Running label */
120  
121 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
122 0 nfound = 0; /* Number of neighbour >0 */
123  
124 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
125  
126 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
127  
128 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
129 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
130 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
131 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
132 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
133 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
134 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
135 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
136  
137 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
138 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
139 }
140 else {
141 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
142 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
143 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
144 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
145 neighbour[k] );
146 }
147 }
148 }
149  
150 else { /* No label */
151  
152 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
153 }
154  
155 }} /* Close n */}} /* Close m */ /* End of image loop */
156  
157 } /* Passes */
158  
159 /* Replace each cycle by single label */
160  
161 0 count = 0;
162 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
163 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
164 0 count++;
165 0 this = i;
166 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
167 0 next = equiv[this];
168 0 equiv[this] = count;
169 0 this = next;
170 }
171 0 equiv[this] = count;
172 }
173  
174  
175 /* Now remove equivalences */
176  
177 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
178 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
179 }} /* Close n */}} /* Close m */
180  
181 0 free(equiv); /* Tidy */
182 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
183 0 } break;
184 1 case PDL_B: {
185 1 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 0 1 1
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 1 0 1
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 0 1 1
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 0 1 1
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 1 0 1
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Byte,B,PDL_Long,L) 0 1 1
186 4 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 1 1
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 1 1
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 1 1
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 1 1
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 1 1
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 1 1 2
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 1 1 2
187  
188 PDL_Long i,k;
189 PDL_Long newlabel;
190 PDL_Long neighbour[4];
191 PDL_Long nfound;
192 PDL_Long pass,count,next,this;
193 1 PDL_Long *equiv = NULL;
194 PDL_Long i1,j1,i2;
195  
196 1 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 1 1
if (__params->con!=4 && __params->con!=8) 0 0 0
197 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
198 651 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 625 25 650
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 25 1 26
199 625 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
200 }} /* Close n */}} /* Close m */
201  
202 /* 1st pass counts max possible compts, 2nd records equivalences */
203  
204 3 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 2 1 3
205  
206 2 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 1 1 2
207 1 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
208 1 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 1 1
209 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
210 315 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 314 1 315
211 314 equiv[i]=i;
212 }
213  
214 2 newlabel = 1; /* Running label */
215  
216 1302 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 1250 50 1300
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 50 2 52
217 1250 nfound = 0; /* Number of neighbour >0 */
218  
219 1250 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
220  
221 1250 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 624 626 1250
222  
223 624 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 600 24 624
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 600 600
224 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
225 624 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 600 24 624
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 600 600
226 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
227 624 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 600 24 624
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 576 24 600
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 576 0 576
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 576 576
228 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
229 624 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 600 24 624
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 576 24 600
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 576 0 576
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 576 576
230 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
231  
232 624 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 624 0 624
233 624 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
234 }
235 else {
236 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
237 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
238 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
239 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
240 neighbour[k] );
241 }
242 }
243 }
244  
245 else { /* No label */
246  
247 626 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
248 }
249  
250 }} /* Close n */}} /* Close m */ /* End of image loop */
251  
252 } /* Passes */
253  
254 /* Replace each cycle by single label */
255  
256 1 count = 0;
257 314 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 313 1 314
258 313 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 313 0 313
259 313 count++;
260 313 this = i;
261 313 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 313 313
262 0 next = equiv[this];
263 0 equiv[this] = count;
264 0 this = next;
265 }
266 313 equiv[this] = count;
267 }
268  
269  
270 /* Now remove equivalences */
271  
272 651 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 625 25 650
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 25 1 26
273 625 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
274 }} /* Close n */}} /* Close m */
275  
276 1 free(equiv); /* Tidy */
277 1 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 1 1
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 1 1
278 1 } break;
279 0 case PDL_S: {
280 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Short,S,PDL_Long,L) 0 0 0
281 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
282  
283 PDL_Long i,k;
284 PDL_Long newlabel;
285 PDL_Long neighbour[4];
286 PDL_Long nfound;
287 PDL_Long pass,count,next,this;
288 0 PDL_Long *equiv = NULL;
289 PDL_Long i1,j1,i2;
290  
291 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
292 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
293 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
294 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
295 }} /* Close n */}} /* Close m */
296  
297 /* 1st pass counts max possible compts, 2nd records equivalences */
298  
299 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
300  
301 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
302 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
303 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
304 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
305 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
306 0 equiv[i]=i;
307 }
308  
309 0 newlabel = 1; /* Running label */
310  
311 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
312 0 nfound = 0; /* Number of neighbour >0 */
313  
314 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
315  
316 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
317  
318 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
319 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
320 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
321 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
322 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
323 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
324 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
325 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
326  
327 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
328 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
329 }
330 else {
331 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
332 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
333 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
334 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
335 neighbour[k] );
336 }
337 }
338 }
339  
340 else { /* No label */
341  
342 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
343 }
344  
345 }} /* Close n */}} /* Close m */ /* End of image loop */
346  
347 } /* Passes */
348  
349 /* Replace each cycle by single label */
350  
351 0 count = 0;
352 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
353 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
354 0 count++;
355 0 this = i;
356 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
357 0 next = equiv[this];
358 0 equiv[this] = count;
359 0 this = next;
360 }
361 0 equiv[this] = count;
362 }
363  
364  
365 /* Now remove equivalences */
366  
367 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
368 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
369 }} /* Close n */}} /* Close m */
370  
371 0 free(equiv); /* Tidy */
372 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
373 0 } break;
374 0 case PDL_US: {
375 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Ushort,U,PDL_Long,L) 0 0 0
376 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
377  
378 PDL_Long i,k;
379 PDL_Long newlabel;
380 PDL_Long neighbour[4];
381 PDL_Long nfound;
382 PDL_Long pass,count,next,this;
383 0 PDL_Long *equiv = NULL;
384 PDL_Long i1,j1,i2;
385  
386 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
387 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
388 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
389 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
390 }} /* Close n */}} /* Close m */
391  
392 /* 1st pass counts max possible compts, 2nd records equivalences */
393  
394 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
395  
396 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
397 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
398 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
399 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
400 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
401 0 equiv[i]=i;
402 }
403  
404 0 newlabel = 1; /* Running label */
405  
406 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
407 0 nfound = 0; /* Number of neighbour >0 */
408  
409 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
410  
411 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
412  
413 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
414 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
415 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
416 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
417 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
418 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
419 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
420 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
421  
422 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
423 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
424 }
425 else {
426 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
427 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
428 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
429 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
430 neighbour[k] );
431 }
432 }
433 }
434  
435 else { /* No label */
436  
437 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
438 }
439  
440 }} /* Close n */}} /* Close m */ /* End of image loop */
441  
442 } /* Passes */
443  
444 /* Replace each cycle by single label */
445  
446 0 count = 0;
447 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
448 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
449 0 count++;
450 0 this = i;
451 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
452 0 next = equiv[this];
453 0 equiv[this] = count;
454 0 this = next;
455 }
456 0 equiv[this] = count;
457 }
458  
459  
460 /* Now remove equivalences */
461  
462 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
463 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
464 }} /* Close n */}} /* Close m */
465  
466 0 free(equiv); /* Tidy */
467 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
468 0 } break;
469 0 case PDL_L: {
470 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Long,L,PDL_Long,L) 0 0 0
471 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
472  
473 PDL_Long i,k;
474 PDL_Long newlabel;
475 PDL_Long neighbour[4];
476 PDL_Long nfound;
477 PDL_Long pass,count,next,this;
478 0 PDL_Long *equiv = NULL;
479 PDL_Long i1,j1,i2;
480  
481 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
482 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
483 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
484 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
485 }} /* Close n */}} /* Close m */
486  
487 /* 1st pass counts max possible compts, 2nd records equivalences */
488  
489 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
490  
491 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
492 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
493 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
494 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
495 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
496 0 equiv[i]=i;
497 }
498  
499 0 newlabel = 1; /* Running label */
500  
501 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
502 0 nfound = 0; /* Number of neighbour >0 */
503  
504 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
505  
506 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
507  
508 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
509 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
510 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
511 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
512 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
513 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
514 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
515 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
516  
517 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
518 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
519 }
520 else {
521 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
522 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
523 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
524 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
525 neighbour[k] );
526 }
527 }
528 }
529  
530 else { /* No label */
531  
532 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
533 }
534  
535 }} /* Close n */}} /* Close m */ /* End of image loop */
536  
537 } /* Passes */
538  
539 /* Replace each cycle by single label */
540  
541 0 count = 0;
542 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
543 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
544 0 count++;
545 0 this = i;
546 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
547 0 next = equiv[this];
548 0 equiv[this] = count;
549 0 this = next;
550 }
551 0 equiv[this] = count;
552 }
553  
554  
555 /* Now remove equivalences */
556  
557 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
558 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
559 }} /* Close n */}} /* Close m */
560  
561 0 free(equiv); /* Tidy */
562 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
563 0 } break;
564 0 case PDL_UL: {
565 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULong,K,PDL_ULong,K) 0 0 0
566 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
567  
568 PDL_Long i,k;
569 PDL_Long newlabel;
570 PDL_Long neighbour[4];
571 PDL_Long nfound;
572 PDL_Long pass,count,next,this;
573 0 PDL_Long *equiv = NULL;
574 PDL_Long i1,j1,i2;
575  
576 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
577 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
578 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
579 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
580 }} /* Close n */}} /* Close m */
581  
582 /* 1st pass counts max possible compts, 2nd records equivalences */
583  
584 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
585  
586 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
587 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
588 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
589 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
590 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
591 0 equiv[i]=i;
592 }
593  
594 0 newlabel = 1; /* Running label */
595  
596 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
597 0 nfound = 0; /* Number of neighbour >0 */
598  
599 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
600  
601 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
602  
603 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
604 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
605 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
606 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
607 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
608 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
609 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
610 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
611  
612 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
613 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
614 }
615 else {
616 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
617 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
618 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
619 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
620 neighbour[k] );
621 }
622 }
623 }
624  
625 else { /* No label */
626  
627 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
628 }
629  
630 }} /* Close n */}} /* Close m */ /* End of image loop */
631  
632 } /* Passes */
633  
634 /* Replace each cycle by single label */
635  
636 0 count = 0;
637 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
638 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
639 0 count++;
640 0 this = i;
641 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
642 0 next = equiv[this];
643 0 equiv[this] = count;
644 0 this = next;
645 }
646 0 equiv[this] = count;
647 }
648  
649  
650 /* Now remove equivalences */
651  
652 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
653 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
654 }} /* Close n */}} /* Close m */
655  
656 0 free(equiv); /* Tidy */
657 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
658 0 } break;
659 0 case PDL_IND: {
660 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Indx,N,PDL_Indx,N) 0 0 0
661 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
662  
663 PDL_Long i,k;
664 PDL_Long newlabel;
665 PDL_Long neighbour[4];
666 PDL_Long nfound;
667 PDL_Long pass,count,next,this;
668 0 PDL_Long *equiv = NULL;
669 PDL_Long i1,j1,i2;
670  
671 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
672 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
673 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
674 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
675 }} /* Close n */}} /* Close m */
676  
677 /* 1st pass counts max possible compts, 2nd records equivalences */
678  
679 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
680  
681 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
682 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
683 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
684 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
685 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
686 0 equiv[i]=i;
687 }
688  
689 0 newlabel = 1; /* Running label */
690  
691 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
692 0 nfound = 0; /* Number of neighbour >0 */
693  
694 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
695  
696 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
697  
698 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
699 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
700 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
701 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
702 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
703 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
704 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
705 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
706  
707 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
708 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
709 }
710 else {
711 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
712 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
713 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
714 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
715 neighbour[k] );
716 }
717 }
718 }
719  
720 else { /* No label */
721  
722 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
723 }
724  
725 }} /* Close n */}} /* Close m */ /* End of image loop */
726  
727 } /* Passes */
728  
729 /* Replace each cycle by single label */
730  
731 0 count = 0;
732 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
733 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
734 0 count++;
735 0 this = i;
736 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
737 0 next = equiv[this];
738 0 equiv[this] = count;
739 0 this = next;
740 }
741 0 equiv[this] = count;
742 }
743  
744  
745 /* Now remove equivalences */
746  
747 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
748 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
749 }} /* Close n */}} /* Close m */
750  
751 0 free(equiv); /* Tidy */
752 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
753 0 } break;
754 0 case PDL_ULL: {
755 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_ULongLong,P,PDL_ULongLong,P) 0 0 0
756 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
757  
758 PDL_Long i,k;
759 PDL_Long newlabel;
760 PDL_Long neighbour[4];
761 PDL_Long nfound;
762 PDL_Long pass,count,next,this;
763 0 PDL_Long *equiv = NULL;
764 PDL_Long i1,j1,i2;
765  
766 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
767 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
768 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
769 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
770 }} /* Close n */}} /* Close m */
771  
772 /* 1st pass counts max possible compts, 2nd records equivalences */
773  
774 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
775  
776 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
777 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
778 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
779 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
780 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
781 0 equiv[i]=i;
782 }
783  
784 0 newlabel = 1; /* Running label */
785  
786 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
787 0 nfound = 0; /* Number of neighbour >0 */
788  
789 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
790  
791 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
792  
793 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
794 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
795 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
796 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
797 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
798 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
799 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
800 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
801  
802 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
803 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
804 }
805 else {
806 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
807 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
808 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
809 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
810 neighbour[k] );
811 }
812 }
813 }
814  
815 else { /* No label */
816  
817 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
818 }
819  
820 }} /* Close n */}} /* Close m */ /* End of image loop */
821  
822 } /* Passes */
823  
824 /* Replace each cycle by single label */
825  
826 0 count = 0;
827 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
828 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
829 0 count++;
830 0 this = i;
831 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
832 0 next = equiv[this];
833 0 equiv[this] = count;
834 0 this = next;
835 }
836 0 equiv[this] = count;
837 }
838  
839  
840 /* Now remove equivalences */
841  
842 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
843 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
844 }} /* Close n */}} /* Close m */
845  
846 0 free(equiv); /* Tidy */
847 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
848 0 } break;
849 0 case PDL_LL: {
850 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LongLong,Q,PDL_LongLong,Q) 0 0 0
851 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
852  
853 PDL_Long i,k;
854 PDL_Long newlabel;
855 PDL_Long neighbour[4];
856 PDL_Long nfound;
857 PDL_Long pass,count,next,this;
858 0 PDL_Long *equiv = NULL;
859 PDL_Long i1,j1,i2;
860  
861 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
862 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
863 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
864 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
865 }} /* Close n */}} /* Close m */
866  
867 /* 1st pass counts max possible compts, 2nd records equivalences */
868  
869 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
870  
871 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
872 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
873 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
874 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
875 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
876 0 equiv[i]=i;
877 }
878  
879 0 newlabel = 1; /* Running label */
880  
881 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
882 0 nfound = 0; /* Number of neighbour >0 */
883  
884 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
885  
886 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
887  
888 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
889 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
890 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
891 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
892 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
893 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
894 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
895 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
896  
897 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
898 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
899 }
900 else {
901 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
902 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
903 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
904 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
905 neighbour[k] );
906 }
907 }
908 }
909  
910 else { /* No label */
911  
912 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
913 }
914  
915 }} /* Close n */}} /* Close m */ /* End of image loop */
916  
917 } /* Passes */
918  
919 /* Replace each cycle by single label */
920  
921 0 count = 0;
922 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
923 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
924 0 count++;
925 0 this = i;
926 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
927 0 next = equiv[this];
928 0 equiv[this] = count;
929 0 this = next;
930 }
931 0 equiv[this] = count;
932 }
933  
934  
935 /* Now remove equivalences */
936  
937 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
938 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
939 }} /* Close n */}} /* Close m */
940  
941 0 free(equiv); /* Tidy */
942 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
943 0 } break;
944 0 case PDL_F: {
945 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Float,F,PDL_Float,F) 0 0 0
946 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
947  
948 PDL_Long i,k;
949 PDL_Long newlabel;
950 PDL_Long neighbour[4];
951 PDL_Long nfound;
952 PDL_Long pass,count,next,this;
953 0 PDL_Long *equiv = NULL;
954 PDL_Long i1,j1,i2;
955  
956 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
957 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
958 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
959 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
960 }} /* Close n */}} /* Close m */
961  
962 /* 1st pass counts max possible compts, 2nd records equivalences */
963  
964 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
965  
966 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
967 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
968 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
969 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
970 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
971 0 equiv[i]=i;
972 }
973  
974 0 newlabel = 1; /* Running label */
975  
976 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
977 0 nfound = 0; /* Number of neighbour >0 */
978  
979 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
980  
981 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
982  
983 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
984 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
985 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
986 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
987 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
988 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
989 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
990 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
991  
992 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
993 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
994 }
995 else {
996 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
997 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
998 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
999 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
1000 neighbour[k] );
1001 }
1002 }
1003 }
1004  
1005 else { /* No label */
1006  
1007 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
1008 }
1009  
1010 }} /* Close n */}} /* Close m */ /* End of image loop */
1011  
1012 } /* Passes */
1013  
1014 /* Replace each cycle by single label */
1015  
1016 0 count = 0;
1017 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
1018 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
1019 0 count++;
1020 0 this = i;
1021 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
1022 0 next = equiv[this];
1023 0 equiv[this] = count;
1024 0 this = next;
1025 }
1026 0 equiv[this] = count;
1027 }
1028  
1029  
1030 /* Now remove equivalences */
1031  
1032 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
1033 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
1034 }} /* Close n */}} /* Close m */
1035  
1036 0 free(equiv); /* Tidy */
1037 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
1038 0 } break;
1039 5 case PDL_D: {
1040 5 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 0 5 5
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 5 0 5
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 0 5 5
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 0 5 5
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 5 0 5
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_Double,D,PDL_Double,D) 0 5 5
1041 18 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 5 5
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 5 5
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 5 5
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 5 5
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 5 5
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 5 4 9
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 5 4 9
1042  
1043 PDL_Long i,k;
1044 PDL_Long newlabel;
1045 PDL_Long neighbour[4];
1046 PDL_Long nfound;
1047 PDL_Long pass,count,next,this;
1048 5 PDL_Long *equiv = NULL;
1049 PDL_Long i1,j1,i2;
1050  
1051 5 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 3 2 5
if (__params->con!=4 && __params->con!=8) 1 2 3
1052 1 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
1053 744 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 700 40 740
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 40 4 44
1054 700 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
1055 }} /* Close n */}} /* Close m */
1056  
1057 /* 1st pass counts max possible compts, 2nd records equivalences */
1058  
1059 12 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 8 4 12
1060  
1061 8 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 4 4 8
1062 4 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
1063 4 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 4 4
1064 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
1065 339 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 335 4 339
1066 335 equiv[i]=i;
1067 }
1068  
1069 8 newlabel = 1; /* Running label */
1070  
1071 1488 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 1400 80 1480
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 80 8 88
1072 1400 nfound = 0; /* Number of neighbour >0 */
1073  
1074 1400 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
1075  
1076 1400 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 684 716 1400
1077  
1078 684 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 648 36 684
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 12 636 648
1079 12 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
1080 684 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 642 42 684
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 6 636 642
1081 6 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
1082 684 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 642 42 684
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 606 36 642
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 594 12 606
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 12 582 594
1083 12 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
1084 684 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 642 42 684
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 612 30 642
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 582 30 612
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 4 578 582
1085 4 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
1086  
1087 684 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 654 30 684
1088 654 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
1089 }
1090 else {
1091 30 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
1092 30 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 4 26 30
if (nfound>1 && pass == 1) { /* Assign equivalents */ 2 2 4
1093 4 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 2 2 4
1094 2 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
1095 neighbour[k] );
1096 }
1097 }
1098 }
1099  
1100 else { /* No label */
1101  
1102 716 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
1103 }
1104  
1105 }} /* Close n */}} /* Close m */ /* End of image loop */
1106  
1107 } /* Passes */
1108  
1109 /* Replace each cycle by single label */
1110  
1111 4 count = 0;
1112 335 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 331 4 335
1113 331 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 331 0 331
1114 331 count++;
1115 331 this = i;
1116 331 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 331 331
1117 0 next = equiv[this];
1118 0 equiv[this] = count;
1119 0 this = next;
1120 }
1121 331 equiv[this] = count;
1122 }
1123  
1124  
1125 /* Now remove equivalences */
1126  
1127 744 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 700 40 740
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 40 4 44
1128 700 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
1129 }} /* Close n */}} /* Close m */
1130  
1131 4 free(equiv); /* Tidy */
1132 4 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 4 4
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 4 4
1133 4 } break;
1134 0 case PDL_LD: {
1135 0 ▶ PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E)
Branch: 6 branches
BranchTrueFalseTotal
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
PDL_DECLARE_PARAMS_ccNcompt_1(PDL_LDouble,E,PDL_LDouble,E) 0 0 0
1136 0 ▶ PDL_BROADCASTLOOP_START_ccNcompt_readdata {
Branch: 7 branches
BranchTrueFalseTotal
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
PDL_BROADCASTLOOP_START_ccNcompt_readdata { 0 0 0
1137  
1138 PDL_Long i,k;
1139 PDL_Long newlabel;
1140 PDL_Long neighbour[4];
1141 PDL_Long nfound;
1142 PDL_Long pass,count,next,this;
1143 0 PDL_Long *equiv = NULL;
1144 PDL_Long i1,j1,i2;
1145  
1146 0 ▶ if (__params->con!=4 && __params->con!=8)
Branch: 2 branches
BranchTrueFalseTotal
if (__params->con!=4 && __params->con!=8) 0 0 0
if (__params->con!=4 && __params->con!=8) 0 0 0
1147 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "In ccNcompt, connectivity must be 4 or 8, you gave %d",__params->con);
1148 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Copy */ 0 0 0
1149 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = (a_datap)[0+(__inc_a_m*(m))+(__inc_a_n*(n))];
1150 }} /* Close n */}} /* Close m */
1151  
1152 /* 1st pass counts max possible compts, 2nd records equivalences */
1153  
1154 0 ▶ for (pass = 0; pass<2; pass++) {
Branch: 1 branch
BranchTrueFalseTotal
for (pass = 0; pass<2; pass++) { 0 0 0
1155  
1156 0 ▶ if (pass==1) {
Branch: 1 branch
BranchTrueFalseTotal
if (pass==1) { 0 0 0
1157 0 equiv = (PDL_Long*) malloc((newlabel+1)*sizeof(PDL_Long));
1158 0 ▶ if (equiv==(PDL_Long*)0)
Branch: 1 branch
BranchTrueFalseTotal
if (equiv==(PDL_Long*)0) 0 0 0
1159 0 return PDL->make_error(PDL_EUSERERROR, "Error in ccNcompt:" "Out of memory");
1160 0 ▶ for(i=0;i<=newlabel;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<=newlabel;i++) 0 0 0
1161 0 equiv[i]=i;
1162 }
1163  
1164 0 newlabel = 1; /* Running label */
1165  
1166 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
1167 0 nfound = 0; /* Number of neighbour >0 */
1168  
1169 0 i1 = m-1; j1 = n-1; i2 = m+1; /*West x, North y, East x*/
1170  
1171 0 ▶ if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */
Branch: 1 branch
BranchTrueFalseTotal
if ((b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] > 0) { /* Check 4 neighbour already seen */ 0 0 0
1172  
1173 0 ▶ if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/
Branch: 2 branches
BranchTrueFalseTotal
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
if (m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]>0) /*West*/ 0 0 0
1174 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(n))]; /* Store label of it */
1175 0 ▶ if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/
Branch: 2 branches
BranchTrueFalseTotal
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
if (n>0 && (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))]>0) /*North*/ 0 0 0
1176 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(j1))];
1177 0 ▶ if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
if (n>0 && m>0 && (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-West*/ 0 0 0
1178 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i1))+(__inc_b_n*(j1))];
1179 0 ▶ if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/
Branch: 4 branches
BranchTrueFalseTotal
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
if (n>0 && m<(__privtrans->ind_sizes[0]-1) && (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))]>0 && __params->con == 8) /*North-East*/ 0 0 0
1180 0 neighbour[nfound++] = (b_datap)[0+(__inc_b_m*(i2))+(__inc_b_n*(j1))];
1181  
1182 0 ▶ if (nfound==0) { /* Assign new label */
Branch: 1 branch
BranchTrueFalseTotal
if (nfound==0) { /* Assign new label */ 0 0 0
1183 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = newlabel++;
1184 }
1185 else {
1186 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = neighbour[0];
1187 0 ▶ if (nfound>1 && pass == 1) { /* Assign equivalents */
Branch: 2 branches
BranchTrueFalseTotal
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
if (nfound>1 && pass == 1) { /* Assign equivalents */ 0 0 0
1188 0 ▶ for(k=1; k<nfound; k++)
Branch: 1 branch
BranchTrueFalseTotal
for(k=1; k<nfound; k++) 0 0 0
1189 0 AddEquiv( equiv, (PDL_Long)(b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))],
1190 neighbour[k] );
1191 }
1192 }
1193 }
1194  
1195 else { /* No label */
1196  
1197 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = 0;
1198 }
1199  
1200 }} /* Close n */}} /* Close m */ /* End of image loop */
1201  
1202 } /* Passes */
1203  
1204 /* Replace each cycle by single label */
1205  
1206 0 count = 0;
1207 0 ▶ for (i = 1; i <= newlabel; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 1; i <= newlabel; i++) 0 0 0
1208 0 ▶ if ( i <= equiv[i] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ( i <= equiv[i] ) { 0 0 0
1209 0 count++;
1210 0 this = i;
1211 0 ▶ while ( equiv[this] != i ) {
Branch: 1 branch
BranchTrueFalseTotal
while ( equiv[this] != i ) { 0 0 0
1212 0 next = equiv[this];
1213 0 equiv[this] = count;
1214 0 this = next;
1215 }
1216 0 equiv[this] = count;
1217 }
1218  
1219  
1220 /* Now remove equivalences */
1221  
1222 0 ▶ {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */
Branch: 2 branches
BranchTrueFalseTotal
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
{/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {{/* Open m */ PDL_EXPAND2(register PDL_Indx m=0, __m_stop=(__m_size)); for(; m<__m_stop; m+=1) { /* Loop over image pixels */ 0 0 0
1223 0 (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] = equiv[ (PDL_Long) (b_datap)[0+(__inc_b_m*(m))+(__inc_b_n*(n))] ] ;
1224 }} /* Close n */}} /* Close m */
1225  
1226 0 free(equiv); /* Tidy */
1227 0 ▶ }PDL_BROADCASTLOOP_END_ccNcompt_readdata
Branch: 2 branches
BranchTrueFalseTotal
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
}PDL_BROADCASTLOOP_END_ccNcompt_readdata 0 0 0
1228 0 } break;
1229 0 default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in ccNcompt: unhandled datatype(%d), only handles (ABSULKNPQFDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
1230 }
1231 #undef PDL_IF_BAD
1232 5 return PDL_err;
1233 }
1234  
1235 static pdl_datatypes pdl_ccNcompt_vtable_gentypes[] = { PDL_SB, PDL_B, PDL_S, PDL_US, PDL_L, PDL_UL, PDL_IND, PDL_ULL, PDL_LL, PDL_F, PDL_D, PDL_LD, -1 };
1236 static PDL_Indx pdl_ccNcompt_vtable_realdims[] = { 2, 2 };
1237 static char *pdl_ccNcompt_vtable_parnames[] = { "a","b" };
1238 static short pdl_ccNcompt_vtable_parflags[] = {
1239 0,
1240 PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTPLUS|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
1241 };
1242 static pdl_datatypes pdl_ccNcompt_vtable_partypes[] = { -1, PDL_L };
1243 static PDL_Indx pdl_ccNcompt_vtable_realdims_starts[] = { 0, 2 };
1244 static PDL_Indx pdl_ccNcompt_vtable_realdims_ind_ids[] = { 0, 1, 0, 1 };
1245 static char *pdl_ccNcompt_vtable_indnames[] = { "m","n" };
1246 pdl_transvtable pdl_ccNcompt_vtable = {
1247 PDL_TRANS_DO_BROADCAST|PDL_TRANS_BADIGNORE, 0, pdl_ccNcompt_vtable_gentypes, 1, 2, NULL /*CORE21*/,
1248 pdl_ccNcompt_vtable_realdims, pdl_ccNcompt_vtable_parnames,
1249 pdl_ccNcompt_vtable_parflags, pdl_ccNcompt_vtable_partypes,
1250 pdl_ccNcompt_vtable_realdims_starts, pdl_ccNcompt_vtable_realdims_ind_ids, 4,
1251 2, pdl_ccNcompt_vtable_indnames,
1252 NULL, pdl_ccNcompt_readdata, NULL,
1253 NULL,
1254 sizeof(pdl_params_ccNcompt),"PDL::Image2D::ccNcompt"
1255 };
1256  
1257  
1258 6 pdl_error pdl_run_ccNcompt(pdl *a,pdl *b,int con) {
1259 6 pdl_error PDL_err = {0, NULL, 0};
1260 6 ▶ if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
Branch: 1 branch
BranchTrueFalseTotal
if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; 0 6 6
1261 6 pdl_trans *__privtrans = PDL->create_trans(&pdl_ccNcompt_vtable);
1262 6 ▶ if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
Branch: 1 branch
BranchTrueFalseTotal
if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); 0 6 6
1263 6 pdl_params_ccNcompt *__params = __privtrans->params;
1264 6 __privtrans->pdls[0] = a;
1265 6 __privtrans->pdls[1] = b;
1266 6 ▶ PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); 0 6 6
1267 6 (__params->con) = (con); /* CType.get_copy */
1268 6 ▶ PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); 1 5 6
1269 5 return PDL_err;
1270 }
« lib/PDL/Primitive-pp-random.c ↑ Summary lib/PDL/Ops-pp-and2.c »