00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef FILTER_FLIP_H
00019 #define FILTER_FLIP_H
00020
00021 #include <odindata/filter.h>
00022
00023 template<int Dir>
00024 class FilterFlip : public FilterStep {
00025
00026 STD_string label() const {return STD_string(1,STD_string(dataDimLabel[Dir])[0])+"flip";}
00027 STD_string description() const {return "Flip data in "+STD_string(dataDimLabel[Dir])+" direction";}
00028 bool process(Data<float,4>& data, Protocol& prot) const {
00029 data.reverseSelf(Dir);
00030
00031
00032 dvector sign(3);
00033 sign=1.0;
00034 sign[3-Dir]=-1.0;
00035 prot.geometry.set_orientation_and_offset(
00036 sign[0]*prot.geometry.get_readVector(),
00037 sign[1]*prot.geometry.get_phaseVector(),
00038 sign[2]*prot.geometry.get_sliceVector(),
00039 prot.geometry.get_center());
00040
00041 return true;
00042 }
00043 FilterStep* allocate() const {return new FilterFlip<Dir>();}
00044 void init() {}
00045 };
00046
00047 #endif