diff options
author | Thomas White <taw@physics.org> | 2020-03-17 16:10:00 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | aa183716dbe65a047b8e33aa7b4a8e2bdba7d99e (patch) | |
tree | f4e2eed351be4fae330b34dbbf9e8dbf5c9f1109 | |
parent | e173da81d1bfd011589458963840ca72404177e4 (diff) |
Convert peakfinder8 to use new API
-rw-r--r-- | libcrystfel/src/peakfinder8.c | 46 | ||||
-rw-r--r-- | src/gui_peaksearch.c | 1 |
2 files changed, 20 insertions, 27 deletions
diff --git a/libcrystfel/src/peakfinder8.c b/libcrystfel/src/peakfinder8.c index 492f5741..5a874025 100644 --- a/libcrystfel/src/peakfinder8.c +++ b/libcrystfel/src/peakfinder8.c @@ -37,6 +37,8 @@ #include <stdlib.h> #include "peakfinder8.h" +#include "detgeom.h" +#include "image.h" /** \file peakfinder8.h */ @@ -101,10 +103,10 @@ struct peakfinder_peak_data // CrystFEL-only block 2 -static struct radius_maps *compute_radius_maps(struct detector *det) +static struct radius_maps *compute_radius_maps(struct detgeom *det) { int i, u, iss, ifs; - struct panel p; + struct detgeom_panel p; struct radius_maps *rm = NULL; rm = (struct radius_maps *)malloc(sizeof(struct radius_maps)); @@ -173,14 +175,14 @@ static struct peakfinder_mask *create_peakfinder_mask(struct image *img, struct peakfinder_mask *msk; msk = (struct peakfinder_mask *)malloc(sizeof(struct peakfinder_mask)); - msk->masks =(char **) malloc(img->det->n_panels*sizeof(char*)); - msk->n_masks = img->det->n_panels; - for ( i=0; i<img->det->n_panels; i++) { + msk->masks =(char **) malloc(img->detgeom->n_panels*sizeof(char*)); + msk->n_masks = img->detgeom->n_panels; + for ( i=0; i<img->detgeom->n_panels; i++) { - struct panel p; + struct detgeom_panel p; int iss, ifs; - p = img->det->panels[i]; + p = img->detgeom->panels[i]; msk->masks[i] = (char *)calloc(p.w*p.h,sizeof(char)); @@ -1040,14 +1042,10 @@ int peakfinder8(struct image *img, int max_n_peaks, iterations = 5; - if ( img-> det == NULL) { - return 1; - } + if ( img->detgeom == NULL) return 1; - rmaps = compute_radius_maps(img->det); - if ( rmaps == NULL ) { - return 1; - } + rmaps = compute_radius_maps(img->detgeom); + if ( rmaps == NULL ) return 1; pfmask = create_peakfinder_mask(img, rmaps, min_res, max_res); if ( pfmask == NULL ) { @@ -1055,18 +1053,18 @@ int peakfinder8(struct image *img, int max_n_peaks, return 1; } - pfdata = allocate_panel_data(img->det->n_panels); + pfdata = allocate_panel_data(img->detgeom->n_panels); if ( pfdata == NULL) { free_radius_maps(rmaps); free_peakfinder_mask(pfmask); return 1; } - for ( pi=0 ; pi<img->det->n_panels ; pi++ ) { - pfdata->panel_h[pi] = img->det->panels[pi].h; - pfdata->panel_w[pi] = img->det->panels[pi].w; + for ( pi=0 ; pi<img->detgeom->n_panels ; pi++ ) { + pfdata->panel_h[pi] = img->detgeom->panels[pi].h; + pfdata->panel_w[pi] = img->detgeom->panels[pi].w; pfdata->panel_data[pi] = img->dp[pi]; - pfdata->num_panels = img->det->n_panels; + pfdata->num_panels = img->detgeom->n_panels; } max_r = -1e9; @@ -1139,7 +1137,7 @@ int peakfinder8(struct image *img, int max_n_peaks, remaining_max_num_peaks = max_n_peaks; - for ( pi=0 ; pi<img->det->n_panels ; pi++) { + for ( pi=0 ; pi<img->detgeom->n_panels ; pi++) { int peaks_to_add; int pki; @@ -1147,10 +1145,6 @@ int peakfinder8(struct image *img, int max_n_peaks, num_found_peaks = 0; - if ( img->det->panels[pi].no_index ) { - continue; - } - ret = peakfinder8_base(rstats->roffset, rstats->rthreshold, pfdata->panel_data[pi], @@ -1192,9 +1186,9 @@ int peakfinder8(struct image *img, int max_n_peaks, for ( pki=0 ; pki<peaks_to_add ; pki++ ) { - struct panel *p; + struct detgeom_panel *p; - p = &img->det->panels[pi]; + p = &img->detgeom->panels[pi]; if ( pkdata->max_i[pki] > p->max_adu ) { if ( !use_saturated ) { diff --git a/src/gui_peaksearch.c b/src/gui_peaksearch.c index 8bcf5f67..b641fb30 100644 --- a/src/gui_peaksearch.c +++ b/src/gui_peaksearch.c @@ -71,7 +71,6 @@ void update_peaks(struct crystfelproject *proj) break; case PEAK_PEAKFINDER8: - STATUS("NB peakfinder8 doesn't yet use new API\n"); search_peaks_peakfinder8(image, 2048, proj->peak_search_params.threshold, proj->peak_search_params.min_snr, |