diff options
author | Thomas White <taw@physics.org> | 2011-03-14 17:22:03 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:19 +0100 |
commit | dbb76151b8d3656223a42661869c60cc5e4d809e (patch) | |
tree | a432c3b85d414f660d674cca60d178935f2fa287 /src | |
parent | 5bc39aff3711410f15107e4d5f47e607aa018fd7 (diff) |
More of s/x/fs/, s/y/ss/
Diffstat (limited to 'src')
-rw-r--r-- | src/dw-hdfsee.c | 4 | ||||
-rw-r--r-- | src/image.c | 11 | ||||
-rw-r--r-- | src/image.h | 4 | ||||
-rw-r--r-- | src/index.c | 2 | ||||
-rw-r--r-- | src/mosflm.c | 6 | ||||
-rw-r--r-- | src/peaks.c | 46 | ||||
-rw-r--r-- | src/sum_stack.c | 24 |
7 files changed, 50 insertions, 47 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index 81a59e52..55a06fef 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -248,8 +248,8 @@ static int draw_stuff(cairo_surface_t *surf, DisplayWindow *dw) f = image_get_feature(dw->image->features, i); if ( f == NULL ) continue; - fs = f->x; - ss = f->y; + fs = f->fs; + ss = f->ss; p = find_panel(dw->image->det, fs, ss); if ( p == NULL ) continue; diff --git a/src/image.c b/src/image.c index 81c56414..6acf2c46 100644 --- a/src/image.c +++ b/src/image.c @@ -68,7 +68,7 @@ ImageList *image_list_new() } -void image_add_feature(ImageFeatureList *flist, double x, double y, +void image_add_feature(ImageFeatureList *flist, double fs, double ss, struct image *parent, double intensity, const char *name) { if ( flist->features ) { @@ -80,8 +80,8 @@ void image_add_feature(ImageFeatureList *flist, double x, double y, flist->features = malloc(sizeof(struct imagefeature)); } - flist->features[flist->n_features].x = x; - flist->features[flist->n_features].y = y; + flist->features[flist->n_features].fs = fs; + flist->features[flist->n_features].ss = ss; flist->features[flist->n_features].intensity = intensity; flist->features[flist->n_features].parent = parent; flist->features[flist->n_features].name = name; @@ -115,7 +115,7 @@ void image_feature_list_free(ImageFeatureList *flist) struct imagefeature *image_feature_closest(ImageFeatureList *flist, - double x, double y, + double fs, double ss, double *d, int *idx) { int i; @@ -126,7 +126,8 @@ struct imagefeature *image_feature_closest(ImageFeatureList *flist, double ds; - ds = distance(flist->features[i].x, flist->features[i].y, x, y); + ds = distance(flist->features[i].fs, flist->features[i].ss, + fs, ss); if ( ds < dmin ) { dmin = ds; diff --git a/src/image.h b/src/image.h index 692ef7f8..b61bb396 100644 --- a/src/image.h +++ b/src/image.h @@ -34,8 +34,8 @@ struct imagefeature { struct image *parent; - double x; - double y; + double fs; + double ss; double intensity; /* Reciprocal space coordinates (m^-1 of course) of this feature */ diff --git a/src/index.c b/src/index.c index ddb25eb4..d24b5852 100644 --- a/src/index.c +++ b/src/index.c @@ -114,7 +114,7 @@ void map_all_peaks(struct image *image) f = image_get_feature(image->features, i); if ( f == NULL ) continue; - r = get_q(image, f->x, f->y, NULL, 1.0/image->lambda); + r = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda); f->rx = r.u; f->ry = r.v; f->rz = r.w; } diff --git a/src/mosflm.c b/src/mosflm.c index 0fc8c695..fe6cfca7 100644 --- a/src/mosflm.c +++ b/src/mosflm.c @@ -205,14 +205,14 @@ static void write_spt(struct image *image, const char *filename) f = image_get_feature(image->features, i); if ( f == NULL ) continue; - p = find_panel(image->det, f->x, f->y); + p = find_panel(image->det, f->fs, f->ss); if ( p == NULL ) continue; pix = 1000.0/p->res; /* pixel size in mm */ height = f->intensity; - xs = (f->x-p->min_fs)*p->fsx + (f->y-p->min_ss)*p->ssx; - ys = (f->x-p->min_fs)*p->fsy + (f->y-p->min_ss)*p->ssy; + xs = (f->fs-p->min_fs)*p->fsx + (f->ss-p->min_ss)*p->ssx; + ys = (f->ss-p->min_fs)*p->fsy + (f->ss-p->min_ss)*p->ssy; rx = xs + p->cnx; ry = ys + p->cny; diff --git a/src/peaks.c b/src/peaks.c index 69afc20f..591b9e46 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -62,10 +62,10 @@ static int cull_peaks_in_panel(struct image *image, struct panel *p) f = image_get_feature(image->features, i); if ( f == NULL ) continue; - if ( f->x < p->min_fs ) continue; - if ( f->x > p->max_fs ) continue; - if ( f->y < p->min_ss ) continue; - if ( f->y > p->max_ss ) continue; + if ( f->fs < p->min_fs ) continue; + if ( f->fs > p->max_fs ) continue; + if ( f->ss < p->min_ss ) continue; + if ( f->ss > p->max_ss ) continue; /* How many peaks are in the same column? */ ncol = 0; @@ -78,10 +78,10 @@ static int cull_peaks_in_panel(struct image *image, struct panel *p) g = image_get_feature(image->features, j); if ( g == NULL ) continue; - if ( p->badrow == 'x' ) { - if ( fabs(f->y - g->y) < 2.0 ) ncol++; - } else if ( p->badrow == 'y' ) { - if ( fabs(f->x - g->x) < 2.0 ) ncol++; + if ( p->badrow == 'f' ) { + if ( fabs(f->ss - g->ss) < 2.0 ) ncol++; + } else if ( p->badrow == 's' ) { + if ( fabs(f->fs - g->fs) < 2.0 ) ncol++; } /* else do nothing */ } @@ -95,14 +95,14 @@ static int cull_peaks_in_panel(struct image *image, struct panel *p) struct imagefeature *g; g = image_get_feature(image->features, j); if ( g == NULL ) continue; - if ( p->badrow == 'x' ) { - if ( fabs(f->y - g->y) < 2.0 ) { + if ( p->badrow == 'f' ) { + if ( fabs(f->ss - g->ss) < 2.0 ) { image_remove_feature(image->features, j); nelim++; } - } else if ( p->badrow == 'y' ) { - if ( fabs(f->x - g->x) < 2.0 ) { + } else if ( p->badrow == 's' ) { + if ( fabs(f->fs - g->ss) < 2.0 ) { image_remove_feature(image->features, j); nelim++; @@ -531,7 +531,7 @@ int peak_sanity_check(struct image *image, UnitCell *cell, n_feat++; /* Get closest hkl */ - q = get_q(image, f->x, f->y, NULL, 1.0/image->lambda); + q = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda); hd = q.u * ax + q.v * ay + q.w * az; kd = q.u * bx + q.v * by + q.w * bz; @@ -577,15 +577,15 @@ void integrate_reflections(struct image *image, int polar, int use_closer) refl != NULL; refl = next_refl(refl, iter) ) { - double x, y, intensity; + double fs, ss, intensity; double d; int idx; double bg, max; struct panel *p; - double px, py; + double pfs, pss; - get_detector_pos(refl, &px, &py); - p = find_panel(image->det, px, py); + get_detector_pos(refl, &pfs, &pss); + p = find_panel(image->det, pfs, pss); if ( p == NULL ) continue; if ( p->no_index ) continue; @@ -596,7 +596,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer) if ( image->features != NULL ) { f = image_feature_closest(image->features, - px, py, &d, &idx); + pfs, pss, &d, &idx); } else { f = NULL; } @@ -608,9 +608,9 @@ void integrate_reflections(struct image *image, int polar, int use_closer) * pattern, so instead re-integrate using old * coordinates. This will produce further * revised coordinates. */ - r = integrate_peak(image, f->x, f->y, &x, &y, - &intensity, &bg, &max, - polar, 1); + r = integrate_peak(image, f->fs, f->ss, + &fs, &ss, &intensity, &bg, + &max, polar, 1); if ( r ) { /* The original peak (which also went * through integrate_peak(), but with @@ -627,7 +627,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer) int r; - r = integrate_peak(image, px, py, &x, &y, + r = integrate_peak(image, pfs, pss, &fs, &ss, &intensity, &bg, &max, polar, 1); if ( r ) { @@ -641,7 +641,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer) int r; - r = integrate_peak(image, px, py, &x, &y, + r = integrate_peak(image, pfs, pss, &fs, &ss, &intensity, &bg, &max, polar, 0); if ( r ) { /* Plain old ordinary peak veto */ diff --git a/src/sum_stack.c b/src/sum_stack.c index e7b1245f..84e3fd64 100644 --- a/src/sum_stack.c +++ b/src/sum_stack.c @@ -113,8 +113,9 @@ static void show_help(const char *s) static void sum_peaks(struct image *image, double *sum, double threshold, double min_gradient) { - int x, y, i; + int i; int w = image->width; + int h = image->height; const int lim = INTEGRATION_RADIUS * INTEGRATION_RADIUS; search_peaks(image, threshold, min_gradient); @@ -122,25 +123,26 @@ static void sum_peaks(struct image *image, double *sum, double threshold, for ( i=0; i<image_feature_count(image->features); i++ ) { struct imagefeature *f = image_get_feature(image->features, i); - int xp, yp; + int pfs, pss; + int fs, ss; /* This is not an error. */ if ( f == NULL ) continue; - xp = f->x; - yp = f->y; + pfs = f->fs; + pss = f->ss; - for ( x=-INTEGRATION_RADIUS; x<+INTEGRATION_RADIUS; x++ ) { - for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) { + for ( fs=-INTEGRATION_RADIUS; fs<+INTEGRATION_RADIUS; fs++ ) { + for ( ss=-INTEGRATION_RADIUS; ss<+INTEGRATION_RADIUS; ss++ ) { /* Circular mask */ - if ( x*x + y*y > lim ) continue; + if ( fs*fs + ss*ss > lim ) continue; - if ( ((x+xp)>=image->width) || ((x+xp)<0) ) continue; - if ( ((y+yp)>=image->height) || ((y+yp)<0) ) continue; + if ( ((fs+pfs)>=w) || ((fs+pfs)<0) ) continue; + if ( ((ss+pss)>=h) || ((ss+pss)<0) ) continue; - float val = image->data[(x+xp)+w*(y+yp)]; - sum[(x+xp)+w*(y+yp)] += val; + float val = image->data[(fs+pfs)+w*(ss+pss)]; + sum[(fs+pfs)+w*(ss+pss)] += val; } } |