aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-09-08 14:43:58 +0200
committerThomas White <taw@physics.org>2020-09-08 16:16:48 +0200
commitfd6b5f255b1052255c0c15e2dd6f4a62b5dd9219 (patch)
treeb85883702c60ed74a1ab7af41c1fcc08981340bd
parent056dc691cbca0a69fb457e4c546df8d88655e478 (diff)
Make peak box bigger (and add crosshairs) at high magnification
-rw-r--r--src/crystfelimageview.c35
-rw-r--r--src/crystfelimageview.h4
-rw-r--r--src/gui_peaksearch.c3
3 files changed, 39 insertions, 3 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 3ca5aed6..119efbc2 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -385,26 +385,47 @@ static void draw_peaks(cairo_t *cr, CrystFELImageView *iv,
int i, n_pks;
double bs, lw;
- bs = 5.0;
- lw = 1.0;
+ bs = 5.0; /* Box size in pixels on screen */
+ lw = 1.0; /* Line width in pixels on screen */
cairo_device_to_user_distance(cr, &bs, &lw);
bs = fabs(bs);
lw = fabs(lw);
n_pks = image_feature_count(pks);
for ( i=0; i<n_pks; i++ ) {
+
const struct imagefeature *f;
struct detgeom_panel *p;
double x, y;
+ double this_bs;
+ int show_cen = 0;
+
f = image_get_feature_const(pks, i);
if ( f == NULL ) continue;
p = &iv->image->detgeom->panels[f->pn];
+
+ this_bs = biggest(iv->peak_box_size * p->pixel_pitch,
+ bs);
+
+ if ( this_bs > bs ) {
+ show_cen = 1;
+ }
+
x = p->pixel_pitch*(p->cnx + p->fsx*f->fs + p->ssx*f->ss);
y = p->pixel_pitch*(p->cny + p->fsy*f->fs + p->ssy*f->ss);
- cairo_rectangle(cr, x-bs, y-bs, 2*bs, 2*bs);
+ cairo_rectangle(cr, x-this_bs, y-this_bs, 2*this_bs, 2*this_bs);
cairo_set_line_width(cr, lw);
cairo_set_source_rgb(cr, 1.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);
+ }
+
}
}
@@ -633,6 +654,7 @@ GtkWidget *crystfel_image_view_new()
iv->show_peaks = 0;
iv->brightness = 1.0;
iv->pixbufs = NULL;
+ iv->peak_box_size = 1.0;
g_signal_connect(G_OBJECT(iv), "destroy",
G_CALLBACK(destroy_sig), iv);
@@ -896,3 +918,10 @@ void crystfel_image_view_set_show_reflections(CrystFELImageView *iv,
iv->show_refls = show_refls;
rerender_image(iv);
}
+
+
+void crystfel_image_view_set_peak_box_size(CrystFELImageView *iv,
+ float box_size)
+{
+ iv->peak_box_size = box_size;
+}
diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h
index ff07f4b3..e417dd62 100644
--- a/src/crystfelimageview.h
+++ b/src/crystfelimageview.h
@@ -88,6 +88,7 @@ struct _crystfelimageview
double brightness;
int show_peaks;
int show_refls;
+ float peak_box_size;
};
struct _crystfelimageviewclass
@@ -115,4 +116,7 @@ extern void crystfel_image_view_set_show_peaks(CrystFELImageView *iv,
extern void crystfel_image_view_set_show_reflections(CrystFELImageView *iv,
int show_refls);
+extern void crystfel_image_view_set_peak_box_size(CrystFELImageView *iv,
+ float box_size);
+
#endif /* CRYSTFELIMAGEVIEW_H */
diff --git a/src/gui_peaksearch.c b/src/gui_peaksearch.c
index 3bbb92bb..334a624e 100644
--- a/src/gui_peaksearch.c
+++ b/src/gui_peaksearch.c
@@ -52,6 +52,9 @@ void update_peaks(struct crystfelproject *proj)
if ( proj->n_frames == 0 ) return;
if ( proj->cur_image == NULL ) return;
+ crystfel_image_view_set_peak_box_size(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ proj->peak_search_params.pk_inn);
+
if ( proj->show_peaks ) {
image_feature_list_free(proj->cur_image->features);