diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-02 13:47:39 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-02 13:47:39 +0000 |
commit | 49b0bf4c38f7b2ecdb25b138abc8aa5ff06267c4 (patch) | |
tree | 012dfcf4fcdc04870b829483c6d7913cfff9ef32 /src/main.c | |
parent | b819cd1defe15f492cd313129832383bf37ca82b (diff) |
DirAx stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@139 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 25 insertions, 5 deletions
@@ -33,12 +33,13 @@ #include "mapping.h" #include "prealign.h" #include "control.h" +#include "dirax.h" void main_do_reconstruction(ControlContext *ctx) { int val = 0; - if ( ctx->inputfiletype != INPUT_CACHE ) { + if ( (ctx->inputfiletype != INPUT_CACHE) && (ctx->inputfiletype != INPUT_DRX) ) { prealign_sum_stack(ctx); mapping_create(ctx); } @@ -64,7 +65,7 @@ static gint main_method_window_response(GtkWidget *method_window, gint response, if ( response == GTK_RESPONSE_OK ) { - int val = -1; + int val = 0; switch ( gtk_combo_box_get_active(GTK_COMBO_BOX(ctx->combo_algorithm)) ) { case 0 : ctx->rmode = RECONSTRUCTION_MAPPING; break; @@ -103,7 +104,10 @@ static gint main_method_window_response(GtkWidget *method_window, gint response, val = mrc_read(ctx); } else if ( ctx->inputfiletype == INPUT_CACHE ) { ctx->reflectionlist = cache_load(ctx->filename); - val=0; + if ( !ctx->reflectionlist ) val = 1; + } else if ( ctx->inputfiletype == INPUT_DRX ) { + ctx->reflectionlist = dirax_load(ctx->filename); + if ( !ctx->reflectionlist ) val = 1; } if ( val ) { @@ -174,7 +178,12 @@ void main_method_dialog_open(ControlContext *ctx) { gtk_table_attach_defaults(GTK_TABLE(table), ctx->checkbox_savecache, 1, 3, 4, 5); if ( ctx->inputfiletype == INPUT_CACHE ) { - gtk_combo_box_append_text(GTK_COMBO_BOX(ctx->combo_peaksearch), "Get from cache file"); + gtk_combo_box_append_text(GTK_COMBO_BOX(ctx->combo_peaksearch), "3D coordinates from cache file"); + gtk_widget_set_sensitive(GTK_WIDGET(ctx->combo_peaksearch), FALSE); + gtk_combo_box_set_active(GTK_COMBO_BOX(ctx->combo_peaksearch), 5); + } + if ( ctx->inputfiletype == INPUT_DRX ) { + gtk_combo_box_append_text(GTK_COMBO_BOX(ctx->combo_peaksearch), "3D coordinates from DirAx file"); gtk_widget_set_sensitive(GTK_WIDGET(ctx->combo_peaksearch), FALSE); gtk_combo_box_set_active(GTK_COMBO_BOX(ctx->combo_peaksearch), 5); } @@ -194,6 +203,7 @@ int main(int argc, char *argv[]) { ControlContext *ctx; InputFileType type; struct stat stat_buffer; + FILE *fh; gtk_init(&argc, &argv); @@ -212,10 +222,17 @@ int main(int argc, char *argv[]) { return 1; } - filename = basename(argv[1]); + filename = argv[1]; ctx = control_ctx_new(); type = INPUT_NONE; + fh = fopen(filename, "r"); + if ( !fh ) { + printf("Couldn't open file '%s'\n", filename); + return 1; + } + fclose(fh); + if ( qdrp_is_qdrprc(filename) ) { printf("QDRP input file detected.\n"); ctx->inputfiletype = INPUT_QDRP; @@ -225,6 +242,9 @@ int main(int argc, char *argv[]) { } else if ( cache_is_cachefile(filename) ) { printf("Cached reflection file detected.\n"); ctx->inputfiletype = INPUT_CACHE; + } else if ( dirax_is_drxfile(filename) ) { + printf("Dirax input file detected.\n"); + ctx->inputfiletype = INPUT_DRX; } else { fprintf(stderr, "Unrecognised input file type\n"); return 1; |