diff options
-rw-r--r-- | libcrystfel/src/index.c | 13 | ||||
-rw-r--r-- | libcrystfel/src/peaks.c | 13 | ||||
-rw-r--r-- | libcrystfel/src/render.c | 31 |
3 files changed, 20 insertions, 37 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 2a80fabe..b62f1926 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -812,7 +812,7 @@ static int delete_explained_peaks(struct image *image, Crystal *cr) for ( i=0; i<image_feature_count(image->features); i++ ) { struct imagefeature *f; - struct rvec q; + double q[3]; double h, k, l, hd, kd, ld; double dsq; @@ -821,15 +821,14 @@ static int delete_explained_peaks(struct image *image, Crystal *cr) nspots++; /* Reciprocal space position of found peak */ - q = get_q_for_panel(&image->det->panels[f->pn], - f->fs, f->ss, - NULL, 1.0/image->lambda); + detgeom_transform_coords(&image->detgeom->panels[f->pn], + f->fs, f->ss, image->lambda, q); /* Decimal and fractional Miller indices of nearest * reciprocal lattice point */ - hd = q.u * ax + q.v * ay + q.w * az; - kd = q.u * bx + q.v * by + q.w * bz; - ld = q.u * cx + q.v * cy + q.w * cz; + hd = q[0] * ax + q[1] * ay + q[2] * az; + kd = q[0] * bx + q[1] * by + q[2] * bz; + ld = q[0] * cx + q[1] * cy + q[2] * cz; h = lrint(hd); k = lrint(kd); l = lrint(ld); diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c index e4921058..22f2e7b7 100644 --- a/libcrystfel/src/peaks.c +++ b/libcrystfel/src/peaks.c @@ -590,7 +590,7 @@ int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, for ( i=0; i<image_feature_count(image->features); i++ ) { struct imagefeature *f; - struct rvec q; + double q[3]; double h,k,l,hd,kd,ld; int j; int ok = 0; @@ -601,9 +601,8 @@ int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, n_feat++; /* Reciprocal space position of found peak */ - q = get_q_for_panel(&image->det->panels[f->pn], - f->fs, f->ss, - NULL, 1.0/image->lambda); + detgeom_transform_coords(&image->detgeom->panels[f->pn], + f->fs, f->ss, image->lambda, q); for ( j=0; j<n_cryst; j++ ) { @@ -618,9 +617,9 @@ int indexing_peak_check(struct image *image, Crystal **crystals, int n_cryst, /* Decimal and fractional Miller indices of nearest * reciprocal lattice point */ - hd = q.u * ax + q.v * ay + q.w * az; - kd = q.u * bx + q.v * by + q.w * bz; - ld = q.u * cx + q.v * cy + q.w * cz; + hd = q[0] * ax + q[1] * ay + q[2] * az; + kd = q[0] * bx + q[1] * by + q[2] * bz; + ld = q[0] * cx + q[1] * cy + q[2] * cz; h = lrint(hd); k = lrint(kd); l = lrint(ld); diff --git a/libcrystfel/src/render.c b/libcrystfel/src/render.c index f39fcde2..ff2df162 100644 --- a/libcrystfel/src/render.c +++ b/libcrystfel/src/render.c @@ -7,7 +7,7 @@ * a research centre of the Helmholtz Association. * * Authors: - * 2009-2012,2014 Thomas White <taw@physics.org> + * 2009-2020 Thomas White <taw@physics.org> * * This file is part of CrystFEL. * @@ -53,22 +53,12 @@ static float *get_binned_panel(struct image *image, int binning, float *data; int x, y; int w, h; - int p_w, p_h; - - /* Use new API if possible */ - if ( image->detgeom != NULL ) { - struct detgeom_panel *p = &image->detgeom->panels[pi]; - p_w = p->w; - p_h = p->h; - } else { - struct panel *p = &image->det->panels[pi]; - p_w = p->w; - p_h = p->h; - } + + struct detgeom_panel *p = &image->detgeom->panels[pi]; /* Some pixels might get discarded */ - w = p_w / binning; - h = p_h / binning; + w = p->w / binning; + h = p->h / binning; *pw = w; *ph = h; @@ -92,11 +82,11 @@ static float *get_binned_panel(struct image *image, int binning, fs = binning*x+xb; ss = binning*y+yb; - v = image->dp[pi][fs+ss*p_w]; + v = image->dp[pi][fs+ss*p->w]; total += v; if ( (image->bad != NULL) - && (image->bad[pi][fs+ss*p_w]) ) bad = 1; + && (image->bad[pi][fs+ss*p->w]) ) bad = 1; } } @@ -187,12 +177,7 @@ GdkPixbuf **render_panels(struct image *image, double max; int *ws, *hs; - /* Use new API if possible */ - if ( image->detgeom != NULL ) { - np = image->detgeom->n_panels; - } else { - np = image->det->n_panels; - } + np = image->detgeom->n_panels; hdrs = calloc(np, sizeof(float *)); ws = calloc(np, sizeof(int)); |