18 #ifndef FILTER_RANGE_H
19 #define FILTER_RANGE_H
21 #include <odindata/filter_step.h>
24 bool str2range(
const STD_string& str, Range& range,
int srcsize);
25 STD_string str2range_usage();
33 STD_string
label()
const {
return STD_string(1,STD_string(dataDimLabel[Dir])[0])+
"range";}
34 STD_string
description()
const {
return "Select range in "+STD_string(dataDimLabel[Dir])+
" direction";}
37 Range all=Range::all();
40 for(
int i=0; i<4; i++) rng[i]=Range::all();
42 if(!str2range(range,rng[Dir],data.extent(Dir)))
return false;
44 TinyVector<int,4> newshape=data.shape();
45 int oldsize=newshape(Dir);
47 newshape(Dir)=rng[Dir].length();
50 float fovfraction=
secureDivision(rng[Dir].last()-rng[Dir].first()+1, oldsize);
52 float offsetfactor=
secureDivision(0.5*(rng[Dir].first()+rng[Dir].last()), oldsize)-0.5;
55 data.resize(newshape);
56 data(all,all,all,all)=data_copy(rng[timeDim],rng[sliceDim],rng[phaseDim],rng[readDim]);
59 int stride=rng[Dir].stride();
86 range.set_description(str2range_usage());
virtual bool process(Data< float, 4 > &data, Protocol &prot) const
Geometry & set_nSlices(unsigned int nslices)
double get_offset(direction dir) const
Geometry & set_sliceDistance(double dist)
Geometry & set_offset(direction dir, double offset)
double get_sliceDistance() const
Geometry & set_FOV(direction dir, double fov)
geometryMode get_Mode() const
double get_FOV(direction dir) const
SeqPars & set_RepetitionTime(double time, parameterMode parmode=edit)
SeqPars & set_MatrixSize(direction dir, unsigned int size, parameterMode parmode=edit)
SeqPars & set_NumOfRepetitions(unsigned int times, parameterMode parmode=edit)
double get_RepetitionTime() const
virtual FilterStep * allocate() const=0
void append_arg(LDRbase &arg, const STD_string &arglabel)
virtual STD_string description() const=0
virtual STD_string label() const=0
double secureDivision(double numerator, double denominator)