aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-10-21 18:08:53 -0700
committerThomas White <taw@physics.org>2012-10-21 18:08:53 -0700
commit897f86654afe36f57b7000a25c4489e1e534eede (patch)
treebf616caedee7745ecfc7745d5c930bf649bfaf93
parent89f435823a570f621f23baabf437b4f568667da4 (diff)
hdfsee: Rationalise colour scale calculation, ignore max_adu
-rw-r--r--src/hdfsee-render.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/hdfsee-render.c b/src/hdfsee-render.c
index 2a7e4d86..c78aa677 100644
--- a/src/hdfsee-render.c
+++ b/src/hdfsee-render.c
@@ -65,12 +65,14 @@ static float *get_binned_panel(struct image *image, int binning,
data = malloc(w*h*sizeof(float));
+ *max = 0.0;
for ( x=0; x<w; x++ ) {
for ( y=0; y<h; y++ ) {
double total;
size_t xb, yb;
int bad = 0;
+ double val;
total = 0;
for ( xb=0; xb<binning; xb++ ) {
@@ -85,8 +87,6 @@ static float *get_binned_panel(struct image *image, int binning,
v = in[fs+ss*fw];
total += v;
- if ( v > p->max_adu ) tbad = 1;
-
if ( in_bad_region(image->det, fs, ss) ) tbad = 1;
if ( image->flags != NULL ) {
@@ -104,17 +104,19 @@ static float *get_binned_panel(struct image *image, int binning,
}
- if ( !tbad ) {
- if ( v > *max ) *max = v;
- }
if ( tbad ) bad = 1;
}
}
- data[x+w*y] = total / ((double)binning * (double)binning);
+ val = total / ((double)binning * (double)binning);
- if ( bad ) data[x+w*y] = -INFINITY;
+ if ( bad ) {
+ data[x+w*y] = -INFINITY;
+ } else {
+ data[x+w*y] = val;
+ if ( val > *max ) *max = val;
+ }
}
}