Commit 383d7710 authored by Thomas White's avatar Thomas White
Browse files

Add options to specify boost and binning on the command line

parent f1fa3630
......@@ -29,9 +29,6 @@
#include "utils.h"
#define INITIAL_BINNING 2
static void displaywindow_error(DisplayWindow *dw, const char *message)
{
GtkWidget *window;
......@@ -929,7 +926,8 @@ static gint displaywindow_press(GtkWidget *widget, GdkEventButton *event,
}
DisplayWindow *displaywindow_open(const char *filename, const char *peaks)
DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
int boost, int binning)
{
DisplayWindow *dw;
char *title;
......@@ -991,7 +989,8 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks)
gtk_window_set_resizable(GTK_WINDOW(dw->window), FALSE);
gtk_widget_show_all(dw->window);
dw->binning = INITIAL_BINNING;
dw->binning = binning;
dw->boostint = boost;
displaywindow_update(dw);
/* Peak list provided at startup? */
......
......@@ -67,7 +67,8 @@ typedef struct {
/* Open an image display window showing the given filename, or NULL */
extern DisplayWindow *displaywindow_open(const char *filename,
const char *peaks);
const char *peaks, int boost,
int binning);
#endif /* DISPLAYWINDOW_H */
......@@ -36,6 +36,8 @@ static void show_help(const char *s)
" -h, --help Display this help message.\n"
"\n"
" -p, --peak-overlay=<filename> Draw circles in positions listed in file.\n"
" -i, --int-boost=<n> Multiple intensity by <n>.\n"
" -b, --binning=<n> Set display binning to <n>.\n"
"\n");
}
......@@ -72,11 +74,15 @@ int main(int argc, char *argv[])
size_t i;
int nfiles;
char *peaks = NULL;
int boost = 1;
int binning = 2;
/* Long options */
const struct option longopts[] = {
{"help", 0, NULL, 'h'},
{"peak-overlay", 1, NULL, 'p'},
{"int-boost", 1, NULL, 'i'},
{"binning", 1, NULL, 'b'},
{0, 0, NULL, 0}
};
......@@ -84,7 +90,7 @@ int main(int argc, char *argv[])
gtk_init(&argc, &argv);
/* Short options */
while ((c = getopt_long(argc, argv, "hp:", longopts, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "hp:b:i:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
......@@ -97,6 +103,23 @@ int main(int argc, char *argv[])
break;
}
case 'i' : {
boost = atoi(optarg);
if ( boost < 1 ) {
ERROR("Intensity boost must be a positive"
" integer.\n");
}
break;
}
case 'b' : {
binning = atoi(optarg);
if ( boost < 1 ) {
ERROR("Binning must be a positive integer.\n");
}
break;
}
case 0 : {
break;
}
......@@ -116,7 +139,8 @@ int main(int argc, char *argv[])
}
for ( i=0; i<nfiles; i++ ) {
main_window_list[i] = displaywindow_open(argv[optind+i], peaks);
main_window_list[i] = displaywindow_open(argv[optind+i], peaks,
boost, binning);
if ( main_window_list[i] == NULL ) {
ERROR("Couldn't open display window\n");
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment