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

Merge branch 'mnt/conda' into 'master'

Mnt/conda

See merge request !1
parents 43d2ba75 ab7658ee
No related branches found
No related tags found
1 merge request!1Mnt/conda
Pipeline #11776 passed
include $(FSLCONFDIR)/default.mk
PROJNAME = slicetimer
XFILES = slicetimer
LIBS = -lfsl-newimage -lfsl-miscmaths -lfsl-NewNifti \
-lfsl-znz -lfsl-cprob -lfsl-utils
USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB}
USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_ZLIB}
OBJS = slicetimer.o
LIBS = -lnewimage -lmiscmaths -lNewNifti -lznz -lnewmat -lprob -lm -lutils -lz
XFILES = slicetimer
all: ${XFILES}
slicetimer:${OBJS}
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}
all: ${XFILES}
slicetimer: slicetimer.o
${CXX} ${CXXFLAGS} -o $@ $^ ${LDFLAGS}
Initial creation of branchname log file
/* slicetimer.cc - FMRIB's Slice Timing Utility
Peter Bannister, Stephen Smith and Matthew Webster, FMRIB Image Analysis Group
Copyright (C) 2001-2009 University of Oxford */
/* CCOPYRIGHT */
......@@ -17,12 +17,13 @@
#include <vector>
#include "miscmaths/optimise.h"
#include "newmatap.h"
#include "newmatio.h"
#include "armawrap/newmat.h"
#include "armawrap/newmat.h"
#include "newimage/newimageall.h"
#include "utils/options.h"
#include "miscmaths/kernel.h"
using namespace std;
using namespace MISCMATHS;
using namespace NEWMAT;
using namespace NEWIMAGE;
......@@ -34,14 +35,14 @@ string examples="slicetimer -i <timeseries> [-o <corrected_timeseries>] [options
Option<bool> help(string("-h,--help"), false,
string("display this message"),
false, no_argument);
Option<bool> verbose(string("-v,--verbose"), false,
string("switch on diagnostic messages"),
Option<bool> verbose(string("-v,--verbose"), false,
string("switch on diagnostic messages"),
false, no_argument);
Option<bool> odd(string("--odd"), false,
string("use interleaved acquisition"),
Option<bool> odd(string("--odd"), false,
string("use interleaved acquisition"),
false, no_argument);
Option<bool> down(string("--down"), false,
string("reverse slice indexing (default is: slices were acquired bottom-up)"),
Option<bool> down(string("--down"), false,
string("reverse slice indexing (default is: slices were acquired bottom-up)"),
false, no_argument);
Option<string> inputname(string("-i,--in"), string(""),
string("filename of input timeseries"),
......@@ -69,7 +70,7 @@ int do_slice_correction()
{
volume4D<float> timeseries;
Matrix timings;
int no_volumes, no_slices;
float repeat_time, offset=0, slice_spacing;
......@@ -79,7 +80,7 @@ int do_slice_correction()
if (!outputname.set())
outputname.set_value(inputname.value() + "_st");
} 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;
return -1;
}
......@@ -108,20 +109,20 @@ int do_slice_correction()
// 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
for (int slice=1; slice<=no_slices; slice++) {
if (tglobal.set()) {
offset = tglobal.value();
} else if (tcustom.set()) {
offset = timings(slice, 1);
} else if (ocustom.set()) {
} else if (ocustom.set()) {
int local_count=1;
while (local_count <= no_slices) {
if (timings(local_count, 1) == slice) {
offset = recenter -(local_count -1)* (slice_spacing / repeat_time);
local_count = no_slices + 1;
} else
} else
local_count++;
}
} else if (odd.value()) { // acquisition order: 1,3,5, ..., 2,4,6 ...
......@@ -131,7 +132,7 @@ int do_slice_correction()
offset = recenter - ((slice -1) / 2) * (slice_spacing / repeat_time);
} else if (down.value()) {
offset = recenter - (no_slices - slice) * (slice_spacing / repeat_time);
} else {
} else {
offset = recenter - (slice -1) * (slice_spacing / repeat_time);
}
......@@ -145,11 +146,11 @@ int do_slice_correction()
}
timeseries.setvoxelts(interpseries,x_pos,y_pos,slice-1);
}
if (verbose.value())
cerr << "Slice " << slice << " offset " << offset << endl;
}
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
......@@ -160,7 +161,7 @@ int do_slice_correction()
int main (int argc,char** argv)
{
Tracer tr("main");
OptionParser options(title, examples);
try {
......@@ -183,30 +184,29 @@ int main (int argc,char** argv)
options.usage();
exit(EXIT_FAILURE);
}
if ( inputname.unset())
if ( inputname.unset())
{
options.usage();
cerr << endl
<< "--in or -i MUST be used."
cerr << endl
<< "--in or -i MUST be used."
<< endl;
exit(EXIT_FAILURE);
}
} catch(X_OptionError& e) {
options.usage();
cerr << endl << e.what() << endl;
exit(EXIT_FAILURE);
} catch(std::exception &e) {
cerr << e.what() << endl;
}
}
int retval = do_slice_correction();
if (retval!=0) {
cerr << endl << endl << "Error detected: try -h for help" << endl;
}
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