diff options
author | Thomas White <taw@physics.org> | 2010-01-08 15:53:17 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-01-08 15:53:17 +0100 |
commit | bd26d5745269594647ec79f64fdfb8e750891672 (patch) | |
tree | 29968c2c0872fe0d52c5078426c3a89f1e8ed6ec /src/displaywindow.c | |
parent | a374cdb2396659d711f85851cb0904ccf7c9731d (diff) |
Zaefferer gradient search
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r-- | src/displaywindow.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index 84f89347..9a65fb16 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -26,6 +26,7 @@ #include "render.h" #include "hdf5-file.h" #include "hdfsee.h" +#include "utils.h" #define INITIAL_BINNING 2 @@ -399,6 +400,37 @@ static gint displaywindow_set_boostint(GtkWidget *widget, DisplayWindow *dw) } +static void load_features_from_file(struct image *image, const char *filename) +{ + FILE *fh; + char *rval; + + fh = fopen(filename, "r"); + if ( fh == NULL ) return; + + if ( image->features != NULL ) { + image_feature_list_free(image->features); + } + image->features = image_feature_list_new(); + + do { + char line[1024]; + int x, y; + int r; + + rval = fgets(line, 1023, fh); + if ( rval == NULL ) continue; + chomp(line); + + r = sscanf(line, "%i %i", &x, &y); + if ( r != 2 ) continue; + + image_add_feature(image->features, x, y, image, 1.0); + + } while ( rval != NULL ); +} + + static gint displaywindow_peaklist_response(GtkWidget *d, gint response, DisplayWindow *dw) { @@ -408,7 +440,8 @@ static gint displaywindow_peaklist_response(GtkWidget *d, gint response, filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d)); - load_features_from_file(dw->image); + load_features_from_file(hdfile_get_image(dw->hdfile), filename); + displaywindow_update(dw); g_free(filename); |