diff options
author | Thomas White <taw@physics.org> | 2020-07-03 16:06:13 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:45 +0200 |
commit | 6a809813b520d8c882daf569cd86a241b538788c (patch) | |
tree | bda370830fd6bbf72927270cfc27865582d45c42 /libcrystfel/src/image.c | |
parent | 0e8a06927065c275e5e235c9f6ebcb0a397efc81 (diff) |
Create detgeom and data arrays when reading from stream
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r-- | libcrystfel/src/image.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index 20e91e6d..cce29f73 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -388,7 +388,7 @@ static double get_wavelength(struct image *image, const char *from) } -static void create_detgeom(struct image *image, DataTemplate *dtempl) +void create_detgeom(struct image *image, const DataTemplate *dtempl) { struct detgeom *detgeom; int i; @@ -640,6 +640,46 @@ struct image *image_new() } +int create_blank_arrays(struct image *image) +{ + int pn; + int num_panels = image->detgeom->n_panels; + + image->dp = malloc(num_panels*sizeof(float *)); + image->bad = malloc(num_panels*sizeof(int *)); + image->sat = malloc(num_panels*sizeof(float *)); + + if ( (image->dp == NULL) || (image->bad == NULL) + || (image->sat == NULL) ) return 1; + + for ( pn=0; pn<num_panels; pn++ ) { + + long int i; + struct detgeom_panel *p = &image->detgeom->panels[pn]; + + image->dp[pn] = malloc(p->w*p->h*sizeof(float)); + image->bad[pn] = malloc(p->w*p->h*sizeof(int)); + image->sat[pn] = malloc(p->w*p->h*sizeof(float)); + + if ( (image->dp[pn] == NULL) + || (image->bad[pn] == NULL) + || (image->sat[pn] == NULL) ) + { + return 1; + } + + for ( i=0; i<p->w*p->h; i++ ) { + image->dp[pn][i] = 0.0; + image->bad[pn][i] = 0; + image->sat[pn][i] = INFINITY; + } + + } + + return 0; +} + + ImageFeatureList *image_read_peaks(const DataTemplate *dtempl, const char *filename, const char *event, |