diff options
author | Thomas White <taw@physics.org> | 2020-03-05 11:49:47 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:24 +0200 |
commit | 0fd4dad9b451d9ae09a016bd85363de49b75d393 (patch) | |
tree | 21adc9148c7ac83f3e3db7b4421ff8afc78037b5 /src | |
parent | 6a91dcaf02f92298f582c8d550dcca929dd5989e (diff) |
indexamajig: Create detgeom structure from old detector
Intermediate solution on the path to DataTemplate everywhere.
Diffstat (limited to 'src')
-rw-r--r-- | src/process_image.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/process_image.c b/src/process_image.c index 930052c4..34c0d0c5 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -56,6 +56,7 @@ #include "im-sandbox.h" #include "time-accounts.h" #include "im-zmq.h" +#include "detgeom.h" static float **backup_image_data(float **dp, struct detector *det) @@ -190,6 +191,41 @@ static int file_wait_open_read(struct sb_shm *sb_shared, struct image *image, } +static struct detgeom *detgeom_from_olddet(struct detector *det) +{ + struct detgeom *dg; + int i; + + dg = malloc(sizeof(struct detgeom)); + if ( dg == NULL ) return NULL; + + dg->panels = malloc(det->n_panels*sizeof(struct detgeom_panel)); + if ( dg->panels == NULL ) return NULL; + + dg->n_panels = det->n_panels; + + for ( i=0; i<det->n_panels; i++ ) { + dg->panels[i].name = strdup(det->panels[i].name); + dg->panels[i].cnx = det->panels[i].cnx; + dg->panels[i].cny = det->panels[i].cny; + dg->panels[i].cnz = det->panels[i].clen; + dg->panels[i].pixel_pitch = 1.0/det->panels[i].res; + dg->panels[i].adu_per_photon = det->panels[i].adu_per_photon; + dg->panels[i].max_adu = det->panels[i].max_adu; + dg->panels[i].fsx = det->panels[i].fsx; + dg->panels[i].fsy = det->panels[i].fsy; + dg->panels[i].fsz = det->panels[i].fsz; + dg->panels[i].ssx = det->panels[i].ssx; + dg->panels[i].ssy = det->panels[i].ssy; + dg->panels[i].ssz = det->panels[i].ssz; + dg->panels[i].w = det->panels[i].w; + dg->panels[i].h = det->panels[i].h; + } + + return dg; +} + + void process_image(const struct index_args *iargs, struct pattern_args *pargs, Stream *st, int cookie, const char *tmpdir, int serial, struct sb_shm *sb_shared, TimeAccounts *taccs, @@ -234,6 +270,10 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, } } + /* Create detgeom structure after loading image, + * so we get the "filled in" clen values, etc. */ + image.detgeom = detgeom_from_olddet(iargs->det); + image.bw = iargs->beam->bandwidth; /* Take snapshot of image before applying horrible noise filters */ |