aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-19 11:16:07 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commit398cd84f18a0f08d12055cd9f71caef5bae68d47 (patch)
tree8797d0b73ff2a06d8bda96c9f14d81ea4a5cfec3
parentccfe704df3d374c4e3a7a0c3944b9c3384e80e3e (diff)
Put brackets round values of bad pixels
-rw-r--r--src/crystfelimageview.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 34073508..d6e898b6 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -221,7 +221,8 @@ static void swap(int *a, int *b)
static void draw_pixel_values(cairo_t *cr,
double imin_fs, double imin_ss,
double imax_fs, double imax_ss,
- struct detgeom_panel p, float *dp)
+ struct detgeom_panel p, float *dp,
+ int *bad)
{
int min_fs, max_fs, min_ss, max_ss;
int fs, ss;
@@ -252,6 +253,8 @@ static void draw_pixel_values(cairo_t *cr,
char tmp[64];
PangoRectangle rec;
double rw, rh;
+ const char *b1;
+ const char *b2;
fsd = fs + 0.5;
ssd = ss + 0.5;
@@ -259,7 +262,15 @@ static void draw_pixel_values(cairo_t *cr,
x = (fsd*p.fsx + ssd*p.ssx + p.cnx)*p.pixel_pitch;
y = (fsd*p.fsy + ssd*p.ssy + p.cny)*p.pixel_pitch;
- snprintf(tmp, 63, "%.f", dp[fs+ss*p.w]);
+ if ( bad[fs+ss*p.w] ) {
+ b1 = "(";
+ b2 = ")";
+ } else {
+ b1 = "";
+ b2 = "";
+ }
+
+ snprintf(tmp, 63, "%s%.f%s", b1, dp[fs+ss*p.w], b2);
pango_layout_set_text(layout, tmp, -1);
cairo_save(cr);
@@ -365,7 +376,7 @@ static void draw_panel_rectangle(cairo_t *cr, CrystFELImageView *iv,
pixel_size_on_screen = smallest(fabs(xs), fabs(ys));
if ( (pixel_size_on_screen > 40.0) && have_pixels ) {
draw_pixel_values(cr, min_x, min_y, max_x, max_y, p,
- iv->image->dp[i]);
+ iv->image->dp[i], iv->image->bad[i]);
}
}