aboutsummaryrefslogtreecommitdiff
path: root/src/process_image.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-02-18 09:50:53 +0100
committerThomas White <taw@physics.org>2015-02-18 15:14:42 +0100
commit2b8b1a0013bebfdb351bd6b6158c3a2c6e8089b9 (patch)
treedb317fa3d5b18605899563e59705ee634f28120e /src/process_image.c
parentceae2d277c9add4731cb24cf33570e988bb57c3e (diff)
Fix profile radius determination
Diffstat (limited to 'src/process_image.c')
-rw-r--r--src/process_image.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/process_image.c b/src/process_image.c
index 847cc9f4..bfdd1bee 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -54,14 +54,10 @@
static int cmpd2(const void *av, const void *bv)
{
- double *ap, *bp;
double a, b;
- ap = (double *)av;
- bp = (double *)bv;
-
- a = ap[1];
- b = bp[1];
+ a = *(double *)av;
+ b = *(double *)bv;
if ( fabs(a) < fabs(b) ) return -1;
return 1;
@@ -161,7 +157,7 @@ static void refine_radius(Crystal *cr, ImageFeatureList *flist)
qsort(acc, n_acc, sizeof(double), cmpd2);
n = n_acc/50;
- if ( n < 2 ) n = 2;
+ if ( n < 2 ) n = 2; /* n_acc is always >= 2 */
crystal_set_profile_radius(cr, acc[(n_acc-1)-n]);
free(acc);