aboutsummaryrefslogtreecommitdiff
path: root/src/peaks.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-06-07 18:09:52 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:28 +0100
commit60572e7d69ffda00c7738168c0cd8ed83c3fb363 (patch)
tree410ea40bb9a1c131efc5a20aee59f13dd310adee /src/peaks.c
parentb7050c2de9a6e990fac39554d65018b641397dee (diff)
Add half a pixel to coordinates when integrating peak
Choose whichever one of these reasons makes most sense to you: 1. The centroid operation gives the position as a "pixel index", but we really want it as a distance in pixels from the corner. 2. If all the intensity is in one pixel, the best estimate of where the photons hit is in the middle of the pixel, not its corner.
Diffstat (limited to 'src/peaks.c')
-rw-r--r--src/peaks.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/peaks.c b/src/peaks.c
index c542e44c..61f5fa5a 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -246,11 +246,11 @@ int integrate_peak(struct image *image, int cfs, int css,
/* The centroid is excitingly undefined if there is no intensity */
if ( centroid && (total != 0) ) {
- *pfs = (double)fsct / total;
- *pss = (double)ssct / total;
+ *pfs = ((double)fsct / total) + 0.5;
+ *pss = ((double)ssct / total) + 0.5;
} else {
- *pfs = (double)cfs;
- *pss = (double)css;
+ *pfs = (double)cfs + 0.5;
+ *pss = (double)css + 0.5;
}
if ( bgsub ) {
*intensity = total - pixel_counts*noise_mean;