From 72b949c4ec28e76dea966d88eae549fad6548143 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 19 Sep 2013 11:29:28 +0200 Subject: hdfsee: Use beam parameters file (--beam option) --- src/dw-hdfsee.c | 11 ++++++++++- src/dw-hdfsee.h | 3 ++- src/hdfsee.c | 11 +++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index ddfa831a..3b361207 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -1813,6 +1813,7 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks, double boost, int binning, int noisefilter, int colscale, const char *element, const char *geometry, + const char *beam, int show_rings, double *ring_radii, int n_rings, double ring_size, int median_filter) @@ -1846,6 +1847,15 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks, dw->ring_radii = ring_radii; dw->n_rings = n_rings; dw->median_filter = median_filter; + dw->image = calloc(1, sizeof(struct image)); + + if ( beam != NULL ) { + dw->image->beam = get_beam_parameters(beam); + } + + if ( (dw->image->beam != NULL) && (dw->hdfile != NULL) ) { + fill_in_beam_parameters(dw->image->beam, dw->hdfile); + } /* Open the file, if any */ if ( filename != NULL ) { @@ -1864,7 +1874,6 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks, } if ( !fail ) { - dw->image = calloc(1, sizeof(struct image)); dw->image->filename = strdup(filename); hdf5_read(dw->hdfile, dw->image, 0); } else { diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h index 3e908947..92ca9d42 100644 --- a/src/dw-hdfsee.h +++ b/src/dw-hdfsee.h @@ -121,7 +121,8 @@ extern DisplayWindow *displaywindow_open(const char *filename, int binning, int noisefilter, int colscale, const char *element, - const char *geometry, int show_rings, + const char *geometry, const char *beam, + int show_rings, double *ring_radii, int n_rings, double ring_size, int median_filter); diff --git a/src/hdfsee.c b/src/hdfsee.c index 24d6d9cc..6b4d0bf0 100644 --- a/src/hdfsee.c +++ b/src/hdfsee.c @@ -74,6 +74,7 @@ static void show_help(const char *s) " -e, --image= Start up displaying this image from the\n" " HDF5 file. Example: /data/data0.\n" " -g, --geometry= Use geometry from file for display.\n" +" -m, --beam= Get beam parameters from .\n" "\n"); } @@ -118,6 +119,7 @@ int main(int argc, char *argv[]) char *cscale = NULL; char *element = NULL; char *geometry = NULL; + char *beam = NULL; double ring_size = 5.0; char *reslist = NULL; double ring_radii[128]; @@ -134,6 +136,7 @@ int main(int argc, char *argv[]) {"colscale", 1, NULL, 'c'}, {"image", 1, NULL, 'e'}, {"geometry", 1, NULL, 'g'}, + {"beam", 1, NULL, 'm'}, {"show-rings", 0, &config_showrings, 1}, {"ring-size", 1, NULL, 2}, {"simple-rings", 1, NULL, 'r'}, @@ -144,7 +147,7 @@ int main(int argc, char *argv[]) gtk_init(&argc, &argv); /* Short options */ - while ((c = getopt_long(argc, argv, "hp:b:i:c:e:g:2:r:", + while ((c = getopt_long(argc, argv, "hp:b:i:c:e:g:2:r:m:", longopts, NULL)) != -1) { char *test; @@ -188,6 +191,10 @@ int main(int argc, char *argv[]) geometry = strdup(optarg); break; + case 'm' : + beam = strdup(optarg); + break; + case 2 : ring_size = strtod(optarg, &test); if ( test == optarg ) { @@ -263,7 +270,7 @@ int main(int argc, char *argv[]) boost, binning, config_noisefilter, colscale, element, - geometry, + geometry, beam, config_showrings, ring_radii, n_rings, -- cgit v1.2.3