aboutsummaryrefslogtreecommitdiff
path: root/src/itrans-zaefferer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/itrans-zaefferer.c')
-rw-r--r--src/itrans-zaefferer.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/itrans-zaefferer.c b/src/itrans-zaefferer.c
index 79e2468..f0eec9e 100644
--- a/src/itrans-zaefferer.c
+++ b/src/itrans-zaefferer.c
@@ -3,7 +3,7 @@
*
* Zaefferer peak search
*
- * (c) 2007 Thomas White <taw27@cam.ac.uk>
+ * (c) 2007-2008 Thomas White <taw27@cam.ac.uk>
*
* dtr - Diffraction Tomography Reconstruction
*
@@ -65,26 +65,40 @@ ImageFeatureList *itrans_peaksearch_zaefferer(ImageRecord *imagerecord) {
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<smallest(mask_y+PEAK_WINDOW_SIZE/2, height); sy++ ) {
- for ( sx=biggest(mask_x-PEAK_WINDOW_SIZE/2, 0); sx<smallest(mask_x+PEAK_WINDOW_SIZE/2, width); sx++ ) {
+
+ for ( sy=biggest(mask_y-PEAK_WINDOW_SIZE/2, 0);
+ sy<smallest(mask_y+PEAK_WINDOW_SIZE/2, height);
+ sy++ ) {
+
+ for ( sx=biggest(mask_x-PEAK_WINDOW_SIZE/2, 0);
+ sx<smallest(mask_x+PEAK_WINDOW_SIZE/2, width);
+ sx++ ) {
+
if ( image[sx+width*sy] > max ) {
max = image[sx+width*sy];
mask_x = sx;
mask_y = sy;
did_something = 1;
}
+
}
+
}
+
}
if ( !did_something ) {
+
assert(mask_x<width);
assert(mask_y<height);
assert(mask_x>=0);
assert(mask_y>=0);
- image_add_feature(flist, mask_x, mask_y, imagerecord, image[mask_x + width*mask_y]);
+ image_add_feature(flist, mask_x, mask_y, imagerecord,
+ image[mask_x + width*mask_y]);
+
}
}