changeset 984:3fd07406192c

Added check for -transformation without -like, -tfm_input_sampling or -use_input_sampling because of change in behaviour.
author neelin <neelin>
date Tue, 30 Jan 1996 14:10:24 +0000
parents 2238ebd52d83
children 08607b633ae0
files progs/mincresample/mincresample.c
diffstat 1 files changed, 39 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/progs/mincresample/mincresample.c
+++ b/progs/mincresample/mincresample.c
@@ -10,9 +10,13 @@
 @CALLS      : 
 @CREATED    : February 8, 1993 (Peter Neelin)
 @MODIFIED   : $Log: mincresample.c,v $
-@MODIFIED   : Revision 3.3  1995-12-12 19:15:35  neelin
-@MODIFIED   : Added -spacetype, -talairach and -units options.
+@MODIFIED   : Revision 3.4  1996-01-30 14:10:24  neelin
+@MODIFIED   : Added check for -transformation without -like, -tfm_input_sampling or
+@MODIFIED   : -use_input_sampling because of change in behaviour.
 @MODIFIED   :
+ * Revision 3.3  1995/12/12  19:15:35  neelin
+ * Added -spacetype, -talairach and -units options.
+ *
  * Revision 3.2  1995/11/21  14:13:20  neelin
  * Transform input sampling with transformation and use this as default.
  * Added -tfm_input_sampling to specify above option.
@@ -98,7 +102,7 @@
 ---------------------------------------------------------------------------- */
 
 #ifndef lint
-static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/mincresample.c,v 3.3 1995-12-12 19:15:35 neelin Exp $";
+static char rcsid[]="$Header: /private-cvsroot/minc/progs/mincresample/mincresample.c,v 3.4 1996-01-30 14:10:24 neelin Exp $";
 #endif
 
 #include <stdlib.h>
@@ -115,6 +119,15 @@
 #include <convert_origin_to_start.h>
 #include "mincresample.h"
 
+/* Kludge to catch use of -transformation without -like and without 
+   -tfm_input_sampling or -use_input_sampling */
+#define TRANSFORM_CHANGE_KLUDGE
+#ifdef TRANSFORM_CHANGE_KLUDGE
+int Specified_like = FALSE;
+int Specified_transform = FALSE;
+#define SAMPLING_ACTION_NOT_SET (-1)
+#endif
+
 /* Main program */
 
 public int main(int argc, char *argv[])
@@ -160,7 +173,11 @@
                         General_transform *transformation)
 {
    /* Argument parsing information */
+#ifdef TRANSFORM_CHANGE_KLUDGE
+   static int transform_input_sampling = SAMPLING_ACTION_NOT_SET;
+#else
    static int transform_input_sampling = TRUE;
+#endif
    static Arg_Data args={
       FALSE,                  /* Clobber */
       NC_UNSPECIFIED,         /* Flag that type not set */
@@ -358,6 +375,17 @@
    infile = argv[1];
    outfile = argv[2];
 
+#ifdef TRANSFORM_CHANGE_KLUDGE
+   if (Specified_transform && 
+       !Specified_like &&
+       (transform_input_sampling == SAMPLING_ACTION_NOT_SET)) {
+      (void) fprintf(stderr, 
+                     "Use -like, -tfm_input_sampling or "
+                     "-use_input_sampling with -transformation\n");
+      exit(EXIT_FAILURE);
+   }
+#endif
+
    /* Check for an inverted transform. This looks backwards because we 
       normally invert the transform. */
    if (args.transform_info.invert_transform) {
@@ -1749,6 +1777,10 @@
    }
    (void) close_file(fp);
 
+#ifdef TRANSFORM_CHANGE_KLUDGE
+   Specified_transform = TRUE;
+#endif
+
    return TRUE;
 }
 
@@ -1790,6 +1822,10 @@
    /* Close the file */
    (void) miclose(file.mincid);
 
+#ifdef TRANSFORM_CHANGE_KLUDGE
+   Specified_like = TRUE;
+#endif
+
    return TRUE;
 }