From 241a116d6f070c8fba1a2a4245952bf2fe402e79 Mon Sep 17 00:00:00 2001
From: Matthew Webster <mwebster@fmrib.ox.ac.uk>
Date: Fri, 19 Oct 2018 15:36:27 +0000
Subject: [PATCH] removed old 0,0,0 behaviour as nonsensical

---
 fslcreatehd.cc | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fslcreatehd.cc b/fslcreatehd.cc
index ef4f97b..332ad6f 100755
--- a/fslcreatehd.cc
+++ b/fslcreatehd.cc
@@ -1,6 +1,6 @@
 //     fslcreatehd.cc - Copy certain parts of an AVW header
 //     Mark Jenkinson, Steve Smith and Matthew Webster, FMRIB Image Analysis Group
-//     Copyright (C) 2001-2005 University of Oxford
+//     Copyright (C) 2001-2018 University of Oxford
 //     CCOPYRIGHT
 
 #include "newimage/newimageall.h"
@@ -15,9 +15,9 @@ void print_usage(const string& progname)
   cout << "Usage: fslcreatehd <xsize> <ysize> <zsize> <tsize> <xvoxsize> <yvoxsize> <zvoxsize> <tr> <xorigin> <yorigin> <zorigin> <datatype> <headername>" << endl;
   cout << "       fslcreatehd <nifti_xml_file> <headername>" << endl;
   cout << "  Datatype values: " << DT_UNSIGNED_CHAR << "=char, " << DT_SIGNED_SHORT  << "=short, " <<  DT_SIGNED_INT <<"=int, " << DT_FLOAT << "=float, " <<  DT_DOUBLE<< "=double" << endl;
-  cout << "  In the first form, a radiological image will be created, the origin being given as voxel co-ordindates," << endl;
-  cout << "  if the output file already exists, its data ( but not geometric information ) will be copied if it has" << endl;
-  cout << "  a matching number of elements."
+  cout << "  In the first form, a radiological image will be created, with the origin input as a voxel co-ordinate." << endl;
+  cout << "  If the output file already exists, its data ( but not geometric information ) will be copied if it has" << endl;
+  cout << "  a matching number of elements." << endl;
   cout << "  In the second form, an XML-ish form of nifti header is read (as output by fslhd -x)" << endl;
   cout << "  Note that stdin is used if '-' is used in place of a filename" << endl;
 
@@ -57,16 +57,16 @@ int fslcreatehd_main(int argc, char *argv[])
       header.dim[i]=atoi(argv[i]);
     for (int i=1;i<=4;i++)
       header.pixdim[i]=atof(argv[i+4]);
-
-
-    if ( atoi(argv[9]) != 0 || atoi(argv[10]) != 0 || atoi(argv[11]) != 0 ) {
+      header.sformCode=2;
       header.sX[0]=-header.pixdim[1];
       header.sY[1]=header.pixdim[2];
       header.sZ[2]=header.pixdim[3];
-      header.sX[3]=-header.pixdim[1]*(header.dim[1]-1.0-atoi(argv[9]));
+      header.sX[3]=header.pixdim[1]*(header.dim[1]-1.0-atoi(argv[9]));
       header.sY[3]=-header.pixdim[2]*atoi(argv[10]);
       header.sZ[3]=-header.pixdim[3]*atoi(argv[11]);
-    }
+      header.qformCode=2;
+      header.setQForm(header.getSForm());
+
   } else {
       /* read XML form */
       char *newstr, *oldfname, *oldiname;
-- 
GitLab