/* * itrans-zaefferer.c * * Zaefferer peak search * * (c) 2007-2008 Thomas White * * dtr - Diffraction Tomography Reconstruction * */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include "utils.h" #include "image.h" #define PEAK_WINDOW_SIZE 20 ImageFeatureList *itrans_peaksearch_zaefferer(ImageRecord *imagerecord) { int x, y; int width, height; uint16_t *image; ImageFeatureList *flist; flist = image_feature_list_new(); image = imagerecord->image; width = imagerecord->width; height = imagerecord->height; for ( x=1; x 400 ) { int mask_x, mask_y; int sx, sy; double max; unsigned int did_something = 1; mask_x = x; mask_y = y; while ( (did_something) && (distance(mask_x, mask_y, x, y)<50) ) { max = image[mask_x+width*mask_y]; did_something = 0; for ( sy=biggest(mask_y-PEAK_WINDOW_SIZE/2, 0); sy max ) { max = image[sx+width*sy]; mask_x = sx; mask_y = sy; did_something = 1; } } } } if ( !did_something ) { double d; int idx; assert(mask_x=0); assert(mask_y>=0); /* Check for a feature at exactly the same coordinates */ image_feature_closest(flist, mask_x, mask_y, &d, &idx); if ( d > 1.0 ) { image_add_feature(flist, mask_x, mask_y, imagerecord, image[mask_x + width*mask_y]); } } } } } return flist; }