Skip to content
Snippets Groups Projects
Commit 28a0f681 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

STY: whitespace

parent 0377be56
No related branches found
No related tags found
1 merge request!1Mnt/conda
/* slicetimer.cc - FMRIB's Slice Timing Utility /* slicetimer.cc - FMRIB's Slice Timing Utility
Peter Bannister, Stephen Smith and Matthew Webster, FMRIB Image Analysis Group Peter Bannister, Stephen Smith and Matthew Webster, FMRIB Image Analysis Group
Copyright (C) 2001-2009 University of Oxford */ Copyright (C) 2001-2009 University of Oxford */
/* CCOPYRIGHT */ /* CCOPYRIGHT */
...@@ -34,14 +34,14 @@ string examples="slicetimer -i <timeseries> [-o <corrected_timeseries>] [options ...@@ -34,14 +34,14 @@ string examples="slicetimer -i <timeseries> [-o <corrected_timeseries>] [options
Option<bool> help(string("-h,--help"), false, Option<bool> help(string("-h,--help"), false,
string("display this message"), string("display this message"),
false, no_argument); false, no_argument);
Option<bool> verbose(string("-v,--verbose"), false, Option<bool> verbose(string("-v,--verbose"), false,
string("switch on diagnostic messages"), string("switch on diagnostic messages"),
false, no_argument); false, no_argument);
Option<bool> odd(string("--odd"), false, Option<bool> odd(string("--odd"), false,
string("use interleaved acquisition"), string("use interleaved acquisition"),
false, no_argument); false, no_argument);
Option<bool> down(string("--down"), false, Option<bool> down(string("--down"), false,
string("reverse slice indexing (default is: slices were acquired bottom-up)"), string("reverse slice indexing (default is: slices were acquired bottom-up)"),
false, no_argument); false, no_argument);
Option<string> inputname(string("-i,--in"), string(""), Option<string> inputname(string("-i,--in"), string(""),
string("filename of input timeseries"), string("filename of input timeseries"),
...@@ -69,7 +69,7 @@ int do_slice_correction() ...@@ -69,7 +69,7 @@ int do_slice_correction()
{ {
volume4D<float> timeseries; volume4D<float> timeseries;
Matrix timings; Matrix timings;
int no_volumes, no_slices; int no_volumes, no_slices;
float repeat_time, offset=0, slice_spacing; float repeat_time, offset=0, slice_spacing;
...@@ -79,7 +79,7 @@ int do_slice_correction() ...@@ -79,7 +79,7 @@ int do_slice_correction()
if (!outputname.set()) if (!outputname.set())
outputname.set_value(inputname.value() + "_st"); outputname.set_value(inputname.value() + "_st");
} else if (outputname.set()) { } else if (outputname.set()) {
cerr << "Must specify an input volume (-i or --in) to generate corrected data." cerr << "Must specify an input volume (-i or --in) to generate corrected data."
<< endl; << endl;
return -1; return -1;
} }
...@@ -108,20 +108,20 @@ int do_slice_correction() ...@@ -108,20 +108,20 @@ int do_slice_correction()
// for(int i=1; i<=1201; i++) cout << i << " " << userkernel(i) << endl; // for(int i=1; i<=1201; i++) cout << i << " " << userkernel(i) << endl;
float recenter = (((float) no_slices)/2 - 0.5)/ no_slices; // only valid for slice-count-based corrections float recenter = (((float) no_slices)/2 - 0.5)/ no_slices; // only valid for slice-count-based corrections
for (int slice=1; slice<=no_slices; slice++) { for (int slice=1; slice<=no_slices; slice++) {
if (tglobal.set()) { if (tglobal.set()) {
offset = tglobal.value(); offset = tglobal.value();
} else if (tcustom.set()) { } else if (tcustom.set()) {
offset = timings(slice, 1); offset = timings(slice, 1);
} else if (ocustom.set()) { } else if (ocustom.set()) {
int local_count=1; int local_count=1;
while (local_count <= no_slices) { while (local_count <= no_slices) {
if (timings(local_count, 1) == slice) { if (timings(local_count, 1) == slice) {
offset = recenter -(local_count -1)* (slice_spacing / repeat_time); offset = recenter -(local_count -1)* (slice_spacing / repeat_time);
local_count = no_slices + 1; local_count = no_slices + 1;
} else } else
local_count++; local_count++;
} }
} else if (odd.value()) { // acquisition order: 1,3,5, ..., 2,4,6 ... } else if (odd.value()) { // acquisition order: 1,3,5, ..., 2,4,6 ...
...@@ -131,7 +131,7 @@ int do_slice_correction() ...@@ -131,7 +131,7 @@ int do_slice_correction()
offset = recenter - ((slice -1) / 2) * (slice_spacing / repeat_time); offset = recenter - ((slice -1) / 2) * (slice_spacing / repeat_time);
} else if (down.value()) { } else if (down.value()) {
offset = recenter - (no_slices - slice) * (slice_spacing / repeat_time); offset = recenter - (no_slices - slice) * (slice_spacing / repeat_time);
} else { } else {
offset = recenter - (slice -1) * (slice_spacing / repeat_time); offset = recenter - (slice -1) * (slice_spacing / repeat_time);
} }
...@@ -145,11 +145,11 @@ int do_slice_correction() ...@@ -145,11 +145,11 @@ int do_slice_correction()
} }
timeseries.setvoxelts(interpseries,x_pos,y_pos,slice-1); timeseries.setvoxelts(interpseries,x_pos,y_pos,slice-1);
} }
if (verbose.value()) if (verbose.value())
cerr << "Slice " << slice << " offset " << offset << endl; cerr << "Slice " << slice << " offset " << offset << endl;
} }
if (direction.value() == 1) timeseries.swapdimensions(3,2,1); // reverse Flip z and x if (direction.value() == 1) timeseries.swapdimensions(3,2,1); // reverse Flip z and x
if (direction.value() == 2) timeseries.swapdimensions(1,3,2); // reverse Flip z and y if (direction.value() == 2) timeseries.swapdimensions(1,3,2); // reverse Flip z and y
...@@ -160,7 +160,7 @@ int do_slice_correction() ...@@ -160,7 +160,7 @@ int do_slice_correction()
int main (int argc,char** argv) int main (int argc,char** argv)
{ {
Tracer tr("main"); Tracer tr("main");
OptionParser options(title, examples); OptionParser options(title, examples);
try { try {
...@@ -183,30 +183,29 @@ int main (int argc,char** argv) ...@@ -183,30 +183,29 @@ int main (int argc,char** argv)
options.usage(); options.usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if ( inputname.unset()) if ( inputname.unset())
{ {
options.usage(); options.usage();
cerr << endl cerr << endl
<< "--in or -i MUST be used." << "--in or -i MUST be used."
<< endl; << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} catch(X_OptionError& e) { } catch(X_OptionError& e) {
options.usage(); options.usage();
cerr << endl << e.what() << endl; cerr << endl << e.what() << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} catch(std::exception &e) { } catch(std::exception &e) {
cerr << e.what() << endl; cerr << e.what() << endl;
} }
int retval = do_slice_correction(); int retval = do_slice_correction();
if (retval!=0) { if (retval!=0) {
cerr << endl << endl << "Error detected: try -h for help" << endl; cerr << endl << endl << "Error detected: try -h for help" << endl;
} }
return retval; return retval;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment