00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <flgrCoreData.h>
00023 #include <flgrCoreDataIO.h>
00024 #include <flgrCoreShift.h>
00025 #include <flgrCoreCopy.h>
00026 #include <flgrCoreCompare.h>
00027 #include <flgrCoreDispatch.h>
00028 #include <flgrCoreVector.h>
00029 #include <flgrCoreArithVector.h>
00030 #include <flgrArith.h>
00031 #include <flgrMeasureBase.h>
00032 #include "flgrMorphoGeodesyFast.h"
00033 #include "flgrMorphoBase.h"
00034
00042 #define FLGR_MACRO_LINE_ERODE(dtype,lout,lin,ltmp1,ltmp0) \
00043 flgr1d_shift_right_##dtype(ltmp0,lin, 1, vec); \
00044 flgr1d_shift_left_##dtype(ltmp1,lin, 1, vec); \
00045 flgr1d_arith_inf_##dtype(ltmp0,ltmp1,ltmp0); \
00046 flgr1d_arith_inf_##dtype(lout,lin,ltmp0)
00047
00048 #define FLGR_MACRO_LINE_RIGHT_ERODE(dtype,lout,lin,ltmp0) \
00049 flgr1d_shift_right_##dtype(ltmp0,lin, 1, vec); \
00050 flgr1d_arith_inf_##dtype(lout,ltmp0,lin)
00051
00052 #define FLGR_MACRO_LINE_LEFT_ERODE(dtype,lout,lin,ltmp0) \
00053 flgr1d_shift_left_##dtype(ltmp0,lin, 1, vec); \
00054 flgr1d_arith_inf_##dtype(lout,ltmp0,lin)
00055
00056 #define FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(dtype) \
00057 FLGR_Data1D *tmpL0 = flgr1d_create_signal_from(datmask->row[0]); \
00058 FLGR_Data1D *tmpL1 = flgr1d_create_signal_from(datmask->row[0]); \
00059 FLGR_Data1D *tmp0 = flgr1d_create_signal_from(datmask->row[0]); \
00060 FLGR_Data1D *tmp1 = flgr1d_create_signal_from(datmask->row[0]); \
00061 FLGR_Data1D *tmp2 = flgr1d_create_signal_from(datmask->row[0]); \
00062 FLGR_Data1D *tmpsav; \
00063 FLGR_Data1D **pout = datmark->row; \
00064 FLGR_Data1D **pin = datmark->row; \
00065 FLGR_Data1D **pmask = datmask->row; \
00066 FLGR_Vector *vec = flgr_vector_create(datmask->spp,datmask->type); \
00067 dtype max = MAX_##dtype; \
00068 int i,k,j; \
00069 \
00070 \
00071 \
00072 flgr_vector_populate_from_scalar_##dtype(vec,max); \
00073 \
00074 FLGR_MACRO_LINE_ERODE(dtype,tmp0,pin[0],tmpL0,tmpL1); \
00075 FLGR_MACRO_LINE_ERODE(dtype,tmp1,pin[1],tmpL0,tmpL1); \
00076 \
00077 flgr1d_arith_inf_##dtype(pout[0],tmp0,tmp1); \
00078 flgr1d_arith_sup_##dtype(pout[0],pmask[0],pout[0]); \
00079 \
00080 \
00081 for(i=0,j=1,k=2 ; i<datmask->size_y-2 ; i++,j++,k++) { \
00082 FLGR_MACRO_LINE_ERODE(dtype,tmp2,pin[k],tmpL0,tmpL1); \
00083 flgr1d_arith_inf_##dtype(tmp0,tmp1,tmp0); \
00084 flgr1d_arith_inf_##dtype(pout[j],tmp0,tmp2); \
00085 flgr1d_arith_sup_##dtype(pout[j],pmask[j],pout[j]); \
00086 \
00087 tmpsav=tmp0; \
00088 tmp0=tmp1; \
00089 tmp1=tmp2; \
00090 tmp2=tmpsav; \
00091 } \
00092 \
00093 j = datmask->size_y-1; \
00094 \
00095 flgr1d_arith_inf_##dtype(pout[j],tmp0,tmp1); \
00096 flgr1d_arith_sup_##dtype(pout[j],pmask[j],pout[j]); \
00097 \
00098 flgr_vector_destroy(vec); \
00099 flgr1d_destroy(tmpL0); \
00100 flgr1d_destroy(tmpL1); \
00101 flgr1d_destroy(tmp0); \
00102 flgr1d_destroy(tmp1); \
00103 flgr1d_destroy(tmp2)
00104
00105
00106
00107 void flgr2d_geodesic_erode_8_connexity_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00108 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgBIT);
00109 }
00110 void flgr2d_geodesic_erode_8_connexity_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00111 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgUINT8);
00112 }
00113 void flgr2d_geodesic_erode_8_connexity_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00114 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgUINT16);
00115 }
00116 void flgr2d_geodesic_erode_8_connexity_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00117 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgUINT32);
00118 }
00119 void flgr2d_geodesic_erode_8_connexity_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00120 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgINT8);
00121 }
00122 void flgr2d_geodesic_erode_8_connexity_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00123 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgINT16);
00124 }
00125 void flgr2d_geodesic_erode_8_connexity_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00126 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgINT32);
00127 }
00128 void flgr2d_geodesic_erode_8_connexity_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00129 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgFLOAT32);
00130 }
00131 void flgr2d_geodesic_erode_8_connexity_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00132 FLGR_MACRO_GEODESIC_ERODE_8_CONNEXITY(fgFLOAT64);
00133 }
00134
00135 FLGR_Ret flgr2d_geodesic_erode_8_connexity(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00136 FLGR_Ret ret;
00137
00138
00139
00140 if((datmark==NULL) || (datmask==NULL)) {
00141 POST_ERROR("Null objects!\n");
00142 return FLGR_RET_NULL_OBJECT;
00143 }
00144
00145 if((ret=flgr2d_is_data_same_attributes(datmask,datmark,__FUNCTION__))!=FLGR_RET_OK) return ret;
00146
00147 FLGR_DISPATCH_PROCEDURE(datmask->type,flgr2d_geodesic_erode_8_connexity,datmark,datmask);
00148
00149 }
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 #define FLGR_MACRO_LINE_DILATE(dtype,lout,lin,ltmp1,ltmp0) \
00169 flgr1d_shift_right_##dtype(ltmp0,lin, 1,vec); \
00170 flgr1d_shift_left_##dtype(ltmp1,lin, 1,vec); \
00171 flgr1d_arith_sup_##dtype(ltmp0,ltmp1,ltmp0); \
00172 flgr1d_arith_sup_##dtype(lout,lin,ltmp0)
00173
00174 #define FLGR_MACRO_LINE_RIGHT_DILATE(dtype,lout,lin,ltmp0) \
00175 flgr1d_shift_right_##dtype(ltmp0,lin, 1,vec); \
00176 flgr1d_arith_sup_##dtype(lout,ltmp0,lin)
00177
00178 #define FLGR_MACRO_LINE_LEFT_DILATE(dtype,lout,lin,ltmp0) \
00179 flgr1d_shift_left_##dtype(ltmp0,lin, 1,vec); \
00180 flgr1d_arith_sup_##dtype(lout,ltmp0,lin)
00181
00182 #define FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(dtype) \
00183 FLGR_Data1D *tmpL0 = flgr1d_create_signal_from(datmask->row[0]); \
00184 FLGR_Data1D *tmpL1 = flgr1d_create_signal_from(datmask->row[0]); \
00185 FLGR_Data1D *tmp0 = flgr1d_create_signal_from(datmask->row[0]); \
00186 FLGR_Data1D *tmp1 = flgr1d_create_signal_from(datmask->row[0]); \
00187 FLGR_Data1D *tmp2 = flgr1d_create_signal_from(datmask->row[0]); \
00188 FLGR_Data1D *tmpsav; \
00189 FLGR_Data1D **pout = datmark->row; \
00190 FLGR_Data1D **pin = datmark->row; \
00191 FLGR_Data1D **pmask = datmask->row; \
00192 FLGR_Vector *vec = flgr_vector_create(datmask->spp,datmask->type); \
00193 dtype min = MIN_##dtype; \
00194 int i,k,j; \
00195 \
00196 \
00197 \
00198 flgr_vector_populate_from_scalar_##dtype(vec,min); \
00199 \
00200 FLGR_MACRO_LINE_DILATE(dtype,tmp0,pin[0],tmpL0,tmpL1); \
00201 FLGR_MACRO_LINE_DILATE(dtype,tmp1,pin[1],tmpL0,tmpL1); \
00202 \
00203 flgr1d_arith_sup_##dtype(pout[0],tmp0,tmp1); \
00204 flgr1d_arith_inf_##dtype(pout[0],pmask[0],pout[0]); \
00205 \
00206 \
00207 for(i=0,j=1,k=2 ; i<datmask->size_y-2 ; i++,j++,k++) { \
00208 FLGR_MACRO_LINE_DILATE(dtype,tmp2,pin[k],tmpL0,tmpL1); \
00209 flgr1d_arith_sup_##dtype(tmp0,tmp1,tmp0); \
00210 flgr1d_arith_sup_##dtype(pout[j],tmp0,tmp2); \
00211 flgr1d_arith_inf_##dtype(pout[j],pmask[j],pout[j]); \
00212 \
00213 tmpsav=tmp0; \
00214 tmp0=tmp1; \
00215 tmp1=tmp2; \
00216 tmp2=tmpsav; \
00217 } \
00218 \
00219 j = datmask->size_y-1; \
00220 \
00221 flgr1d_arith_sup_##dtype(pout[j],tmp0,tmp1); \
00222 flgr1d_arith_inf_##dtype(pout[j],pmask[j],pout[j]); \
00223 \
00224 flgr_vector_destroy(vec); \
00225 flgr1d_destroy(tmpL0); \
00226 flgr1d_destroy(tmpL1); \
00227 flgr1d_destroy(tmp0); \
00228 flgr1d_destroy(tmp1); \
00229 flgr1d_destroy(tmp2)
00230
00231
00232
00233 void flgr2d_geodesic_dilate_8_connexity_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00234 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgBIT);
00235 }
00236 void flgr2d_geodesic_dilate_8_connexity_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00237 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgUINT8);
00238 }
00239 void flgr2d_geodesic_dilate_8_connexity_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00240 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgUINT16);
00241 }
00242 void flgr2d_geodesic_dilate_8_connexity_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00243 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgUINT32);
00244 }
00245 void flgr2d_geodesic_dilate_8_connexity_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00246 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgINT8);
00247 }
00248 void flgr2d_geodesic_dilate_8_connexity_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00249 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgINT16);
00250 }
00251 void flgr2d_geodesic_dilate_8_connexity_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00252 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgINT32);
00253 }
00254 void flgr2d_geodesic_dilate_8_connexity_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00255 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgFLOAT32);
00256 }
00257 void flgr2d_geodesic_dilate_8_connexity_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00258 FLGR_MACRO_GEODESIC_DILATE_8_CONNEXITY(fgFLOAT64);
00259 }
00260
00261 FLGR_Ret flgr2d_geodesic_dilate_8_connexity(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00262 FLGR_Ret ret;
00263
00264
00265
00266 if((datmark==NULL) || (datmask==NULL)) {
00267 POST_ERROR("Null objects!\n");
00268 return FLGR_RET_NULL_OBJECT;
00269 }
00270
00271 if((ret=flgr2d_is_data_same_attributes(datmask,datmark,__FUNCTION__))!=FLGR_RET_OK) return ret;
00272
00273 FLGR_DISPATCH_PROCEDURE(datmask->type,flgr2d_geodesic_dilate_8_connexity,datmark,datmask);
00274
00275 }
00276
00277
00278
00279
00280
00281
00282
00283
00284 #define FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(dtype) \
00285 FLGR_Data2D *tmp = flgr2d_create_pixmap_from(datmark); \
00286 \
00287 do{ \
00288 flgr2d_copy_##dtype##_##dtype(tmp,datmark); \
00289 flgr2d_geodesic_dilate_8_connexity_##dtype(datmark,datmask); \
00290 }while(flgr2d_compare_##dtype(tmp,FLGR_TEST_EQ,datmark) !=FLGR_TRUE); \
00291 \
00292 flgr2d_destroy(tmp)
00293
00294
00295 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00296
00297 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgBIT);
00298 }
00299 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00300
00301 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgUINT8);
00302 }
00303 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00304
00305 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgUINT16);
00306 }
00307 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00308
00309 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgUINT32);
00310 }
00311 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00312
00313 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgINT8);
00314 }
00315 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00316
00317 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgINT16);
00318 }
00319 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00320
00321 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgINT32);
00322 }
00323 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00324
00325 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgFLOAT32);
00326 }
00327 void flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00328
00329 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL_8_CONNEXITY(fgFLOAT64);
00330 }
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340 #define FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(dtype) \
00341 FLGR_Data2D *tmp = flgr2d_create_pixmap_from(datmark); \
00342 \
00343 do{ \
00344 flgr2d_copy_##dtype##_##dtype(tmp,datmark); \
00345 flgr2d_geodesic_erode_8_connexity_##dtype(datmark,datmask); \
00346 }while(flgr2d_compare_##dtype(tmp,FLGR_TEST_EQ,datmark) !=FLGR_TRUE); \
00347 \
00348 flgr2d_destroy(tmp)
00349
00350
00351 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00352
00353 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgBIT);
00354 }
00355 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00356
00357 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgUINT8);
00358 }
00359 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00360
00361 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgUINT16);
00362 }
00363 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00364
00365 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgUINT32);
00366 }
00367 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00368
00369 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgINT8);
00370 }
00371 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00372
00373 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgINT16);
00374 }
00375 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00376
00377 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgINT32);
00378 }
00379 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00380
00381 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgFLOAT32);
00382 }
00383 void flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask) {
00384
00385 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL_8_CONNEXITY(fgFLOAT64);
00386 }
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419 #define FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(dtype) \
00420 FLGR_Data2D *tmp = flgr2d_create_pixmap_from(datmark); \
00421 FLGR_Data2D *nhb = \
00422 flgr2d_create_neighborhood_from_connexity(datmask->spp, \
00423 datmask->type,connexity); \
00424 \
00425 do{ \
00426 flgr2d_copy_##dtype##_##dtype(tmp,datmark); \
00427 flgr2d_dilate_##dtype(datmark,tmp,nhb); \
00428 flgr2d_arith_inf_##dtype(datmark,datmark,datmask); \
00429 }while(flgr2d_compare_##dtype(tmp,FLGR_TEST_EQ,datmark) !=FLGR_TRUE); \
00430 \
00431 flgr2d_destroy(tmp); \
00432 flgr2d_destroy(nhb)
00433
00434
00435
00436 void flgr2d_geodesic_reconstruct_dilate_parallel_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00437
00438 if(connexity == FLGR_8_CONNEX) {
00439 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgBIT(datmark,datmask);
00440 }else {
00441 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgBIT);
00442 }
00443 }
00444 void flgr2d_geodesic_reconstruct_dilate_parallel_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00445
00446 if(connexity == FLGR_8_CONNEX) {
00447 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT8(datmark,datmask);
00448 }else {
00449 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgUINT8);
00450 }
00451 }
00452 void flgr2d_geodesic_reconstruct_dilate_parallel_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00453
00454 if(connexity == FLGR_8_CONNEX) {
00455 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT16(datmark,datmask);
00456 }else {
00457 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgUINT16);
00458 }
00459 }
00460 void flgr2d_geodesic_reconstruct_dilate_parallel_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00461
00462 if(connexity == FLGR_8_CONNEX) {
00463 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgUINT32(datmark,datmask);
00464 }else {
00465 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgUINT32);
00466 }
00467 }
00468 void flgr2d_geodesic_reconstruct_dilate_parallel_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00469
00470 if(connexity == FLGR_8_CONNEX) {
00471 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT8(datmark,datmask);
00472 }else {
00473 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgINT8);
00474 }
00475 }
00476 void flgr2d_geodesic_reconstruct_dilate_parallel_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00477
00478 if(connexity == FLGR_8_CONNEX) {
00479 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT16(datmark,datmask);
00480 }else {
00481 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgINT16);
00482 }
00483 }
00484 void flgr2d_geodesic_reconstruct_dilate_parallel_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00485
00486 if(connexity == FLGR_8_CONNEX) {
00487 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgINT32(datmark,datmask);
00488 }else {
00489 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgINT32);
00490 }
00491 }
00492 void flgr2d_geodesic_reconstruct_dilate_parallel_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00493
00494 if(connexity == FLGR_8_CONNEX) {
00495 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgFLOAT32(datmark,datmask);
00496 }else {
00497 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgFLOAT32);
00498 }
00499 }
00500 void flgr2d_geodesic_reconstruct_dilate_parallel_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00501
00502 if(connexity == FLGR_8_CONNEX) {
00503 flgr2d_geodesic_reconstruct_dilate_parallel_8_connexity_fgFLOAT64(datmark,datmask);
00504 }else {
00505 FLGR_MACRO_2D_GEO_REC_DIL_PARALLEL(fgFLOAT64);
00506 }
00507 }
00508
00509
00510
00511
00513
00519
00520 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_parallel(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00521 FLGR_Ret ret;
00522
00523
00524
00525 if((datmark==NULL) || (datmask==NULL)) {
00526 POST_ERROR("Null objects!\n");
00527 return FLGR_RET_NULL_OBJECT;
00528 }
00529
00530 if((ret=flgr2d_is_data_same_attributes(datmask,datmark,__FUNCTION__))!=FLGR_RET_OK) return ret;
00531
00532 FLGR_DISPATCH_PROCEDURE(datmask->type,flgr2d_geodesic_reconstruct_dilate_parallel,datmark,datmask,connexity);
00533 }
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 #define FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(dtype) \
00552 FLGR_Data2D *tmp = flgr2d_create_pixmap_from(datmark); \
00553 FLGR_Data2D *nhb = \
00554 flgr2d_create_neighborhood_from_connexity(datmask->spp, \
00555 datmask->type,connexity); \
00556 \
00557 do{ \
00558 flgr2d_copy_##dtype##_##dtype(tmp,datmark); \
00559 flgr2d_erode_##dtype(datmark,tmp,nhb); \
00560 flgr2d_arith_sup_##dtype(datmark,datmark,datmask); \
00561 }while(flgr2d_compare_##dtype(tmp,FLGR_TEST_EQ,datmark) !=FLGR_TRUE); \
00562 \
00563 flgr2d_destroy(tmp); \
00564 flgr2d_destroy(nhb)
00565
00566
00567
00568 void flgr2d_geodesic_reconstruct_erode_parallel_fgBIT(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00569
00570 if(connexity == FLGR_8_CONNEX) {
00571 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgBIT(datmark,datmask);
00572 }else {
00573 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgBIT);
00574 }
00575 }
00576 void flgr2d_geodesic_reconstruct_erode_parallel_fgUINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00577
00578 if(connexity == FLGR_8_CONNEX) {
00579 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT8(datmark,datmask);
00580 }else {
00581 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgUINT8);
00582 }
00583 }
00584 void flgr2d_geodesic_reconstruct_erode_parallel_fgUINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00585
00586 if(connexity == FLGR_8_CONNEX) {
00587 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT16(datmark,datmask);
00588 }else {
00589 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgUINT16);
00590 }
00591 }
00592 void flgr2d_geodesic_reconstruct_erode_parallel_fgUINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00593
00594 if(connexity == FLGR_8_CONNEX) {
00595 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgUINT32(datmark,datmask);
00596 }else {
00597 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgUINT32);
00598 }
00599 }
00600 void flgr2d_geodesic_reconstruct_erode_parallel_fgINT8(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00601
00602 if(connexity == FLGR_8_CONNEX) {
00603 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT8(datmark,datmask);
00604 }else {
00605 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgINT8);
00606 }
00607 }
00608 void flgr2d_geodesic_reconstruct_erode_parallel_fgINT16(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00609
00610 if(connexity == FLGR_8_CONNEX) {
00611 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT16(datmark,datmask);
00612 }else {
00613 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgINT16);
00614 }
00615 }
00616 void flgr2d_geodesic_reconstruct_erode_parallel_fgINT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00617
00618 if(connexity == FLGR_8_CONNEX) {
00619 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgINT32(datmark,datmask);
00620 }else {
00621 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgINT32);
00622 }
00623 }
00624 void flgr2d_geodesic_reconstruct_erode_parallel_fgFLOAT32(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00625
00626 if(connexity == FLGR_8_CONNEX) {
00627 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgFLOAT32(datmark,datmask);
00628 }else {
00629 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgFLOAT32);
00630 }
00631 }
00632 void flgr2d_geodesic_reconstruct_erode_parallel_fgFLOAT64(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00633
00634 if(connexity == FLGR_8_CONNEX) {
00635 flgr2d_geodesic_reconstruct_erode_parallel_8_connexity_fgFLOAT64(datmark,datmask);
00636 }else {
00637 FLGR_MACRO_2D_GEO_REC_ERO_PARALLEL(fgFLOAT64);
00638 }
00639 }
00640
00641
00642
00643
00645
00651
00652 FLGR_Ret flgr2d_geodesic_reconstruct_erode_parallel(FLGR_Data2D *datmark, FLGR_Data2D *datmask, FLGR_Connexity connexity) {
00653 FLGR_Ret ret;
00654
00655
00656
00657 if((datmark==NULL) || (datmask==NULL)) {
00658 POST_ERROR("Null objects!\n");
00659 return FLGR_RET_NULL_OBJECT;
00660 }
00661
00662 if((ret=flgr2d_is_data_same_attributes(datmask,datmark,__FUNCTION__))!=FLGR_RET_OK) return ret;
00663
00664 FLGR_DISPATCH_PROCEDURE(datmask->type,flgr2d_geodesic_reconstruct_erode_parallel,datmark,datmask,connexity);
00665 }
00666
00667
00669
00675
00676 FLGR_Ret flgr2d_geodesic_reconstruct_open_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
00677 FLGR_Ret ret;
00678
00679
00680
00681 if((imgdest==NULL) || (imgsrc==NULL) ||(nhb==NULL)){
00682 POST_ERROR("Null objects!\n");
00683 return FLGR_RET_NULL_OBJECT;
00684 }
00685
00686 if( (ret=flgr2d_erode(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
00687
00688 return flgr2d_geodesic_reconstruct_dilate_parallel(imgdest,imgsrc,nhb->connexity);
00689 }
00690
00692
00698
00699 FLGR_Ret flgr2d_geodesic_reconstruct_close_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
00700 FLGR_Ret ret;
00701
00702
00703
00704 if((imgdest==NULL) || (imgsrc==NULL) || (nhb==NULL)){
00705 POST_ERROR("Null objects!\n");
00706 return FLGR_RET_NULL_OBJECT;
00707 }
00708
00709 if( (ret=flgr2d_dilate(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
00710
00711 return flgr2d_geodesic_reconstruct_erode_parallel(imgdest,imgsrc,nhb->connexity);
00712 }
00713
00715
00721
00722 FLGR_Ret flgr2d_geodesic_reconstruct_open_tophat_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
00723 FLGR_Ret ret;
00724
00725
00726
00727 if((imgdest==NULL) || (imgsrc==NULL) ||(nhb==NULL)){
00728 POST_ERROR("Null objects!\n");
00729 return FLGR_RET_NULL_OBJECT;
00730 }
00731
00732 if( (ret=flgr2d_geodesic_reconstruct_open_parallel(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
00733
00734 return flgr2d_arith_sub(imgdest,imgsrc,imgdest);
00735 }
00736
00738
00744
00745 FLGR_Ret flgr2d_geodesic_reconstruct_close_tophat_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
00746 FLGR_Ret ret;
00747
00748
00749
00750 if((imgdest==NULL) || (imgsrc==NULL) || (nhb==NULL)){
00751 POST_ERROR("Null objects!\n");
00752 return FLGR_RET_NULL_OBJECT;
00753 }
00754
00755 if( (ret=flgr2d_geodesic_reconstruct_close_parallel(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
00756
00757 return flgr2d_arith_sub(imgdest,imgdest,imgsrc);
00758 }
00759
00760
00761
00762
00763
00765
00772
00773 FLGR_Ret flgr2d_regional_hminima_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity) {
00774 FLGR_Ret ret;
00775 FLGR_Data2D *imgtmp;
00776
00777
00778
00779 if((imgdest==NULL) || (imgsrc==NULL)){
00780 POST_ERROR("Null objects!\n");
00781 return FLGR_RET_NULL_OBJECT;
00782 }
00783
00784 imgtmp = flgr2d_create_pixmap_from(imgsrc);
00785 if(imgtmp == NULL) {
00786 POST_ERROR("Could not allocate image \n");
00787 return FLGR_RET_ALLOCATION_ERROR;
00788 }
00789
00790
00791 if( (ret=flgr2d_arith_const_addsat_ptr(imgtmp,imgsrc,hlevel)) != FLGR_RET_OK ) return ret;
00792 if( (ret=flgr2d_geodesic_reconstruct_erode_parallel(imgtmp,imgsrc,connexity)) != FLGR_RET_OK ) return ret;
00793
00794 ret = flgr2d_arith_sub(imgdest,imgtmp,imgsrc);
00795
00796 flgr2d_destroy(imgtmp);
00797
00798 return ret;
00799
00800 }
00801
00802
00803
00805
00812
00813 FLGR_Ret flgr2d_regional_hmaxima_parallel(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity) {
00814 FLGR_Ret ret;
00815 FLGR_Data2D *imgtmp;
00816
00817
00818
00819 if((imgdest==NULL) || (imgsrc==NULL)){
00820 POST_ERROR("Null objects!\n");
00821 return FLGR_RET_NULL_OBJECT;
00822 }
00823
00824 imgtmp = flgr2d_create_pixmap_from(imgsrc);
00825 if(imgtmp == NULL) {
00826 POST_ERROR("Could not allocate image \n");
00827 return FLGR_RET_ALLOCATION_ERROR;
00828 }
00829
00830
00831 if( (ret=flgr2d_arith_const_subsat_ptr(imgtmp,imgsrc,hlevel)) != FLGR_RET_OK ) return ret;
00832 if( (ret=flgr2d_geodesic_reconstruct_dilate_parallel(imgtmp,imgsrc,connexity)) != FLGR_RET_OK ) return ret;
00833
00834 ret = flgr2d_arith_sub(imgdest,imgsrc,imgtmp);
00835
00836 flgr2d_destroy(imgtmp);
00837
00838 return ret;
00839
00840 }
00841
00842
00843
00844
00845
00846
00847
00849
00850
00851
00852
00853