aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r--libcrystfel/src/image.c42
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,