00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024
00025 #include <flgrCoreData.h>
00026 #include <flgrCoreDataIO.h>
00027 #include <flgrCoreSlideWindow.h>
00028 #include <flgrCoreNhbManage.h>
00029 #include <flgrCoreCopy.h>
00030 #include <flgrCoreDispatch.h>
00031
00032 #include <flgrCoreArithVector.h>
00033 #include <flgrArith.h>
00034
00035 #include <flgrDataToolsStaticFifo.h>
00036
00037 #include <flgrMorphoKerOp.h>
00038 #include <flgrMorphoBase.h>
00039 #include <flgrMorphoGeodesy.h>
00040
00049
00050
00051
00052
00053
00054
00057 #define FLGR_MACRO_GEODESIC_DILATE_1D(dtype) \
00058 flgr1d_dilate_##dtype(imgdest,imgMarker,nhb); \
00059 flgr1d_arith_inf_##dtype(imgdest,imgMask,imgdest)
00060
00061 void flgr1d_geodesic_dilate_fgBIT(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00062 FLGR_MACRO_GEODESIC_DILATE_1D(fgBIT);
00063 }
00064 void flgr1d_geodesic_dilate_fgUINT8(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00065 FLGR_MACRO_GEODESIC_DILATE_1D(fgUINT8);
00066 }
00067 void flgr1d_geodesic_dilate_fgUINT16(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00068 FLGR_MACRO_GEODESIC_DILATE_1D(fgUINT16);
00069 }
00070 void flgr1d_geodesic_dilate_fgUINT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00071 FLGR_MACRO_GEODESIC_DILATE_1D(fgUINT32);
00072 }
00073 void flgr1d_geodesic_dilate_fgINT8(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00074 FLGR_MACRO_GEODESIC_DILATE_1D(fgINT8);
00075 }
00076 void flgr1d_geodesic_dilate_fgINT16(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00077 FLGR_MACRO_GEODESIC_DILATE_1D(fgINT16);
00078 }
00079 void flgr1d_geodesic_dilate_fgINT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00080 FLGR_MACRO_GEODESIC_DILATE_1D(fgINT32);
00081 }
00082 void flgr1d_geodesic_dilate_fgFLOAT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00083 FLGR_MACRO_GEODESIC_DILATE_1D(fgFLOAT32);
00084 }
00085 void flgr1d_geodesic_dilate_fgFLOAT64(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00086 FLGR_MACRO_GEODESIC_DILATE_1D(fgFLOAT64);
00087 }
00089
00096
00097 FLGR_Ret flgr1d_geodesic_dilate(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00098
00099
00100
00101 if((imgdest==NULL) || (imgMarker==NULL) || (imgMask==NULL) || (nhb==NULL)) {
00102 POST_ERROR("Null objects!\n");
00103 return FLGR_RET_NULL_OBJECT;
00104 }
00105
00106 FLGR_DISPATCH_PROCEDURE(imgdest->type,flgr1d_geodesic_dilate,imgdest,imgMarker,imgMask,nhb);
00107 }
00108
00111 #define FLGR_MACRO_GEODESIC_ERODE_1D(dtype) \
00112 flgr1d_erode_##dtype(imgdest,imgMarker,nhb); \
00113 flgr1d_arith_sup_##dtype(imgdest,imgMask,imgdest)
00114
00115 void flgr1d_geodesic_erode_fgBIT(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00116 FLGR_MACRO_GEODESIC_ERODE_1D(fgBIT);
00117 }
00118 void flgr1d_geodesic_erode_fgUINT8(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00119 FLGR_MACRO_GEODESIC_ERODE_1D(fgUINT8);
00120 }
00121 void flgr1d_geodesic_erode_fgUINT16(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00122 FLGR_MACRO_GEODESIC_ERODE_1D(fgUINT16);
00123 }
00124 void flgr1d_geodesic_erode_fgUINT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00125 FLGR_MACRO_GEODESIC_ERODE_1D(fgUINT32);
00126 }
00127 void flgr1d_geodesic_erode_fgINT8(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00128 FLGR_MACRO_GEODESIC_ERODE_1D(fgINT8);
00129 }
00130 void flgr1d_geodesic_erode_fgINT16(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00131 FLGR_MACRO_GEODESIC_ERODE_1D(fgINT16);
00132 }
00133 void flgr1d_geodesic_erode_fgINT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00134 FLGR_MACRO_GEODESIC_ERODE_1D(fgINT32);
00135 }
00136 void flgr1d_geodesic_erode_fgFLOAT32(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00137 FLGR_MACRO_GEODESIC_ERODE_1D(fgFLOAT32);
00138 }
00139 void flgr1d_geodesic_erode_fgFLOAT64(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00140 FLGR_MACRO_GEODESIC_ERODE_1D(fgFLOAT64);
00141 }
00143
00150
00151 FLGR_Ret flgr1d_geodesic_erode(FLGR_Data1D *imgdest, FLGR_Data1D *imgMarker, FLGR_Data1D *imgMask, FLGR_Data1D *nhb) {
00152
00153
00154
00155 if((imgdest==NULL) || (imgMarker==NULL) || (imgMask==NULL) || (nhb==NULL)){
00156 POST_ERROR("Null objects!\n");
00157 return FLGR_RET_NULL_OBJECT;
00158 }
00159
00160 FLGR_DISPATCH_PROCEDURE(imgdest->type,flgr1d_geodesic_erode,imgdest,imgMarker,imgMask,nhb);
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00194 #define FLGR_MACRO_GEODESIC_DILATE_2D(dtype) \
00195 flgr2d_dilate_##dtype(imgdest,imgMarker,nhb); \
00196 flgr2d_arith_inf_##dtype(imgdest,imgMask,imgdest)
00197
00198 void flgr2d_geodesic_dilate_fgBIT(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00199 FLGR_MACRO_GEODESIC_DILATE_2D(fgBIT);
00200 }
00201 void flgr2d_geodesic_dilate_fgUINT8(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00202 FLGR_MACRO_GEODESIC_DILATE_2D(fgUINT8);
00203 }
00204 void flgr2d_geodesic_dilate_fgUINT16(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00205 FLGR_MACRO_GEODESIC_DILATE_2D(fgUINT16);
00206 }
00207 void flgr2d_geodesic_dilate_fgUINT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00208 FLGR_MACRO_GEODESIC_DILATE_2D(fgUINT32);
00209 }
00210 void flgr2d_geodesic_dilate_fgINT8(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00211 FLGR_MACRO_GEODESIC_DILATE_2D(fgINT8);
00212 }
00213 void flgr2d_geodesic_dilate_fgINT16(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00214 FLGR_MACRO_GEODESIC_DILATE_2D(fgINT16);
00215 }
00216 void flgr2d_geodesic_dilate_fgINT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00217 FLGR_MACRO_GEODESIC_DILATE_2D(fgINT32);
00218 }
00219 void flgr2d_geodesic_dilate_fgFLOAT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00220 FLGR_MACRO_GEODESIC_DILATE_2D(fgFLOAT32);
00221 }
00222 void flgr2d_geodesic_dilate_fgFLOAT64(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00223 FLGR_MACRO_GEODESIC_DILATE_2D(fgFLOAT64);
00224 }
00226
00233
00234 FLGR_Ret flgr2d_geodesic_dilate(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00235
00236
00237
00238 if((imgdest==NULL) || (imgMarker==NULL) || (imgMask==NULL) || (nhb==NULL)){
00239 POST_ERROR("Null objects!\n");
00240 return FLGR_RET_NULL_OBJECT;
00241 }
00242
00243 FLGR_DISPATCH_PROCEDURE(imgdest->type,flgr2d_geodesic_dilate,imgdest,imgMarker,imgMask,nhb);
00244 }
00245
00248 #define FLGR_MACRO_GEODESIC_ERODE_2D(dtype) \
00249 flgr2d_erode_##dtype(imgdest,imgMarker,nhb); \
00250 flgr2d_arith_sup_##dtype(imgdest,imgMask,imgdest)
00251
00252 void flgr2d_geodesic_erode_fgBIT(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00253 FLGR_MACRO_GEODESIC_ERODE_2D(fgBIT);
00254 }
00255 void flgr2d_geodesic_erode_fgUINT8(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00256 FLGR_MACRO_GEODESIC_ERODE_2D(fgUINT8);
00257 }
00258 void flgr2d_geodesic_erode_fgUINT16(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00259 FLGR_MACRO_GEODESIC_ERODE_2D(fgUINT16);
00260 }
00261 void flgr2d_geodesic_erode_fgUINT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00262 FLGR_MACRO_GEODESIC_ERODE_2D(fgUINT32);
00263 }
00264 void flgr2d_geodesic_erode_fgINT8(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00265 FLGR_MACRO_GEODESIC_ERODE_2D(fgINT8);
00266 }
00267 void flgr2d_geodesic_erode_fgINT16(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00268 FLGR_MACRO_GEODESIC_ERODE_2D(fgINT16);
00269 }
00270 void flgr2d_geodesic_erode_fgINT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00271 FLGR_MACRO_GEODESIC_ERODE_2D(fgINT32);
00272 }
00273 void flgr2d_geodesic_erode_fgFLOAT32(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00274 FLGR_MACRO_GEODESIC_ERODE_2D(fgFLOAT32);
00275 }
00276 void flgr2d_geodesic_erode_fgFLOAT64(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00277 FLGR_MACRO_GEODESIC_ERODE_2D(fgFLOAT64);
00278 }
00280
00287
00288 FLGR_Ret flgr2d_geodesic_erode(FLGR_Data2D *imgdest, FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Data2D *nhb) {
00289
00290
00291 if((imgdest==NULL) || (imgMarker==NULL) || (imgMask==NULL) || (nhb==NULL)){
00292 POST_ERROR("Null objects!\n");
00293 return FLGR_RET_NULL_OBJECT;
00294 }
00295
00296 FLGR_DISPATCH_PROCEDURE(imgdest->type,flgr2d_geodesic_erode,imgdest,imgMarker,imgMask,nhb);
00297 }
00298
00299
00300
00301
00302
00304
00306 #define Georec_dil_back_push_fifo(dtype) \
00307 dtype *pextrMarker; \
00308 dtype *pextrMask; \
00309 int *list_coord_x, *list_coord_y; \
00310 int u,v,i,j,k,l,m,h2,w2; \
00311 \
00312 i=extrMarker->center_coord_y; \
00313 j=extrMarker->center_coord_x; \
00314 \
00315 pextrMarker=(dtype *) extrMarker->list_data_val[0]; \
00316 pextrMask=(dtype *) extrMask->list_data_val[0]; \
00317 list_coord_x = extrMarker->list_coord_x[0]; \
00318 list_coord_y = extrMarker->list_coord_y[0]; \
00319 \
00320 h2 = extrMarker->nhb_size_y/2; \
00321 w2 = extrMarker->nhb_size_x/2; \
00322 \
00323 for(m=0 ; m<extrMarker->size[0] ; m++) { \
00324 u=list_coord_y[m]; \
00325 v=list_coord_x[m]; \
00326 k=i+u-h2; \
00327 l=j+v-w2; \
00328 \
00329 if( (pextrMarker[m] < pixCenter) && \
00330 (pextrMarker[m] < pextrMask[m]) ) { \
00331 flgr_static_fifo_write(fifo,k,l); \
00332 } \
00333 \
00334 } \
00335 return
00336
00337
00338
00339
00340 void flgr_georec_dil_back_push_fifo_fgUINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00341 FLGR_NhbBox2D *extrMask, fgUINT8 pixCenter) {
00342 Georec_dil_back_push_fifo(fgUINT8);
00343 }
00344
00345 void flgr_georec_dil_back_push_fifo_fgUINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00346 FLGR_NhbBox2D *extrMask, fgUINT16 pixCenter) {
00347 Georec_dil_back_push_fifo(fgUINT16);
00348 }
00349
00350 void flgr_georec_dil_back_push_fifo_fgUINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00351 FLGR_NhbBox2D *extrMask, fgUINT32 pixCenter) {
00352 Georec_dil_back_push_fifo(fgUINT32);
00353 }
00354
00355 void flgr_georec_dil_back_push_fifo_fgINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00356 FLGR_NhbBox2D *extrMask, fgINT8 pixCenter) {
00357 Georec_dil_back_push_fifo(fgINT8);
00358 }
00359
00360 void flgr_georec_dil_back_push_fifo_fgINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00361 FLGR_NhbBox2D *extrMask, fgINT16 pixCenter) {
00362 Georec_dil_back_push_fifo(fgINT16);
00363 }
00364
00365 void flgr_georec_dil_back_push_fifo_fgINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00366 FLGR_NhbBox2D *extrMask, fgINT32 pixCenter) {
00367 Georec_dil_back_push_fifo(fgINT32);
00368 }
00369
00370 void flgr_georec_dil_back_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00371 FLGR_NhbBox2D *extrMask, fgFLOAT32 pixCenter) {
00372 Georec_dil_back_push_fifo(fgFLOAT32);
00373 }
00374
00375 void flgr_georec_dil_back_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00376 FLGR_NhbBox2D *extrMask, fgFLOAT64 pixCenter) {
00377 Georec_dil_back_push_fifo(fgFLOAT64);
00378 }
00379
00381
00383 #define Georec_ero_back_push_fifo(dtype) \
00384 dtype *pextrMarker; \
00385 dtype *pextrMask; \
00386 int *list_coord_x, *list_coord_y; \
00387 int u,v,i,j,k,l,m,h2,w2; \
00388 \
00389 i=extrMarker->center_coord_y; \
00390 j=extrMarker->center_coord_x; \
00391 \
00392 pextrMarker=(dtype *) extrMarker->list_data_val[0]; \
00393 pextrMask=(dtype *) extrMask->list_data_val[0]; \
00394 list_coord_x = extrMarker->list_coord_x[0]; \
00395 list_coord_y = extrMarker->list_coord_y[0]; \
00396 \
00397 h2 = extrMarker->nhb_size_y/2; \
00398 w2 = extrMarker->nhb_size_x/2; \
00399 \
00400 for(m=0 ; m<extrMarker->size[0] ; m++) { \
00401 u=list_coord_y[m]; \
00402 v=list_coord_x[m]; \
00403 k=i+u-h2; \
00404 l=j+v-w2; \
00405 \
00406 if( (pextrMarker[m] > pixCenter) && \
00407 (pextrMarker[m] > pextrMask[m]) ) { \
00408 flgr_static_fifo_write(fifo,k,l); \
00409 } \
00410 \
00411 } \
00412 return
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446 void flgr_georec_ero_back_push_fifo_fgUINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00447 FLGR_NhbBox2D *extrMask, fgUINT8 pixCenter) {
00448 Georec_ero_back_push_fifo(fgUINT8);
00449 }
00450
00451
00452 void flgr_georec_ero_back_push_fifo_fgUINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00453 FLGR_NhbBox2D *extrMask, fgUINT16 pixCenter) {
00454 Georec_ero_back_push_fifo(fgUINT16);
00455 }
00456
00457
00458 void flgr_georec_ero_back_push_fifo_fgUINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00459 FLGR_NhbBox2D *extrMask, fgUINT32 pixCenter) {
00460 Georec_ero_back_push_fifo(fgUINT32);
00461 }
00462
00463
00464 void flgr_georec_ero_back_push_fifo_fgINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00465 FLGR_NhbBox2D *extrMask, fgINT8 pixCenter) {
00466 Georec_ero_back_push_fifo(fgINT8);
00467 }
00468
00469
00470 void flgr_georec_ero_back_push_fifo_fgINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00471 FLGR_NhbBox2D *extrMask, fgINT16 pixCenter) {
00472 Georec_ero_back_push_fifo(fgINT16);
00473 }
00474
00475
00476 void flgr_georec_ero_back_push_fifo_fgINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00477 FLGR_NhbBox2D *extrMask, fgINT32 pixCenter) {
00478 Georec_ero_back_push_fifo(fgINT32);
00479 }
00480
00481
00482 void flgr_georec_ero_back_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00483 FLGR_NhbBox2D *extrMask, fgFLOAT32 pixCenter) {
00484 Georec_ero_back_push_fifo(fgFLOAT32);
00485 }
00486
00487
00488 void flgr_georec_ero_back_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
00489 FLGR_NhbBox2D *extrMask, fgFLOAT64 pixCenter) {
00490 Georec_ero_back_push_fifo(fgFLOAT64);
00491 }
00492
00493
00494
00495
00496
00497
00498
00499
00501
00503 #define AntirasterSlideRecWindowFifo(dtype, fifoop, arithop, nhbop) \
00504 int i,j; \
00505 dtype pixval; \
00506 FLGR_Vector *result,*vec_arith; \
00507 FLGR_Data2D *nhbars; \
00508 FLGR_Data2D *nhbEven,*nhbOdd; \
00509 FLGR_NhbBox2D *maskextr,*extr; \
00510 \
00511 result = flgr_vector_create(imgMarker->spp,imgMarker->type); \
00512 vec_arith = flgr_vector_create(imgMarker->spp,imgMarker->type); \
00513 \
00514 extr = flgr2d_create_neighbor_box(nhb); \
00515 maskextr = flgr2d_create_neighbor_box(nhb); \
00516 \
00517 nhbEven=flgr2d_create_neighborhood_from(nhb); \
00518 nhbOdd=flgr2d_create_neighborhood_from(nhb); \
00519 \
00520 flgr2d_fill_nhbs_for_6_connexity(nhbEven,nhbOdd,nhb,FLGR_NHB_NO_SYM); \
00521 \
00522 flgr2d_apply_anti_raster_scan_method_##dtype(nhbOdd); \
00523 flgr2d_apply_anti_raster_scan_method_##dtype(nhbEven); \
00524 \
00525 for(i=imgMarker->size_y-1 ; i>=0 ; i--) { \
00526 \
00527 for(j=imgMarker->size_x-1 ; j>=0 ; j--) { \
00528 \
00529 nhbars = (((i%2)==1) ? nhbOdd : nhbEven); \
00530 \
00531 flgr2d_get_neighborhood_##dtype(extr,imgMarker, \
00532 nhbars, i, j); \
00533 flgr2d_get_neighborhood_##dtype(maskextr,imgMask, \
00534 nhbars, i, j); \
00535 \
00536 nhbop(result,extr); \
00537 \
00538 flgr2d_get_data_vector_no_norm_##dtype(imgMask,i,j,vec_arith); \
00539 \
00540 arithop(result,result,vec_arith); \
00541 \
00542 flgr2d_set_data_vector_##dtype(imgMarker,i,j,result); \
00543 \
00544 flgr_vector_get_element_##dtype(result, 0, &pixval); \
00545 \
00546 fifoop(fifo,extr,maskextr,pixval); \
00547 \
00548 } \
00549 } \
00550 \
00551 flgr2d_destroy(nhbOdd); \
00552 flgr2d_destroy(nhbEven); \
00553 \
00554 flgr2d_destroy_neighbor_box(extr); \
00555 flgr2d_destroy_neighbor_box(maskextr); \
00556 flgr_vector_destroy(vec_arith); \
00557 flgr_vector_destroy(result); \
00558 \
00559 return
00560
00561
00562
00563 void flgr_anti_raster_slide_recursive_dil_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00564 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00565 AntirasterSlideRecWindowFifo(fgUINT8,
00566 flgr_georec_dil_back_push_fifo_fgUINT8,
00567 flgr_vector_inf_fgUINT8,
00568 flgr2d_get_nhb_maximum_fgUINT8);
00569 }
00570
00571 void flgr_anti_raster_slide_recursive_dil_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00572 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00573
00574 AntirasterSlideRecWindowFifo(fgUINT16,
00575 flgr_georec_dil_back_push_fifo_fgUINT16,
00576 flgr_vector_inf_fgUINT16,
00577 flgr2d_get_nhb_maximum_fgUINT16);
00578 }
00579
00580 void flgr_anti_raster_slide_recursive_dil_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00581 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00582
00583
00584 AntirasterSlideRecWindowFifo(fgUINT32,
00585 flgr_georec_dil_back_push_fifo_fgUINT32,
00586 flgr_vector_inf_fgUINT32,
00587 flgr2d_get_nhb_maximum_fgUINT32);
00588 }
00589
00590 void flgr_anti_raster_slide_recursive_dil_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00591 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00592
00593
00594 AntirasterSlideRecWindowFifo(fgINT8,
00595 flgr_georec_dil_back_push_fifo_fgINT8,
00596 flgr_vector_inf_fgINT8,
00597 flgr2d_get_nhb_maximum_fgINT8);
00598 }
00599
00600 void flgr_anti_raster_slide_recursive_dil_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00601 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00602
00603
00604 AntirasterSlideRecWindowFifo(fgINT16,
00605 flgr_georec_dil_back_push_fifo_fgINT16,
00606 flgr_vector_inf_fgINT16,
00607 flgr2d_get_nhb_maximum_fgINT16);
00608 }
00609
00610 void flgr_anti_raster_slide_recursive_dil_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00611 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00612
00613
00614 AntirasterSlideRecWindowFifo(fgINT32,
00615 flgr_georec_dil_back_push_fifo_fgINT32,
00616 flgr_vector_inf_fgINT32,
00617 flgr2d_get_nhb_maximum_fgINT32);
00618 }
00619
00620 void flgr_anti_raster_slide_recursive_dil_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00621 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00622
00623 AntirasterSlideRecWindowFifo(fgFLOAT32,
00624 flgr_georec_dil_back_push_fifo_fgFLOAT32,
00625 flgr_vector_inf_fgFLOAT32,
00626 flgr2d_get_nhb_maximum_fgFLOAT32);
00627 }
00628
00629 void flgr_anti_raster_slide_recursive_dil_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00630 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00631
00632 AntirasterSlideRecWindowFifo(fgFLOAT64,
00633 flgr_georec_dil_back_push_fifo_fgFLOAT64,
00634 flgr_vector_inf_fgFLOAT64,
00635 flgr2d_get_nhb_maximum_fgFLOAT64);
00636 }
00637
00638
00639
00640
00641
00642
00643 void flgr_anti_raster_slide_recursive_ero_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00644 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00645 AntirasterSlideRecWindowFifo(fgUINT8,
00646 flgr_georec_ero_back_push_fifo_fgUINT8,
00647 flgr_vector_sup_fgUINT8,
00648 flgr2d_get_nhb_minimum_fgUINT8);
00649 }
00650
00651 void flgr_anti_raster_slide_recursive_ero_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00652 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00653
00654 AntirasterSlideRecWindowFifo(fgUINT16,
00655 flgr_georec_ero_back_push_fifo_fgUINT16,
00656 flgr_vector_sup_fgUINT16,
00657 flgr2d_get_nhb_minimum_fgUINT16);
00658 }
00659
00660 void flgr_anti_raster_slide_recursive_ero_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00661 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00662
00663
00664 AntirasterSlideRecWindowFifo(fgUINT32,
00665 flgr_georec_ero_back_push_fifo_fgUINT32,
00666 flgr_vector_sup_fgUINT32,
00667 flgr2d_get_nhb_minimum_fgUINT32);
00668 }
00669
00670 void flgr_anti_raster_slide_recursive_ero_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00671 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00672
00673
00674 AntirasterSlideRecWindowFifo(fgINT8,
00675 flgr_georec_ero_back_push_fifo_fgINT8,
00676 flgr_vector_sup_fgINT8,
00677 flgr2d_get_nhb_minimum_fgINT8);
00678 }
00679
00680 void flgr_anti_raster_slide_recursive_ero_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00681 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00682
00683
00684 AntirasterSlideRecWindowFifo(fgINT16,
00685 flgr_georec_ero_back_push_fifo_fgINT16,
00686 flgr_vector_sup_fgINT16,
00687 flgr2d_get_nhb_minimum_fgINT16);
00688 }
00689
00690 void flgr_anti_raster_slide_recursive_ero_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00691 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00692
00693
00694 AntirasterSlideRecWindowFifo(fgINT32,
00695 flgr_georec_ero_back_push_fifo_fgINT32,
00696 flgr_vector_sup_fgINT32,
00697 flgr2d_get_nhb_minimum_fgINT32);
00698 }
00699
00700 void flgr_anti_raster_slide_recursive_ero_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00701 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00702
00703 AntirasterSlideRecWindowFifo(fgFLOAT32,
00704 flgr_georec_ero_back_push_fifo_fgFLOAT32,
00705 flgr_vector_sup_fgFLOAT32,
00706 flgr2d_get_nhb_minimum_fgFLOAT32);
00707 }
00708
00709 void flgr_anti_raster_slide_recursive_ero_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00710 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00711
00712 AntirasterSlideRecWindowFifo(fgFLOAT64,
00713 flgr_georec_ero_back_push_fifo_fgFLOAT64,
00714 flgr_vector_sup_fgFLOAT64,
00715 flgr2d_get_nhb_minimum_fgFLOAT64);
00716 }
00717
00718
00719
00721
00723 #define Georec_Dil_Push_Fifo(dtype) \
00724 dtype *pextrMarker; \
00725 dtype *pextrMask; \
00726 int *list_x, *list_y; \
00727 int u,v,i,j,k,l,m,w2,h2; \
00728 dtype pixCenter; \
00729 dtype mini; \
00730 \
00731 i=extrmarker->center_coord_y; \
00732 j=extrmarker->center_coord_x; \
00733 \
00734 pextrMarker=(dtype *) extrmarker->list_data_val[0]; \
00735 pextrMask=(dtype *) extrmask->list_data_val[0]; \
00736 list_x = (int *) extrmarker->list_coord_x[0]; \
00737 list_y = (int *) extrmarker->list_coord_y[0]; \
00738 \
00739 flgr_vector_get_element(extrmarker->center_data_val,0,&pixCenter); \
00740 \
00741 w2 = extrmarker->nhb_size_x/2; \
00742 h2 = extrmarker->nhb_size_y/2; \
00743 \
00744 for(m=0 ; m<extrmarker->size[0] ; m++) { \
00745 u=list_y[m]; \
00746 v=list_x[m]; \
00747 k=i+u-h2; \
00748 l=j+v-w2; \
00749 \
00750 if( (pextrMarker[m] < pixCenter) && \
00751 (pextrMarker[m] < pextrMask[m]) ) { \
00752 mini=FLGR_MIN(pixCenter,pextrMask[m]); \
00753 flgr2d_set_data_array_##dtype((dtype **)imgMarker->array,k,l,mini); \
00754 flgr_static_fifo_write(fifo,k,l); \
00755 } \
00756 } \
00757 return
00758
00759
00760 void flgr_georec_dil_push_fifo_fgUINT8(FLGR_StaticFifo *fifo,
00761 FLGR_NhbBox2D *extrmarker,
00762 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00763
00764
00765 Georec_Dil_Push_Fifo(fgUINT8);
00766
00767 }
00768
00769 void flgr_georec_dil_push_fifo_fgUINT16(FLGR_StaticFifo *fifo,
00770 FLGR_NhbBox2D *extrmarker,
00771 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00772
00773 Georec_Dil_Push_Fifo(fgUINT16);
00774 }
00775
00776 void flgr_georec_dil_push_fifo_fgUINT32(FLGR_StaticFifo *fifo,
00777 FLGR_NhbBox2D *extrmarker,
00778 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00779
00780 Georec_Dil_Push_Fifo(fgUINT32);
00781 }
00782
00783 void flgr_georec_dil_push_fifo_fgINT8(FLGR_StaticFifo *fifo,
00784 FLGR_NhbBox2D *extrmarker,
00785 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00786
00787 Georec_Dil_Push_Fifo(fgINT8);
00788 }
00789
00790 void flgr_georec_dil_push_fifo_fgINT16(FLGR_StaticFifo *fifo,
00791 FLGR_NhbBox2D *extrmarker,
00792 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00793
00794
00795 Georec_Dil_Push_Fifo(fgINT16);
00796 }
00797
00798 void flgr_georec_dil_push_fifo_fgINT32(FLGR_StaticFifo *fifo,
00799 FLGR_NhbBox2D *extrmarker,
00800 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00801
00802 Georec_Dil_Push_Fifo(fgINT32);
00803 }
00804
00805 void flgr_georec_dil_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo,
00806 FLGR_NhbBox2D *extrmarker,
00807 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00808
00809 Georec_Dil_Push_Fifo(fgFLOAT32);
00810 }
00811
00812 void flgr_georec_dil_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo,
00813 FLGR_NhbBox2D *extrmarker,
00814 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00815
00816 Georec_Dil_Push_Fifo(fgFLOAT64);
00817 }
00818
00819
00820
00822
00824 #define Georec_Ero_Push_Fifo(dtype) \
00825 dtype *pextrMarker; \
00826 dtype *pextrMask; \
00827 int *list_x, *list_y; \
00828 int u,v,i,j,k,l,m,w2,h2; \
00829 dtype pixCenter; \
00830 dtype maxi; \
00831 \
00832 i=extrmarker->center_coord_y; \
00833 j=extrmarker->center_coord_x; \
00834 \
00835 pextrMarker=(dtype *) extrmarker->list_data_val[0]; \
00836 pextrMask=(dtype *) extrmask->list_data_val[0]; \
00837 list_x = (int *) extrmarker->list_coord_x[0]; \
00838 list_y = (int *) extrmarker->list_coord_y[0]; \
00839 \
00840 flgr_vector_get_element(extrmarker->center_data_val,0,&pixCenter); \
00841 \
00842 w2 = extrmarker->nhb_size_x/2; \
00843 h2 = extrmarker->nhb_size_y/2; \
00844 \
00845 for(m=0 ; m<extrmarker->size[0] ; m++) { \
00846 u=list_y[m]; \
00847 v=list_x[m]; \
00848 k=i+u-h2; \
00849 l=j+v-w2; \
00850 \
00851 if( (pextrMarker[m] > pixCenter) && \
00852 (pextrMarker[m] > pextrMask[m]) ) { \
00853 maxi=FLGR_MAX(pixCenter,pextrMask[m]); \
00854 flgr2d_set_data_array_##dtype((dtype **)imgMarker->array,k,l,maxi); \
00855 flgr_static_fifo_write(fifo,k,l); \
00856 } \
00857 } \
00858 return
00859
00860
00861 void flgr_georec_ero_push_fifo_fgUINT8(FLGR_StaticFifo *fifo,
00862 FLGR_NhbBox2D *extrmarker,
00863 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00864
00865 Georec_Ero_Push_Fifo(fgUINT8);
00866
00867 }
00868
00869 void flgr_georec_ero_push_fifo_fgUINT16(FLGR_StaticFifo *fifo,
00870 FLGR_NhbBox2D *extrmarker,
00871 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00872
00873 Georec_Ero_Push_Fifo(fgUINT16);
00874 }
00875
00876 void flgr_georec_ero_push_fifo_fgUINT32(FLGR_StaticFifo *fifo,
00877 FLGR_NhbBox2D *extrmarker,
00878 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00879
00880 Georec_Ero_Push_Fifo(fgUINT32);
00881 }
00882
00883 void flgr_georec_ero_push_fifo_fgINT8(FLGR_StaticFifo *fifo,
00884 FLGR_NhbBox2D *extrmarker,
00885 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00886
00887 Georec_Ero_Push_Fifo(fgINT8);
00888 }
00889
00890 void flgr_georec_ero_push_fifo_fgINT16(FLGR_StaticFifo *fifo,
00891 FLGR_NhbBox2D *extrmarker,
00892 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00893
00894 Georec_Ero_Push_Fifo(fgINT16);
00895 }
00896
00897 void flgr_georec_ero_push_fifo_fgINT32(FLGR_StaticFifo *fifo,
00898 FLGR_NhbBox2D *extrmarker,
00899 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00900
00901 Georec_Ero_Push_Fifo(fgINT32);
00902 }
00903
00904 void flgr_georec_ero_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo,
00905 FLGR_NhbBox2D *extrmarker,
00906 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00907
00908 Georec_Ero_Push_Fifo(fgFLOAT32);
00909 }
00910
00911 void flgr_georec_ero_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo,
00912 FLGR_NhbBox2D *extrmarker,
00913 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
00914
00915 Georec_Ero_Push_Fifo(fgFLOAT64);
00916 }
00917
00918
00919
00921
00923 #define Georec_propag_fifo_cont(dtype,fifoop) \
00924 int row,col; \
00925 FLGR_Data2D *nhbOdd,*nhbEven, *pnhb; \
00926 FLGR_NhbBox2D *maskextr,*extr; \
00927 \
00928 extr = flgr2d_create_neighbor_box(nhb); \
00929 maskextr = flgr2d_create_neighbor_box(nhb); \
00930 \
00931 nhbOdd = flgr2d_create_neighborhood_from(nhb); \
00932 nhbEven = flgr2d_create_neighborhood_from(nhb); \
00933 \
00934 flgr2d_fill_nhbs_for_6_connexity(nhbEven,nhbOdd,nhb,FLGR_NHB_NO_SYM); \
00935 \
00936 while(!flgr_static_fifo_is_empty(fifo)) { \
00937 flgr_static_fifo_read(fifo,&row,&col); \
00938 pnhb = (((row%2)==1) ? nhbOdd : nhbEven); \
00939 \
00940 flgr2d_get_neighborhood_##dtype(extr,imgMarker, \
00941 pnhb, row, col); \
00942 flgr2d_get_neighborhood_##dtype(maskextr,imgMask, \
00943 pnhb, row, col); \
00944 fifoop(fifo, extr, maskextr, imgMarker); \
00945 \
00946 } \
00947 \
00948 flgr2d_destroy(nhbOdd); \
00949 flgr2d_destroy(nhbEven); \
00950 \
00951 flgr2d_destroy_neighbor_box(extr); \
00952 flgr2d_destroy_neighbor_box(maskextr); \
00953 return
00954
00955
00956 void flgr_georec_ero_propag_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00957 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00958 Georec_propag_fifo_cont(fgUINT8,flgr_georec_ero_push_fifo_fgUINT8);
00959 }
00960
00961 void flgr_georec_ero_propag_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00962 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00963 Georec_propag_fifo_cont(fgUINT16,flgr_georec_ero_push_fifo_fgUINT16);
00964 }
00965
00966
00967 void flgr_georec_ero_propag_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00968 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00969 Georec_propag_fifo_cont(fgUINT32,flgr_georec_ero_push_fifo_fgUINT32);
00970 }
00971
00972 void flgr_georec_ero_propag_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00973 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00974 Georec_propag_fifo_cont(fgINT8,flgr_georec_ero_push_fifo_fgINT8);
00975 }
00976
00977 void flgr_georec_ero_propag_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00978 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00979 Georec_propag_fifo_cont(fgINT16,flgr_georec_ero_push_fifo_fgINT16);
00980
00981 }
00982
00983 void flgr_georec_ero_propag_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00984 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00985 Georec_propag_fifo_cont(fgINT32,flgr_georec_ero_push_fifo_fgINT32);
00986
00987 }
00988
00989 void flgr_georec_ero_propag_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00990 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00991 Georec_propag_fifo_cont(fgFLOAT32,flgr_georec_ero_push_fifo_fgFLOAT32);
00992
00993 }
00994
00995 void flgr_georec_ero_propag_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
00996 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
00997 Georec_propag_fifo_cont(fgFLOAT64,flgr_georec_ero_push_fifo_fgFLOAT64);
00998
00999 }
01000
01001
01002
01003
01004 void flgr_georec_dil_propag_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01005 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01006 Georec_propag_fifo_cont(fgUINT8,flgr_georec_dil_push_fifo_fgUINT8);
01007 }
01008
01009 void flgr_georec_dil_propag_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01010 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01011 Georec_propag_fifo_cont(fgUINT16,flgr_georec_dil_push_fifo_fgUINT16);
01012 }
01013
01014
01015 void flgr_georec_dil_propag_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01016 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01017 Georec_propag_fifo_cont(fgUINT32,flgr_georec_dil_push_fifo_fgUINT32);
01018 }
01019
01020 void flgr_georec_dil_propag_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01021 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01022 Georec_propag_fifo_cont(fgINT8,flgr_georec_dil_push_fifo_fgINT8);
01023 }
01024
01025 void flgr_georec_dil_propag_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01026 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01027 Georec_propag_fifo_cont(fgINT16,flgr_georec_dil_push_fifo_fgINT16);
01028
01029 }
01030
01031 void flgr_georec_dil_propag_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01032 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01033 Georec_propag_fifo_cont(fgINT32,flgr_georec_dil_push_fifo_fgINT32);
01034
01035 }
01036
01037 void flgr_georec_dil_propag_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01038 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01039 Georec_propag_fifo_cont(fgFLOAT32,flgr_georec_dil_push_fifo_fgFLOAT32);
01040
01041 }
01042
01043 void flgr_georec_dil_propag_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01044 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01045 Georec_propag_fifo_cont(fgFLOAT64,flgr_georec_dil_push_fifo_fgFLOAT64);
01046
01047 }
01048
01049
01051
01053 #define GeodesicReconstruction(dtype,dtypename,nhbop,arithop, \
01054 backfifoop,propagfifoop) \
01055 \
01056 FLGR_Data2D *nhb; \
01057 FLGR_StaticFifo *fifo; \
01058 \
01059 \
01060 nhb = flgr2d_create_neighborhood_from_connexity(imgMarker->spp,dtypename,connexity); \
01061 \
01062 if(nhb==NULL) return FLGR_RET_ALLOCATION_ERROR; \
01063 \
01064 fifo = flgr_static_fifo_init(imgMarker->size_y,imgMarker->size_x); \
01065 flgr2d_raster_slide_window_before_op_##dtype(imgMarker, \
01066 imgMarker,imgMask,nhb,FLGR_NHB_NO_SYM, \
01067 nhbop,arithop); \
01068 \
01069 backfifoop(imgMarker,imgMask,nhb,fifo); \
01070 propagfifoop(imgMarker,imgMask,nhb,fifo); \
01071 \
01072 flgr2d_destroy(nhb); \
01073 flgr_static_fifo_destroy(fifo); \
01074 \
01075 return FLGR_RET_OK
01076
01077
01078
01079
01080 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgBIT(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01081 flgr_no_define_type_function(FLGR_BIT);
01082 return FLGR_RET_NOT_IMPLEMENTED;
01083 }
01084
01085 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01086 GeodesicReconstruction(fgUINT8,FLGR_UINT8,
01087 flgr2d_get_nhb_maximum_fgUINT8,
01088 flgr_vector_inf_fgUINT8,
01089 flgr_anti_raster_slide_recursive_dil_fifo_fgUINT8,
01090 flgr_georec_dil_propag_fifo_fgUINT8);
01091 }
01092
01093 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01094 GeodesicReconstruction(fgUINT16,FLGR_UINT16,
01095 flgr2d_get_nhb_maximum_fgUINT16,
01096 flgr_vector_inf_fgUINT16,
01097 flgr_anti_raster_slide_recursive_dil_fifo_fgUINT16,
01098 flgr_georec_dil_propag_fifo_fgUINT16);
01099 }
01100
01101 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01102 GeodesicReconstruction(fgUINT32,FLGR_UINT32,
01103 flgr2d_get_nhb_maximum_fgUINT32,
01104 flgr_vector_inf_fgUINT32,
01105 flgr_anti_raster_slide_recursive_dil_fifo_fgUINT32,
01106 flgr_georec_dil_propag_fifo_fgUINT32);
01107 }
01108
01109 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01110 GeodesicReconstruction(fgINT8,FLGR_INT8,
01111 flgr2d_get_nhb_maximum_fgINT8,
01112 flgr_vector_inf_fgINT8,
01113 flgr_anti_raster_slide_recursive_dil_fifo_fgINT8,
01114 flgr_georec_dil_propag_fifo_fgINT8);
01115 }
01116
01117 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01118 GeodesicReconstruction(fgINT16,FLGR_INT16,
01119 flgr2d_get_nhb_maximum_fgINT16,
01120 flgr_vector_inf_fgINT16,
01121 flgr_anti_raster_slide_recursive_dil_fifo_fgINT16,
01122 flgr_georec_dil_propag_fifo_fgINT16);
01123 }
01124
01125 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01126 GeodesicReconstruction(fgINT32,FLGR_INT32,
01127 flgr2d_get_nhb_maximum_fgINT32,
01128 flgr_vector_inf_fgINT32,
01129 flgr_anti_raster_slide_recursive_dil_fifo_fgINT32,
01130 flgr_georec_dil_propag_fifo_fgINT32);
01131 }
01132
01133 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01134 GeodesicReconstruction(fgFLOAT32,FLGR_FLOAT32,
01135 flgr2d_get_nhb_maximum_fgFLOAT32,
01136 flgr_vector_inf_fgFLOAT32,
01137 flgr_anti_raster_slide_recursive_dil_fifo_fgFLOAT32,
01138 flgr_georec_dil_propag_fifo_fgFLOAT32);
01139 }
01140
01141 FLGR_Ret flgr2d_geodesic_reconstruct_dilate_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01142 GeodesicReconstruction(fgFLOAT64,FLGR_FLOAT64,
01143 flgr2d_get_nhb_maximum_fgFLOAT64,
01144 flgr_vector_inf_fgFLOAT64,
01145 flgr_anti_raster_slide_recursive_dil_fifo_fgFLOAT64,
01146 flgr_georec_dil_propag_fifo_fgFLOAT64);
01147 }
01148
01149
01150
01151
01152
01153
01154 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgBIT(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01155 flgr_no_define_type_function(FLGR_BIT);
01156 return FLGR_RET_NOT_IMPLEMENTED;
01157 }
01158
01159 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01160 GeodesicReconstruction(fgUINT8,FLGR_UINT8,
01161 flgr2d_get_nhb_minimum_fgUINT8,
01162 flgr_vector_sup_fgUINT8,
01163 flgr_anti_raster_slide_recursive_ero_fifo_fgUINT8,
01164 flgr_georec_ero_propag_fifo_fgUINT8);
01165 }
01166
01167 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01168 GeodesicReconstruction(fgUINT16,FLGR_UINT16,
01169 flgr2d_get_nhb_minimum_fgUINT16,
01170 flgr_vector_sup_fgUINT16,
01171 flgr_anti_raster_slide_recursive_ero_fifo_fgUINT16,
01172 flgr_georec_ero_propag_fifo_fgUINT16);
01173 }
01174
01175 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01176 GeodesicReconstruction(fgUINT32,FLGR_UINT32,
01177 flgr2d_get_nhb_minimum_fgUINT32,
01178 flgr_vector_sup_fgUINT32,
01179 flgr_anti_raster_slide_recursive_ero_fifo_fgUINT32,
01180 flgr_georec_ero_propag_fifo_fgUINT32);
01181 }
01182
01183 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01184 GeodesicReconstruction(fgINT8,FLGR_INT8,
01185 flgr2d_get_nhb_minimum_fgINT8,
01186 flgr_vector_sup_fgINT8,
01187 flgr_anti_raster_slide_recursive_ero_fifo_fgINT8,
01188 flgr_georec_ero_propag_fifo_fgINT8);
01189 }
01190
01191 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01192 GeodesicReconstruction(fgINT16,FLGR_INT16,
01193 flgr2d_get_nhb_minimum_fgINT16,
01194 flgr_vector_sup_fgINT16,
01195 flgr_anti_raster_slide_recursive_ero_fifo_fgINT16,
01196 flgr_georec_ero_propag_fifo_fgINT16);
01197 }
01198
01199 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01200 GeodesicReconstruction(fgINT32,FLGR_INT32,
01201 flgr2d_get_nhb_minimum_fgINT32,
01202 flgr_vector_sup_fgINT32,
01203 flgr_anti_raster_slide_recursive_ero_fifo_fgINT32,
01204 flgr_georec_ero_propag_fifo_fgINT32);
01205 }
01206
01207 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01208 GeodesicReconstruction(fgFLOAT32,FLGR_FLOAT32,
01209 flgr2d_get_nhb_minimum_fgFLOAT32,
01210 flgr_vector_sup_fgFLOAT32,
01211 flgr_anti_raster_slide_recursive_ero_fifo_fgFLOAT32,
01212 flgr_georec_ero_propag_fifo_fgFLOAT32);
01213 }
01214
01215 FLGR_Ret flgr2d_geodesic_reconstruct_erode_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Connexity connexity) {
01216 GeodesicReconstruction(fgFLOAT64,FLGR_FLOAT64,
01217 flgr2d_get_nhb_minimum_fgFLOAT64,
01218 flgr_vector_sup_fgFLOAT64,
01219 flgr_anti_raster_slide_recursive_ero_fifo_fgFLOAT64,
01220 flgr_georec_ero_propag_fifo_fgFLOAT64);
01221 }
01222
01223
01224
01225
01226
01227
01229
01239
01240 FLGR_Ret flgr2d_geodesic_reconstruct_dilate(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01241 FLGR_Ret ret;
01242
01243
01244
01245 if((imgMarker==NULL) || (imgMask==NULL)){
01246 POST_ERROR("Null objects!\n");
01247 return FLGR_RET_NULL_OBJECT;
01248 }
01249
01250 if(imgMarker->spp!=1) {
01251 POST_ERROR("Multi Sample Per Pixel not supported\n");
01252 return FLGR_RET_UNDEFINED_ERROR;
01253 }
01254
01255 if((ret=flgr2d_is_data_same_attributes(imgMarker,imgMask,__FUNCTION__))!=FLGR_RET_OK) return ret;
01256
01257 FLGR_DISPATCH_FUNCTION(FLGR_RET_TYPE_UNKNOWN, imgMarker->type,flgr2d_geodesic_reconstruct_dilate,imgMarker, imgMask, connexity);
01258
01259 }
01260
01262
01272
01273 FLGR_Ret flgr2d_geodesic_reconstruct_erode(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01274 FLGR_Ret ret;
01275
01276
01277
01278 if((imgMarker==NULL) || (imgMask==NULL)){
01279 POST_ERROR("Null objects!\n");
01280 return FLGR_RET_NULL_OBJECT;
01281 }
01282
01283 if(imgMarker->spp!=1) {
01284 POST_ERROR("Multi Sample Per Pixel not supported\n");
01285 return FLGR_RET_UNDEFINED_ERROR;
01286 }
01287
01288 if((ret=flgr2d_is_data_same_attributes(imgMarker,imgMask,__FUNCTION__))!=FLGR_RET_OK) return ret;
01289
01290 FLGR_DISPATCH_FUNCTION(FLGR_RET_TYPE_UNKNOWN,imgMarker->type,flgr2d_geodesic_reconstruct_erode,imgMarker, imgMask, connexity);
01291
01292 }
01293
01294
01296
01302
01303 FLGR_Ret flgr2d_geodesic_reconstruct_open(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
01304 FLGR_Ret ret;
01305
01306
01307
01308 if((imgdest==NULL) || (imgsrc==NULL) ||(nhb==NULL)){
01309 POST_ERROR("Null objects!\n");
01310 return FLGR_RET_NULL_OBJECT;
01311 }
01312
01313 if( (ret=flgr2d_erode(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
01314
01315 return flgr2d_geodesic_reconstruct_dilate(imgdest,imgsrc,nhb->connexity);
01316 }
01317
01319
01325
01326 FLGR_Ret flgr2d_geodesic_reconstruct_close(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
01327 FLGR_Ret ret;
01328
01329
01330
01331 if((imgdest==NULL) || (imgsrc==NULL) || (nhb==NULL)){
01332 POST_ERROR("Null objects!\n");
01333 return FLGR_RET_NULL_OBJECT;
01334 }
01335
01336 if( (ret=flgr2d_dilate(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
01337
01338 return flgr2d_geodesic_reconstruct_erode(imgdest,imgsrc,nhb->connexity);
01339 }
01340
01342
01348
01349 FLGR_Ret flgr2d_geodesic_reconstruct_open_tophat(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
01350 FLGR_Ret ret;
01351
01352
01353
01354 if((imgdest==NULL) || (imgsrc==NULL) ||(nhb==NULL)){
01355 POST_ERROR("Null objects!\n");
01356 return FLGR_RET_NULL_OBJECT;
01357 }
01358
01359 if( (ret=flgr2d_geodesic_reconstruct_open(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
01360
01361 return flgr2d_arith_sub(imgdest,imgsrc,imgdest);
01362 }
01363
01365
01371
01372 FLGR_Ret flgr2d_geodesic_reconstruct_close_tophat(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
01373 FLGR_Ret ret;
01374
01375
01376
01377 if((imgdest==NULL) || (imgsrc==NULL) || (nhb==NULL)){
01378 POST_ERROR("Null objects!\n");
01379 return FLGR_RET_NULL_OBJECT;
01380 }
01381
01382 if( (ret=flgr2d_geodesic_reconstruct_close(imgdest,imgsrc,nhb)) != FLGR_RET_OK ) return ret;
01383
01384 return flgr2d_arith_sub(imgdest,imgdest,imgsrc);
01385 }
01386
01387
01388
01389
01390
01392
01399
01400 FLGR_Ret flgr2d_regional_hminima(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity) {
01401 FLGR_Ret ret;
01402 FLGR_Data2D *imgtmp;
01403
01404
01405
01406 if((imgdest==NULL) || (imgsrc==NULL)){
01407 POST_ERROR("Null objects!\n");
01408 return FLGR_RET_NULL_OBJECT;
01409 }
01410
01411 imgtmp = flgr2d_create_pixmap_from(imgsrc);
01412 if(imgtmp == NULL) {
01413 POST_ERROR("Could not allocate image \n");
01414 return FLGR_RET_ALLOCATION_ERROR;
01415 }
01416
01417
01418 if( (ret=flgr2d_arith_const_addsat_ptr(imgtmp,imgsrc,hlevel)) != FLGR_RET_OK ) return ret;
01419 if( (ret=flgr2d_geodesic_reconstruct_erode(imgtmp,imgsrc,connexity)) != FLGR_RET_OK ) return ret;
01420
01421 ret = flgr2d_arith_sub(imgdest,imgtmp,imgsrc);
01422
01423 flgr2d_destroy(imgtmp);
01424
01425 return ret;
01426
01427 }
01428
01429
01430
01432
01439
01440 FLGR_Ret flgr2d_regional_hmaxima(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Vector *hlevel, FLGR_Connexity connexity) {
01441 FLGR_Ret ret;
01442 FLGR_Data2D *imgtmp;
01443
01444
01445
01446 if((imgdest==NULL) || (imgsrc==NULL)){
01447 POST_ERROR("Null objects!\n");
01448 return FLGR_RET_NULL_OBJECT;
01449 }
01450
01451 imgtmp = flgr2d_create_pixmap_from(imgsrc);
01452 if(imgtmp == NULL) {
01453 POST_ERROR("Could not allocate image \n");
01454 return FLGR_RET_ALLOCATION_ERROR;
01455 }
01456
01457
01458 if( (ret=flgr2d_arith_const_subsat_ptr(imgtmp,imgsrc,hlevel)) != FLGR_RET_OK ) return ret;
01459 if( (ret=flgr2d_geodesic_reconstruct_dilate(imgtmp,imgsrc,connexity)) != FLGR_RET_OK ) return ret;
01460
01461 ret = flgr2d_arith_sub(imgdest,imgsrc,imgtmp);
01462
01463 flgr2d_destroy(imgtmp);
01464
01465 return ret;
01466
01467 }
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01488
01493
01494
01495
01496
01498
01500 #define Georec_raster_rec_scan_dual(dtype) \
01501 int i,j; \
01502 dtype *row_mask, *row_marker; \
01503 FLGR_Vector *result, *vec_arith; \
01504 FLGR_Data2D *nhbrs; \
01505 FLGR_Data2D *nhbEven,*nhbOdd; \
01506 FLGR_NhbBox2D *extr; \
01507 \
01508 extr = flgr2d_create_neighbor_box(nhb); \
01509 \
01510 result = flgr_vector_create(extr->spp,extr->type); \
01511 vec_arith = flgr_vector_create(extr->spp,extr->type); \
01512 \
01513 nhbEven=flgr2d_create_neighborhood_from(nhb); \
01514 nhbOdd=flgr2d_create_neighborhood_from(nhb); \
01515 \
01516 flgr2d_fill_nhbs_for_6_connexity(nhbEven,nhbOdd,nhb,FLGR_NHB_NO_SYM); \
01517 \
01518 flgr2d_apply_raster_scan_method_##dtype(nhbOdd); \
01519 flgr2d_apply_raster_scan_method_##dtype(nhbEven); \
01520 \
01521 for(i=0 ; i<imgMarker->size_y ; i++) { \
01522 row_marker = (dtype *) imgMarker->array[i]; \
01523 row_mask = (dtype *) imgMask->array[i]; \
01524 \
01525 for(j=0 ; j<imgMarker->size_x ; j++) { \
01526 nhbrs = (((i%2)==1) ? nhbOdd : nhbEven); \
01527 \
01528 flgr2d_get_neighborhood_##dtype(extr,imgMarker,nhbrs,i,j); \
01529 \
01530 if(row_marker[j]<row_mask[j]) { \
01531 flgr2d_get_nhb_maximum_##dtype(result,extr); \
01532 flgr2d_get_data_vector_no_norm_##dtype(imgMask,i,j,vec_arith); \
01533 flgr_vector_inf_##dtype(result,result,vec_arith); \
01534 flgr2d_set_data_vector_##dtype(imgMarker,i,j,result); \
01535 }else { \
01536 flgr2d_get_nhb_minimum_##dtype(result,extr); \
01537 flgr2d_get_data_vector_no_norm_##dtype(imgMask,i,j,vec_arith); \
01538 flgr_vector_sup_##dtype(result,result,vec_arith); \
01539 flgr2d_set_data_vector_##dtype(imgMarker,i,j,result); \
01540 } \
01541 } \
01542 } \
01543 \
01544 flgr2d_destroy(nhbOdd); \
01545 flgr2d_destroy(nhbEven); \
01546 flgr2d_destroy_neighbor_box(extr); \
01547 flgr_vector_destroy(result); \
01548 flgr_vector_destroy(vec_arith); \
01549 return
01550
01551
01552
01553 void flgr_georec_raster_recursive_dual_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01554 Georec_raster_rec_scan_dual(fgUINT8);
01555 }
01556
01557 void flgr_georec_raster_recursive_dual_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01558 Georec_raster_rec_scan_dual(fgUINT16);
01559 }
01560
01561 void flgr_georec_raster_recursive_dual_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01562 Georec_raster_rec_scan_dual(fgUINT32);
01563 }
01564
01565 void flgr_georec_raster_recursive_dual_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01566 Georec_raster_rec_scan_dual(fgINT8);
01567 }
01568
01569 void flgr_georec_raster_recursive_dual_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01570 Georec_raster_rec_scan_dual(fgINT16);
01571 }
01572
01573 void flgr_georec_raster_recursive_dual_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01574 Georec_raster_rec_scan_dual(fgINT32);
01575 }
01576
01577 void flgr_georec_raster_recursive_dual_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01578 Georec_raster_rec_scan_dual(fgFLOAT32);
01579 }
01580
01581 void flgr_georec_raster_recursive_dual_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,FLGR_Data2D *nhb) {
01582 Georec_raster_rec_scan_dual(fgFLOAT64);
01583 }
01584
01585
01586
01587
01588
01589
01590
01592
01594 #define Georec_dual_back_push_fifo(dtype) \
01595 dtype *pextrMarker; \
01596 dtype *pextrMask; \
01597 int *list_coord_x, *list_coord_y; \
01598 int u,v,i,j,k,l,m,h2,w2; \
01599 \
01600 i=extrMarker->center_coord_y; \
01601 j=extrMarker->center_coord_x; \
01602 \
01603 pextrMarker=(dtype *) extrMarker->list_data_val[0]; \
01604 pextrMask=(dtype *) extrMask->list_data_val[0]; \
01605 list_coord_x = extrMarker->list_coord_x[0]; \
01606 list_coord_y = extrMarker->list_coord_y[0]; \
01607 \
01608 h2 = extrMarker->nhb_size_y/2; \
01609 w2 = extrMarker->nhb_size_x/2; \
01610 \
01611 for(m=0 ; m<extrMarker->size[0] ; m++) { \
01612 u=list_coord_y[m]; \
01613 v=list_coord_x[m]; \
01614 k=i+u-h2; \
01615 l=j+v-w2; \
01616 \
01617 if( (pextrMarker[m] < pixCenter) && \
01618 (pextrMarker[m] < pextrMask[m]) ) { \
01619 flgr_static_fifo_write(fifo,k,l); \
01620 }else if( (pextrMarker[m] > pixCenter ) && \
01621 (pextrMarker[m] > pextrMask[m]) ) { \
01622 flgr_static_fifo_write(fifo,k,l); \
01623 } \
01624 \
01625 } \
01626 return
01627
01628
01629
01630 void flgr_georec_dual_back_push_fifo_fgUINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01631 FLGR_NhbBox2D *extrMask, fgUINT8 pixCenter) {
01632 Georec_dual_back_push_fifo(fgUINT8);
01633 }
01634
01635 void flgr_georec_dual_back_push_fifo_fgUINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01636 FLGR_NhbBox2D *extrMask, fgUINT16 pixCenter) {
01637 Georec_dual_back_push_fifo(fgUINT16);
01638 }
01639
01640 void flgr_georec_dual_back_push_fifo_fgUINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01641 FLGR_NhbBox2D *extrMask, fgUINT32 pixCenter) {
01642 Georec_dual_back_push_fifo(fgUINT32);
01643 }
01644
01645 void flgr_georec_dual_back_push_fifo_fgINT8(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01646 FLGR_NhbBox2D *extrMask, fgINT8 pixCenter) {
01647 Georec_dual_back_push_fifo(fgINT8);
01648 }
01649
01650 void flgr_georec_dual_back_push_fifo_fgINT16(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01651 FLGR_NhbBox2D *extrMask, fgINT16 pixCenter) {
01652 Georec_dual_back_push_fifo(fgINT16);
01653 }
01654
01655 void flgr_georec_dual_back_push_fifo_fgINT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01656 FLGR_NhbBox2D *extrMask, fgINT32 pixCenter) {
01657 Georec_dual_back_push_fifo(fgINT32);
01658 }
01659
01660 void flgr_georec_dual_back_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01661 FLGR_NhbBox2D *extrMask, fgFLOAT32 pixCenter) {
01662 Georec_dual_back_push_fifo(fgFLOAT32);
01663 }
01664
01665 void flgr_georec_dual_back_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo, FLGR_NhbBox2D *extrMarker,
01666 FLGR_NhbBox2D *extrMask, fgFLOAT64 pixCenter) {
01667 Georec_dual_back_push_fifo(fgFLOAT64);
01668 }
01669
01670
01671
01672
01674
01676 #define Georec_back_rec_scan_dual_Fifo(dtype) \
01677 int i,j; \
01678 dtype *row_mask, *row_marker; \
01679 FLGR_Vector *result, *vec_arith; \
01680 FLGR_Data2D *nhbars; \
01681 FLGR_Data2D *nhbEven,*nhbOdd; \
01682 FLGR_NhbBox2D *maskextr,*extr; \
01683 \
01684 extr = flgr2d_create_neighbor_box(nhb); \
01685 maskextr = flgr2d_create_neighbor_box(nhb); \
01686 \
01687 result = flgr_vector_create(extr->spp,extr->type); \
01688 vec_arith = flgr_vector_create(extr->spp,extr->type); \
01689 \
01690 nhbEven=flgr2d_create_neighborhood_from(nhb); \
01691 nhbOdd=flgr2d_create_neighborhood_from(nhb); \
01692 \
01693 flgr2d_fill_nhbs_for_6_connexity(nhbEven,nhbOdd,nhb,FLGR_NHB_NO_SYM); \
01694 \
01695 flgr2d_apply_anti_raster_scan_method_##dtype(nhbOdd); \
01696 flgr2d_apply_anti_raster_scan_method_##dtype(nhbEven); \
01697 \
01698 for(i=imgMarker->size_y-1 ; i>=0 ; i--) { \
01699 row_marker = (dtype *) imgMarker->array[i]; \
01700 row_mask = (dtype *) imgMask->array[i]; \
01701 \
01702 for(j=imgMarker->size_x-1 ; j>=0 ; j--) { \
01703 \
01704 nhbars = (((i%2)==1) ? nhbOdd : nhbEven); \
01705 \
01706 flgr2d_get_neighborhood_##dtype(extr,imgMarker,nhbars, i, j); \
01707 flgr2d_get_neighborhood_##dtype(maskextr,imgMask, nhbars, i, j); \
01708 if(row_marker[j]<row_mask[j]) { \
01709 flgr2d_get_nhb_maximum_##dtype(result,extr); \
01710 flgr2d_get_data_vector_no_norm_##dtype(imgMask,i,j,vec_arith); \
01711 flgr_vector_inf_##dtype(result,result,vec_arith); \
01712 flgr2d_set_data_vector_##dtype(imgMarker,i,j,result); \
01713 }else { \
01714 flgr2d_get_nhb_minimum_##dtype(result,extr); \
01715 flgr2d_get_data_vector_no_norm_##dtype(imgMask,i,j,vec_arith); \
01716 flgr_vector_sup_##dtype(result,result,vec_arith); \
01717 flgr2d_set_data_vector_##dtype(imgMarker,i,j,result); \
01718 } \
01719 \
01720 flgr_georec_dual_back_push_fifo_##dtype(fifo,extr,maskextr,row_marker[j]); \
01721 \
01722 } \
01723 } \
01724 \
01725 flgr2d_destroy(nhbOdd); \
01726 flgr2d_destroy(nhbEven); \
01727 \
01728 flgr2d_destroy_neighbor_box(extr); \
01729 flgr2d_destroy_neighbor_box(maskextr); \
01730 flgr_vector_destroy(result); \
01731 flgr_vector_destroy(vec_arith); \
01732 \
01733 return
01734
01735
01736 void flgr_georec_back_recursive_dual_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01737 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01738 Georec_back_rec_scan_dual_Fifo(fgUINT8);
01739 }
01740
01741 void flgr_georec_back_recursive_dual_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01742 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01743 Georec_back_rec_scan_dual_Fifo(fgUINT16);
01744 }
01745
01746 void flgr_georec_back_recursive_dual_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01747 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01748 Georec_back_rec_scan_dual_Fifo(fgUINT32);
01749 }
01750
01751 void flgr_georec_back_recursive_dual_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01752 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01753 Georec_back_rec_scan_dual_Fifo(fgINT8);
01754 }
01755
01756 void flgr_georec_back_recursive_dual_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01757 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01758 Georec_back_rec_scan_dual_Fifo(fgINT16);
01759 }
01760
01761 void flgr_georec_back_recursive_dual_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01762 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01763 Georec_back_rec_scan_dual_Fifo(fgINT32);
01764 }
01765
01766 void flgr_georec_back_recursive_dual_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01767 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01768 Georec_back_rec_scan_dual_Fifo(fgFLOAT32);
01769 }
01770
01771 void flgr_georec_back_recursive_dual_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01772 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01773 Georec_back_rec_scan_dual_Fifo(fgFLOAT64);
01774 }
01775
01776
01777
01778
01779
01781
01783 #define Georec_Dual_Push_Fifo(dtype) \
01784 dtype *pextrMarker; \
01785 dtype *pextrMask; \
01786 int u,v,i,j,k,l,m,h2,w2; \
01787 int *list_x, *list_y; \
01788 dtype pixCenter; \
01789 dtype pixCenterMask; \
01790 dtype maxi,mini; \
01791 \
01792 i=extrmarker->center_coord_y; \
01793 j=extrmarker->center_coord_x; \
01794 \
01795 pextrMarker=(dtype *) extrmarker->list_data_val[0]; \
01796 pextrMask=(dtype *) extrmask->list_data_val[0]; \
01797 list_x = (int *) extrmarker->list_coord_x[0]; \
01798 list_y = (int *) extrmarker->list_coord_y[0]; \
01799 \
01800 flgr_vector_get_element(extrmarker->center_data_val,0,&pixCenter); \
01801 flgr_vector_get_element(extrmask->center_data_val,0,&pixCenterMask); \
01802 \
01803 w2=extrmarker->nhb_size_x/2; \
01804 h2=extrmarker->nhb_size_y/2; \
01805 \
01806 for(m=0 ; m<extrmarker->size[0] ; m++) { \
01807 u=list_y[m]; \
01808 v=list_x[m]; \
01809 k=i+u-h2; \
01810 l=j+v-w2; \
01811 \
01812 if(pextrMarker[m]<pixCenterMask) { \
01813 if( (pextrMarker[m]<pixCenter) && \
01814 (pextrMarker[m]<pextrMask[m]) ) { \
01815 mini=FLGR_MIN(pixCenter,pextrMask[m]); \
01816 flgr2d_set_data_array_##dtype((dtype**) imgMarker->array,k,l,mini); \
01817 flgr_static_fifo_write(fifo,k,l); \
01818 } \
01819 \
01820 }else { \
01821 if( (pextrMarker[m]>pixCenter) && \
01822 (pextrMarker[m]>pextrMask[m]) ) { \
01823 maxi=FLGR_MAX(pixCenter,pextrMask[m]); \
01824 flgr2d_set_data_array_##dtype((dtype**) imgMarker->array,k,l,maxi); \
01825 flgr_static_fifo_write(fifo,k,l); \
01826 } \
01827 } \
01828 } \
01829 return
01830
01831
01832 void flgr_georec_dual_push_fifo_fgUINT8(FLGR_StaticFifo *fifo,
01833 FLGR_NhbBox2D *extrmarker,
01834 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01835 Georec_Dual_Push_Fifo(fgUINT8);
01836 }
01837
01838 void flgr_georec_dual_push_fifo_fgUINT16(FLGR_StaticFifo *fifo,
01839 FLGR_NhbBox2D *extrmarker,
01840 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01841 Georec_Dual_Push_Fifo(fgUINT16);
01842 }
01843
01844 void flgr_georec_dual_push_fifo_fgUINT32(FLGR_StaticFifo *fifo,
01845 FLGR_NhbBox2D *extrmarker,
01846 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01847 Georec_Dual_Push_Fifo(fgUINT32);
01848 }
01849
01850 void flgr_georec_dual_push_fifo_fgINT8(FLGR_StaticFifo *fifo,
01851 FLGR_NhbBox2D *extrmarker,
01852 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01853 Georec_Dual_Push_Fifo(fgINT8);
01854 }
01855
01856 void flgr_georec_dual_push_fifo_fgINT16(FLGR_StaticFifo *fifo,
01857 FLGR_NhbBox2D *extrmarker,
01858 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01859 Georec_Dual_Push_Fifo(fgINT16);
01860 }
01861
01862 void flgr_georec_dual_push_fifo_fgINT32(FLGR_StaticFifo *fifo,
01863 FLGR_NhbBox2D *extrmarker,
01864 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01865 Georec_Dual_Push_Fifo(fgINT32);
01866 }
01867
01868 void flgr_georec_dual_push_fifo_fgFLOAT32(FLGR_StaticFifo *fifo,
01869 FLGR_NhbBox2D *extrmarker,
01870 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01871 Georec_Dual_Push_Fifo(fgFLOAT32);
01872 }
01873
01874 void flgr_georec_dual_push_fifo_fgFLOAT64(FLGR_StaticFifo *fifo,
01875 FLGR_NhbBox2D *extrmarker,
01876 FLGR_NhbBox2D *extrmask, FLGR_Data2D *imgMarker) {
01877 Georec_Dual_Push_Fifo(fgFLOAT64);
01878 }
01879
01880
01881
01882
01883
01884 void flgr_georec_dual_propag_fifo_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01885 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01886 Georec_propag_fifo_cont(fgUINT8,flgr_georec_dual_push_fifo_fgUINT8);
01887 }
01888
01889 void flgr_georec_dual_propag_fifo_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01890 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01891 Georec_propag_fifo_cont(fgUINT16,flgr_georec_dual_push_fifo_fgUINT16);
01892 }
01893
01894
01895 void flgr_georec_dual_propag_fifo_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01896 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01897 Georec_propag_fifo_cont(fgUINT32,flgr_georec_dual_push_fifo_fgUINT32);
01898 }
01899
01900 void flgr_georec_dual_propag_fifo_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01901 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01902 Georec_propag_fifo_cont(fgINT8,flgr_georec_dual_push_fifo_fgINT8);
01903 }
01904
01905 void flgr_georec_dual_propag_fifo_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01906 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01907 Georec_propag_fifo_cont(fgINT16,flgr_georec_dual_push_fifo_fgINT16);
01908
01909 }
01910
01911 void flgr_georec_dual_propag_fifo_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01912 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01913 Georec_propag_fifo_cont(fgINT32,flgr_georec_dual_push_fifo_fgINT32);
01914
01915 }
01916
01917 void flgr_georec_dual_propag_fifo_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01918 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01919 Georec_propag_fifo_cont(fgFLOAT32,flgr_georec_dual_push_fifo_fgFLOAT32);
01920
01921 }
01922
01923 void flgr_georec_dual_propag_fifo_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask,
01924 FLGR_Data2D *nhb, FLGR_StaticFifo *fifo) {
01925 Georec_propag_fifo_cont(fgFLOAT64,flgr_georec_dual_push_fifo_fgFLOAT64);
01926
01927 }
01928
01929
01930
01932
01934 #define GeodesicReconstructionDual(dtype,dtypename) \
01935 \
01936 FLGR_Data2D *nhb; \
01937 FLGR_StaticFifo *fifo; \
01938 \
01939 \
01940 nhb = flgr2d_create_neighborhood_from_connexity(imgMarker->spp,dtypename,connexity); \
01941 \
01942 if(nhb==NULL) return FLGR_RET_ALLOCATION_ERROR; \
01943 \
01944 fifo = flgr_static_fifo_init(imgMarker->size_y,imgMarker->size_x); \
01945 \
01946 flgr_georec_raster_recursive_dual_##dtype(imgMarker,imgMask,nhb); \
01947 flgr_georec_back_recursive_dual_fifo_##dtype(imgMarker, \
01948 imgMask,nhb,fifo); \
01949 flgr_georec_dual_propag_fifo_##dtype(imgMarker,imgMask,nhb,fifo); \
01950 \
01951 flgr2d_destroy(nhb); \
01952 flgr_static_fifo_destroy(fifo); \
01953 \
01954 return FLGR_RET_OK
01955
01956
01957
01958 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgBIT(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01959 flgr_no_define_type_function(FLGR_BIT);
01960 return FLGR_RET_NOT_IMPLEMENTED;
01961 }
01962
01963 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgUINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01964 GeodesicReconstructionDual(fgUINT8,FLGR_UINT8);
01965 }
01966
01967 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgUINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01968 GeodesicReconstructionDual(fgUINT16,FLGR_UINT16);
01969 }
01970
01971 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgUINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01972 GeodesicReconstructionDual(fgUINT32,FLGR_UINT32);
01973 }
01974
01975 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgINT8(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01976 GeodesicReconstructionDual(fgINT8,FLGR_INT8);
01977 }
01978
01979 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgINT16(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01980 GeodesicReconstructionDual(fgINT16,FLGR_INT16);
01981 }
01982
01983 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgINT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01984 GeodesicReconstructionDual(fgINT32,FLGR_INT32);
01985 }
01986
01987 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgFLOAT32(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01988 GeodesicReconstructionDual(fgFLOAT32,FLGR_FLOAT32);
01989 }
01990
01991 FLGR_Ret flgr2d_geodesic_reconstruct_dual_fgFLOAT64(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
01992 GeodesicReconstructionDual(fgFLOAT64,FLGR_FLOAT64);
01993 }
01994
01995
01997
02009
02010 FLGR_Ret flgr2d_geodesic_reconstruct_dual(FLGR_Data2D *imgMarker, FLGR_Data2D *imgMask, FLGR_Connexity connexity) {
02011 FLGR_Ret ret;
02012
02013
02014
02015 if((imgMarker==NULL) || (imgMask==NULL)){
02016 POST_ERROR("Null objects!\n");
02017 return FLGR_RET_NULL_OBJECT;
02018 }
02019
02020 if(imgMarker->spp!=1) {
02021 POST_ERROR("Multi Sample Per Pixel not supported\n");
02022 return FLGR_RET_UNDEFINED_ERROR;
02023 }
02024
02025 if((ret=flgr2d_is_data_same_attributes(imgMarker,imgMask,__FUNCTION__))!=FLGR_RET_OK) return ret;
02026
02027 FLGR_DISPATCH_FUNCTION(FLGR_RET_TYPE_UNKNOWN,imgMarker->type,flgr2d_geodesic_reconstruct_dual,imgMarker, imgMask, connexity);
02028
02029 }
02030
02031
02033
02034
02035