aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-09-08 16:01:54 +0200
committerThomas White <taw@physics.org>2020-09-08 16:16:48 +0200
commitf2ef38b3323489ec2435a547b39bca211f69f0d0 (patch)
treeabd4a939730027cdffe862bce6e56a1942f58040
parent3269c5306a5b185dd364c1e5631e3527f17432b3 (diff)
Show prediction boxes at the right size
-rw-r--r--src/crystfel_gui.c2
-rw-r--r--src/crystfelimageview.c34
-rw-r--r--src/crystfelimageview.h4
3 files changed, 37 insertions, 3 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 47b6c66b..2c624c5d 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -189,6 +189,8 @@ void update_imageview(struct crystfelproject *proj)
crystfel_image_view_set_show_reflections(CRYSTFEL_IMAGE_VIEW(proj->imageview),
proj->show_refls);
+ crystfel_image_view_set_refl_box_size(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ proj->indexing_params.ir_inn);
crystfel_image_view_set_show_peaks(CRYSTFEL_IMAGE_VIEW(proj->imageview),
proj->show_peaks);
crystfel_image_view_set_image(CRYSTFEL_IMAGE_VIEW(proj->imageview),
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 9773c4d4..e9677b8b 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -455,18 +455,38 @@ static void draw_refls(cairo_t *cr, CrystFELImageView *iv,
double fs, ss;
int pn;
double x, y;
+ float this_bs;
+ float this_lw;
+ int show_cen = 0;
get_detector_pos(refl, &fs, &ss);
pn = get_panel_number(refl);
-
p = &iv->image->detgeom->panels[pn];
+
+ this_lw = biggest(0.1*p->pixel_pitch, lw);
+ this_bs = biggest(iv->refl_box_size * p->pixel_pitch,
+ bs);
+
+ if ( this_bs > bs ) {
+ show_cen = 1;
+ }
+
x = p->pixel_pitch*(p->cnx + p->fsx*fs + p->ssx*ss);
y = p->pixel_pitch*(p->cny + p->fsy*fs + p->ssy*ss);
- cairo_arc(cr, x, y, bs, 0, 2*M_PI);
- cairo_set_line_width(cr, lw);
+ cairo_arc(cr, x, y, this_bs, 0, 2*M_PI);
+ cairo_set_line_width(cr, this_lw);
cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
cairo_stroke(cr);
+
+ if ( show_cen ) {
+ cairo_move_to(cr, x-this_bs, y);
+ cairo_line_to(cr, x+this_bs, y);
+ cairo_move_to(cr, x, y-this_bs);
+ cairo_line_to(cr, x, y+this_bs);
+ cairo_stroke(cr);
+ }
+
}
}
@@ -657,6 +677,7 @@ GtkWidget *crystfel_image_view_new()
iv->brightness = 1.0;
iv->pixbufs = NULL;
iv->peak_box_size = 1.0;
+ iv->refl_box_size = 1.0;
g_signal_connect(G_OBJECT(iv), "destroy",
G_CALLBACK(destroy_sig), iv);
@@ -927,3 +948,10 @@ void crystfel_image_view_set_peak_box_size(CrystFELImageView *iv,
{
iv->peak_box_size = box_size;
}
+
+
+void crystfel_image_view_set_refl_box_size(CrystFELImageView *iv,
+ float box_size)
+{
+ iv->refl_box_size = box_size;
+}
diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h
index e417dd62..a8f8df99 100644
--- a/src/crystfelimageview.h
+++ b/src/crystfelimageview.h
@@ -89,6 +89,7 @@ struct _crystfelimageview
int show_peaks;
int show_refls;
float peak_box_size;
+ float refl_box_size;
};
struct _crystfelimageviewclass
@@ -119,4 +120,7 @@ extern void crystfel_image_view_set_show_reflections(CrystFELImageView *iv,
extern void crystfel_image_view_set_peak_box_size(CrystFELImageView *iv,
float box_size);
+extern void crystfel_image_view_set_refl_box_size(CrystFELImageView *iv,
+ float box_size);
+
#endif /* CRYSTFELIMAGEVIEW_H */