changeset 2460:c9ae5b32fed6

* added -clobber option to xfmconcat and readied for 2.0.16 release
author rotor <rotor>
date Thu, 04 Sep 2008 03:20:16 +0000
parents e649e7a9f1e4
children dea23be6fae5
files ChangeLog NEWS progs/xfm/xfmconcat.c progs/xfm/xfmconcat.man1 progs/xfm/xfminvert.man1
diffstat 5 files changed, 98 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-04  Andrew L Janke <a.janke@gmail.com>
+	* progs/xfm/xfmconcat.c: Added -verbose and -clobber options
+	* progs/xfm/xfmconcat.man1: added -verbose and -clobber
+	* progs/xfm/xfminvert.man1: added -verbose and -clobber
+
 2008-08-13  Andrew L Janke <a.janke@gmail.com>
 	* progs/rawtominc/rawtominc.c: changed to an enum for modalities
 	   to get around an esoteric bug with use of ParseArgv and strings
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,13 @@
 
-		New in Release 2.0.15
-        ---------------------
+New in Release 2.0.16
+---------------------
+* new option to mincpik (-anot_bar) and two bugfixed for lookup triplanars
+* updates to dcm2mnc for 64bit machines thanks to Claude
+* bug fixes for rawtominc for 64bit
+* added -clobber option to xfmconcat
+
+New in Release 2.0.15
+---------------------
 * MINC2 is now built by default (or disabled with --diable-minc2).
 * Began to aggregate and update all docs for a clean(er) 2.1 release
 * Added cubic interpoation in mincresample for x-y slices
@@ -20,34 +27,34 @@
 * changed --enable-minc2 to --disable-minc2 in configure.ac
    (come what may....)
 
-		New in Release 2.0.14
-        ---------------------
+New in Release 2.0.14
+---------------------
 * Added files needed for a CMake build of MINC
 * Fixed a linking problem with nii2mnc mnc2nii
 
-		New in Release 2.0.13
-        ---------------------
+New in Release 2.0.13
+---------------------
 * Fixed a few small build errors for make check
 * Changes to ensure there is a clean ITK minc build
 * added xfmflip 
 * Fixed buffering and chunking for fast internal file compression
 * updated nii2mnc and mnc2nii with the latest version of niftilib
 
-		New in Release 2.0.12
-        ---------------------
+New in Release 2.0.12
+---------------------
 * Fixed a bug causing dump_acr_nema to skip all elements 
 with element number 0x0010.
 
-		New in Release 2.0.11
-        ---------------------
+New in Release 2.0.11
+---------------------
 * Many small fixes
 * fix to mincresample
 * Small fix to mincconvert
 * -like flag added to rawtominc
 * Added additional tests for minc2 files.
 
-                New in Release 2.0.10
-                ---------------------
+New in Release 2.0.10
+---------------------
 * Many small fixes to dcm2mnc
 * Fix mincgen HDF5 support
 * Fix upet2mnc handling of single-frame files
@@ -56,8 +63,8 @@
   scaled_maximal_pivoting_gaussian_elimination in
   volume_io/Geometry/gaussian.c and libsrc.2.
 
-                New in Release 2.0.09
-                ---------------------
+New in Release 2.0.09
+---------------------
 This release is primarily a bug fix release for the core MINC libraries,
 as well as an opportunity to port library changes from the 1.X series.
 One of the most important changes involves support for HDF5 versions
@@ -87,8 +94,8 @@
   problem with the  "make check" self-test code when using HDF5 1.6.3,
   but this problem should not affect normal operation of the code.
 
-                New in Release 2.0.08
-                ---------------------
+New in Release 2.0.08
+---------------------
 Several major changes are incorporated into this release.
 
 First, the "simplified" MINC interface is now included in the
@@ -124,8 +131,8 @@
 * Many bug fixes
 * See WHATSNEW-2.0 for additional details
 
-                New in Release 2.0.07
-                ---------------------
+New in Release 2.0.07
+---------------------
 * Added automatic creation of "ident" attribute in all MINC files.
 * Added -sappend and -dappend arguments to minc_modify_header
 * Most man pages updated
@@ -133,13 +140,13 @@
   MINC 2.0 format
 * Changed volume_io caching defaults
 
-                New in Release 2.0.06
-                ---------------------
+New in Release 2.0.06
+---------------------
 * No functional changes - this release is intended only to address compilation
   issues found with the SGI IRIX MIPSpro compiler.
 
-                New in Release 2.0.05
-                ---------------------
+New in Release 2.0.05
+---------------------
 This version represents several weeks of effort cleaning up the
 existing code and trying to put things into better shape for a
 release.  In particular, the existing test suites ("make check") now
@@ -173,28 +180,28 @@
 * "mincdump" added to the distribution.
 * Almost all MINC 2.0 specific changes are now surrounded by "#ifdef MINC2"
 
-                New in Release 2.0.04
-                ---------------------
+New in Release 2.0.04
+---------------------
 * More bugs fixed
 * mincconvert now takes a -compress and -chunk option to force the output
 file to take on a desired structure.
 * User's guide to MINC 2.0 library is now in doc/minc2_uguide.tex.  It's a
 work in progress but it should contain some useful information.
 
-                New in Release 2.0.03
-                ---------------------
+New in Release 2.0.03
+---------------------
 * Actually implemented MINC_COMPRESS
 
 * Many bugs fixed
 
-                New in Release 2.0.02
-                ---------------------
+New in Release 2.0.02
+---------------------
 * Several bug fixes
 
 * Even newer error handling
 
-                New in Release 2.0.01
-                ------------------
+New in Release 2.0.01
+---------------------
 * Support for HDF5 "MINC 2.0" format files.
 
 * Revised error message handling.  Some new, unwanted messages are probably 
@@ -204,32 +211,23 @@
 
 * New programming interface.
 
-	        New in Release 1.3
-        	------------------
-
+New in Release 1.3
+------------------
 * Build fixes.
 
 
-	        New in Release 1.2
-        	------------------
-
+New in Release 1.2
+------------------
 * New tools: mincpik, minchistory.
-
 * Rawtominc has new options -dimorder and -swap_bytes.
-
 * Ability to easily create binary packages; see README.binary_packaging.
 
-
-		New in Release 1.1
-		------------------
-
+New in Release 1.1
+------------------
 * All MINC programs now ship with a man page.
-
 * Rawtominc has new "-skip" option, to allow skipping header information.
-
 * Mincstats option "-max_bins" renamed to "-int_max_bins", to avoid clash
   with "-max".
-
 * Minccalc has new functions: tan, asin, acos, and atan.
 
 
--- a/progs/xfm/xfmconcat.c
+++ b/progs/xfm/xfmconcat.c
@@ -10,7 +10,10 @@
 @CREATED    : August 13, 1993 (Peter Neelin)
 @MODIFIED   : 
  * $Log: xfmconcat.c,v $
- * Revision 6.6  2008-01-23 22:54:35  rotor
+ * Revision 6.7  2008-09-04 03:20:16  rotor
+ *  * added -clobber option to xfmconcat and readied for 2.0.16 release
+ *
+ * Revision 6.6  2008/01/23 22:54:35  rotor
  *  * added Claude to AUTHORS
  *  * added a patch for history to xfmconcat from Mishkin Derakhshan
  *
@@ -74,9 +77,11 @@
               express or implied warranty.
 ---------------------------------------------------------------------------- */
 
+#include <config.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <volume_io.h>
 #include <ParseArgv.h>
  #include <time_stamp.h>
@@ -87,28 +92,43 @@
 #  define FALSE 0
 #endif
 
+/* Argument variables */
+int clobber = FALSE;
+int verbose = FALSE;
+
 /* Argument table */
 ArgvInfo argTable[] = {
+   {"-clobber", ARGV_CONSTANT, (char *) TRUE, (char *) &clobber,
+       "Overwrite existing file."},
+   {"-noclobber", ARGV_CONSTANT, (char *) FALSE, (char *) &clobber,
+       "Don't overwrite existing file (default)."},
+   {"-verbose", ARGV_CONSTANT, (char *) TRUE, (char *) &verbose,
+       "Print out extra information."},
+   
+   {NULL, ARGV_HELP, NULL, NULL, ""},
    {NULL, ARGV_END, NULL, NULL, NULL}
 };
 
 /* Main program */
-
-int main(int argc, char *argv[])
-{
+int main(int argc, char *argv[]){
    General_transform trans1, trans2, trans3;
    General_transform *new_result, *old_result, *input, *temp_result;
-   int iarg, first_arg, last_arg, output_arg;
+   int iarg, first_arg, last_arg;
+   char *outfile;
    char *arg_string;
+   char *pname;
    
    /* collect the command line for history */
    arg_string = time_stamp(argc, argv);
    
    /* Check arguments */
+   pname = argv[0];
    if (ParseArgv(&argc, argv, argTable, 0) || argc < 3) {
       (void) fprintf(stderr, 
                 "Usage: %s <input1.xfm> [<input2.xfm> ...] <result.xfm>\n",
-                     argv[0]);
+                     pname);
+      (void) fprintf(stderr, 
+        "       %s -help\n\n", pname);
       exit(EXIT_FAILURE);
    }
 
@@ -118,16 +138,21 @@
    input = &trans3;
    first_arg = 1;
    last_arg = argc-2;
-   output_arg = argc-1;
+   outfile = argv[argc-1];
 
+   /* check for the outfile */
+   if(access(outfile, F_OK) == 0 && !clobber){
+      fprintf(stderr, "%s: %s exists! (use -clobber to overwrite)\n\n", pname, outfile);
+      exit(EXIT_FAILURE);
+   }
+   
    /* Loop through arguments */
-
    for (iarg=first_arg; iarg <= last_arg; iarg++) {
 
       /* Read in file to concatenate */
       if (input_transform_file(argv[iarg], input) != OK) {
          (void) fprintf(stderr, "%s: Error reading transform file %s\n",
-                        argv[0], argv[iarg]);
+                        pname, argv[iarg]);
          exit(EXIT_FAILURE);
       }
 
@@ -147,9 +172,9 @@
    }     /* End of loop through arguments */
 
    /* Write out the transform */
-   if (output_transform_file(argv[output_arg], arg_string, new_result) != OK) {
+   if (output_transform_file(outfile, arg_string, new_result) != OK) {
       (void) fprintf(stderr, "%s: Error writing transform file %s\n",
-                     argv[0], argv[output_arg]);
+                     pname, outfile);
       exit(EXIT_FAILURE);
    }
 
--- a/progs/xfm/xfmconcat.man1
+++ b/progs/xfm/xfmconcat.man1
@@ -1,5 +1,5 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
-.TH XFMCONCAT 1 "$Date: 2004-05-20 21:52:09 $" "" "MINC User's Guide"
+.TH XFMCONCAT 1 "$Date: 2008-09-04 03:20:16 $" "" "MINC User's Guide"
 .SH NAME
 xfmconcat \- concatenate MNI transform files
 
@@ -18,6 +18,12 @@
 \fB\-help\fR
 Print summary of command-line options and exit.
 .TP
+\fB\-clobber\fR
+Overwrite an existing file.
+.TP
+\fB\-verbose\fR
+Print out progress information.
+.TP
 \fB\-version\fR
 Print the program's version number and exit.
 
--- a/progs/xfm/xfminvert.man1
+++ b/progs/xfm/xfminvert.man1
@@ -1,5 +1,5 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
-.TH XFMINVERT 1 "$Date: 2004-05-20 21:52:09 $" "" "MINC User's Guide"
+.TH XFMINVERT 1 "$Date: 2008-09-04 03:20:16 $" "" "MINC User's Guide"
 .SH NAME
 xfminvert \- invert an MNI transform file
 
@@ -15,6 +15,12 @@
 \fB\-help\fR
 Print summary of command-line options and exit.
 .TP
+\fB\-clobber\fR
+Overwrite an existing file.
+.TP
+\fB\-verbose\fR
+Print out progress information.
+.TP
 \fB\-version\fR
 Print the program's version number and exit.