aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-18 10:41:46 +0100
committerThomas White <taw@physics.org>2009-11-18 10:41:46 +0100
commit239dfda559a4982079b3e7e824eeec2e3ebf3696 (patch)
treef63f0bd59193d5d993198eb29fb19e1335275e77
parent78d56f043d77961c3967e56dc65ea040eb38a55f (diff)
Initial work on bloom
-rw-r--r--src/detector.c33
-rw-r--r--src/image.h5
2 files changed, 35 insertions, 3 deletions
diff --git a/src/detector.c b/src/detector.c
index 261f9fff..13d5a20b 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -22,6 +22,33 @@
#define PULSE_ENERGY_DENSITY (30.0e7)
+/* Detector's quantum efficiency */
+#define DQE (0.8)
+
+
+static uint16_t *bloom(double *hdr, int width, int height)
+{
+ int x, y;
+ uint16_t *data;
+
+ data = malloc(width * height * sizeof(uint16_t));
+
+ for ( x=0; x<width; x++ ) {
+ for ( y=0; y<height; y++ ) {
+
+ double hdval;
+
+ hdval = hdr[x + width*y] * DQE;
+
+
+
+ }
+ }
+
+ return data;
+}
+
+
void record_image(struct image *image)
{
int x, y;
@@ -38,7 +65,7 @@ void record_image(struct image *image)
sa_per_pixel = pow(2.0 * twotheta_max / np, 2.0);
printf("sa per pixel=%e\n", sa_per_pixel);
- image->data = malloc(image->width * image->height * sizeof(uint16_t));
+ image->hdr = malloc(image->width * image->height * sizeof(double));
for ( x=0; x<image->width; x++ ) {
for ( y=0; y<image->height; y++ ) {
@@ -56,8 +83,10 @@ void record_image(struct image *image)
counts = intensity * ph_per_e * sa;
- image->data[x + image->width*y] = counts;
+ image->hdr[x + image->width*y] = counts;
}
}
+
+ image->data = bloom(image->hdr, image->width, image->height);
}
diff --git a/src/image.h b/src/image.h
index 40e3e35e..b40f8a57 100644
--- a/src/image.h
+++ b/src/image.h
@@ -60,7 +60,8 @@ struct threevec
/* Structure describing an image */
struct image {
- uint16_t *data;
+ double *hdr; /* Actual counts */
+ uint16_t *data; /* Integer counts after DQE/bloom */
double complex *sfacs;
struct threevec *qvecs;
double *twotheta;
@@ -120,4 +121,6 @@ extern struct imagefeature *image_feature_closest(ImageFeatureList *flist,
extern int image_feature_count(ImageFeatureList *flist);
extern struct imagefeature *image_get_feature(ImageFeatureList *flist, int idx);
+extern void record_image(struct image *image);
+
#endif /* IMAGE_H */