diff --git a/fslcreatehd.cc b/fslcreatehd.cc index ef4f97be4912f0ac6f9ec24e1b294fc8a5ae39d7..332ad6f7828b6f2afc3c886201387fc23ffde33a 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;