diff --git a/fslnvols.cc b/fslnvols.cc index 78b3ad5d1c103971cab5050962d6f3c875264813..2557dcba18e94bdd1fe11315769e29fe94def26e 100755 --- a/fslnvols.cc +++ b/fslnvols.cc @@ -4,7 +4,6 @@ // CCOPYRIGHT #include "newimage/newimageall.h" -#include "newimage/fmribmain.h" using namespace NEWIMAGE; @@ -14,19 +13,6 @@ void print_usage(const string& progname) cout << "Usage: fslnvols <input>" << endl; } - -template <class T> -int fmrib_main(int argc, char *argv[]) -{ - - NiftiIO reader; - NiftiHeader header(reader.loadHeader(string(argv[1]))); - cout << header.dim[4] << endl; - return 0; -} - - - int main(int argc,char *argv[]) { string progname=argv[0]; @@ -35,15 +21,14 @@ int main(int argc,char *argv[]) print_usage(progname); return 1; } - if (!FslFileExists(argv[1])) + if (!FslFileExists(string(argv[1]))) { cout << "0" << endl; return 0; // the intended usage is to return "0" and not show an error } - else - { - string iname=string(argv[1]); - return call_fmrib_main(dtype(iname),argc,argv); - } + NiftiIO reader; + NiftiHeader header(reader.loadHeader(return_validimagefilename(string(argv[1])))); + cout << header.dim[4] << endl; + return 0; } diff --git a/fslorient.cc b/fslorient.cc index 591855158965f02245c94b1fd9e24be8f6facdac..192c39a13ed93c037d818619a359235e98b84150 100644 --- a/fslorient.cc +++ b/fslorient.cc @@ -94,9 +94,9 @@ int fmrib_main(int argc,char *argv[]) { bool modified(false); string option(argv[1]), filename(argv[argc-1]); - volume4D<T> invol; + volume<T> invol; - read_orig_volume4D(invol,filename); + read_orig_volume(invol,filename); if ( argc==2 || option=="-getorient") { getorient(invol); @@ -167,10 +167,9 @@ int fmrib_main(int argc,char *argv[]) if (modified) { - if ( FslBaseFileType(fslFileType(filename)) != FSL_TYPE_ANALYZE ) { - FslSetOverrideOutputType(fslFileType(filename)); - save_orig_volume4D(invol,filename); - FslSetOverrideOutputType(-1); // restore to default + int filetype( fslFileType(filename) ); + if ( filetype != FSL_TYPE_ANALYZE ) { + save_orig_volume(invol,filename,filetype); } else { cerr << "Cannot modify orientation for Analyze files" << endl; cerr << " All Analyze files are treated as radiological" << endl; diff --git a/fslroi.cc b/fslroi.cc index 90dc85358ac588922c5340a6008f18b132e84f75..3becf221c2b83c9b0cd1b7586ed86e1af23140ce 100755 --- a/fslroi.cc +++ b/fslroi.cc @@ -7,6 +7,8 @@ #include "newimage/fmribmain.h" using namespace NEWIMAGE; +using namespace MISCMATHS; + void print_usage(const string& progname) { cout << endl; @@ -21,9 +23,7 @@ template <class T> int fmrib_main(int argc, char *argv[]) { volume4D<T> input_vol,output_vol; - string input_name(string(argv[1])); - string output_name(string(argv[2])); - read_volume4D(input_vol, string(argv[1]) ); + read_volume4D(input_vol,string(argv[1])); int minx(-1),miny(-1),minz(-1),mint(-1),maxx(-1),maxy(-1),maxz(-1),maxt(-1),argindex(3); //Note there is currently no explicit bounds testing e.g. if maxx>inputvol.maxx() etc @@ -99,16 +99,13 @@ int fmrib_main(int argc, char *argv[]) if (minx>maxx) { int tmpx=maxx; maxx=minx; minx=tmpx; } if (miny>maxy) { int tmpy=maxy; maxy=miny; miny=tmpy; } if (minz>maxz) { int tmpz=maxz; maxz=minz; minz=tmpz; } - save_volume4D(input_vol.ROI(minx,miny,minz,mint,maxx,maxy,maxz,maxt),"foo2"); + save_volume4D(input_vol.ROI(minx,miny,minz,mint,maxx,maxy,maxz,maxt),string(argv[2])); return 0; } int main(int argc,char *argv[]) { - - Tracer tr("main"); - try { string progname=argv[0]; if (argc !=5 && argc !=9 && argc !=11)