aboutsummaryrefslogtreecommitdiff
path: root/src/imagedisplay.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-11-30 17:53:27 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-11-30 17:53:27 +0000
commitcf7a9b848cfa0ec4b649f54100b6ff92e5553232 (patch)
tree6007c5f513fc8fa57a6c78690c3ed1bde927bb6c /src/imagedisplay.c
parent627e71291eb879b77a97e1c429cfb8c6181f7179 (diff)
Attempt to make itrans-stat quantitative
Size of ImageDisplayMark circles depend on intensity of reflection git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@216 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/imagedisplay.c')
-rw-r--r--src/imagedisplay.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/imagedisplay.c b/src/imagedisplay.c
index 1caaf9e..9c3f6cd 100644
--- a/src/imagedisplay.c
+++ b/src/imagedisplay.c
@@ -173,6 +173,7 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even
double scale, xoffs, yoffs;
ImageDisplayMark *cur;
+ double max;
xoffs = ((double)imagedisplay->drawingarea_width - imagedisplay->view_width) / 2;
yoffs = ((double)imagedisplay->drawingarea_height - imagedisplay->view_height) / 2;
@@ -211,6 +212,15 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even
imagedisplay->imagerecord.x_centre * scale,
imagedisplay->imagerecord.y_centre * scale + 10);
}
+
+ /* Find the maximum intensity */
+ cur = imagedisplay->marks;
+ max = 0.0;
+ while ( cur ) {
+ if ( cur->weight > max ) max = cur->weight;
+ if ( cur->weight < 0.0 ) printf("ID: Warning: ImageDisplayMark with negative weight\n");
+ cur = cur->next;
+ }
cur = imagedisplay->marks;
while ( cur ) {
@@ -229,10 +239,14 @@ static gboolean imagedisplay_redraw(GtkWidget *drawingarea, GdkEventExpose *even
if ( (cur->type == IMAGEDISPLAY_MARK_CIRCLE_1) || (cur->type == IMAGEDISPLAY_MARK_CIRCLE_2)
|| (cur->type == IMAGEDISPLAY_MARK_CIRCLE_3) ) {
+ double r;
+
+ r = 20 * (cur->weight/max);
+
gdk_draw_arc(drawingarea->window, gc, FALSE,
- xoffs + cur->x*scale - 5,
- yoffs + imagedisplay->view_height-1-cur->y*scale - 5,
- 11, 11, 0, 64*360);
+ xoffs + cur->x*scale - r,
+ yoffs + imagedisplay->view_height-1-cur->y*scale - r,
+ 2*r, 2*r, 0, 64*360);
} else if ( (cur->type == IMAGEDISPLAY_MARK_LINE_1) || (cur->type == IMAGEDISPLAY_MARK_LINE_2) ) {
@@ -344,13 +358,14 @@ ImageDisplay *imagedisplay_open(ImageRecord image, const char *title, ImageDispl
return imagedisplay_open_with_message(image, title, NULL, flags, NULL, NULL);
}
-void imagedisplay_add_mark(ImageDisplay *imagedisplay, double x, double y, ImageDisplayMarkType type) {
+void imagedisplay_add_mark(ImageDisplay *imagedisplay, double x, double y, ImageDisplayMarkType type, double weight) {
ImageDisplayMark *new;
new = malloc(sizeof(ImageDisplayMark));
new->x = x; new->y = y;
new->type = type;
+ new->weight = weight;
new->next = NULL;
if ( !imagedisplay->marks ) {
@@ -373,6 +388,7 @@ void imagedisplay_add_line(ImageDisplay *imagedisplay, double x1, double y1, dou
new->x = x1; new->y = y1;
new->x2 = x2; new->y2 = y2;
new->type = type;
+ new->weight = 1.0; /* This field makes little sense for a line */
new->next = NULL;
if ( !imagedisplay->marks ) {