diff --git a/avwmerge++.cc b/avwmerge++.cc index 066680f0cc71a08767cd6a4c3d155cb07f9f8682..9c45a50ed46feee147195e8d1bca91bf8db02630 100755 --- a/avwmerge++.cc +++ b/avwmerge++.cc @@ -11,7 +11,7 @@ using namespace NEWIMAGE; void print_usage(const string& progname) { cout << endl; - cout << "Usage: avwmerge <-x/y/z/t> <output> <file1 file2 .......>" << endl; + cout << "Usage: avwmerge <-x/y/z/t/a> <output> <file1 file2 .......>" << endl; cout << " -t : concatenate images in time" << endl; cout << " -x : concatenate images in the x direction" << endl; cout << " -y : concatenate images in the y direction" << endl; diff --git a/fslsplit.cc b/fslsplit.cc index de2c7ff24486b7265cc3d88267a92b7e31e5c1a8..6e552415d14dfbea4b403ebf954c00ae6985ffd8 100755 --- a/fslsplit.cc +++ b/fslsplit.cc @@ -13,26 +13,41 @@ using namespace MISCMATHS; void print_usage(const string& progname) { cout << endl; - cout << "Usage: avwsplit <inputfile.hdr>" << endl; - cout << " avwsplit <inputfile.hdr> [basename]" << endl; + cout << "Usage: avwsplit++ <inputfile.hdr>" << endl; + cout << " avwsplit++ <inputfile.hdr> [basename] [-t/x/y/z]" << endl; + cout << " -t : concatenate images in time (default behaviour)" << endl; + cout << " -x : concatenate images in the x direction" << endl; + cout << " -y : concatenate images in the y direction" << endl; + cout << " -z : concatenate images in the z direction" << endl; } template <class T> int fmrib_main(int argc, char *argv[]) { - volume4D<T> input_volume; + volume4D<T> input_vol; volumeinfo vinfo; - volume<T> output_volume; + volume4D<T> output_vol; string input_name=string(argv[1]); string output_name="vol"; - read_volume4D(input_volume,input_name,vinfo); - int t; - if (argc==3) output_name=string(argv[2]); - for(t=0;t<=input_volume.maxt();t++) + int xoff=1,yoff=1,zoff=1,toff=1,nsize; + read_volume4D(input_vol,input_name,vinfo); + if ((argc>2) && (argv[2][0]!='-')) output_name=string(argv[2]); + if (argv[argc-1][0] == '-') + { + if (argv[argc-1][1] == 't') toff=input_vol.tsize(); + if (argv[argc-1][1] == 'z') zoff=input_vol.zsize(); + if (argv[argc-1][1] == 'y') yoff=input_vol.ysize(); + if (argv[argc-1][1] == 'x') xoff=input_vol.xsize(); + } + else toff=input_vol.tsize(); + nsize=xoff*yoff*zoff*toff; + for(int j=0;j<nsize;j++) { - output_volume=input_volume[t]; - save_volume(output_volume,(output_name+num2str(t,4)),vinfo); + input_vol.setROIlimits(0+j*(xoff!=1),0+j*(yoff!=1),0+j*(zoff!=1),0+j*(toff!=1),input_vol.xsize()-1-(nsize-j-1)*(xoff!=1),input_vol.ysize()-1-(nsize-j-1)*(yoff!=1),input_vol.zsize()-1-(nsize-j-1)*(zoff!=1),input_vol.tsize()-1-(nsize-j-1)*(toff!=1)); + input_vol.activateROI(); + output_vol=input_vol.ROI(); + save_volume4D(output_vol,(output_name+num2str(j,4)),vinfo); } return 0; } @@ -44,7 +59,7 @@ int main(int argc,char *argv[]) Tracer tr("main"); string progname=argv[0]; - if (argc != 3 && argc != 2) + if (argc <= 1 && argc >= 5) { print_usage(progname); return 1;