ODIN
filter_flip.h
1 /***************************************************************************
2  filter_flip.h - description
3  -------------------
4  begin : Tue Jan 22 2008
5  copyright : (C) 2000-2021 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef FILTER_FLIP_H
19 #define FILTER_FLIP_H
20 
21 #include <odindata/filter_step.h>
22 
23 template<int Dir>
24 class FilterFlip : public FilterStep {
25 
26  STD_string label() const {return STD_string(1,STD_string(dataDimLabel[Dir])[0])+"flip";} // Use only 1st letter
27  STD_string description() const {return "Flip data in "+STD_string(dataDimLabel[Dir])+" direction";}
28  bool process(Data<float,4>& data, Protocol& prot) const {
29  data.reverseSelf(Dir);
30 
31  // Adjust protocol
32  dvector sign(3);
33  sign=1.0;
34  sign[3-Dir]=-1.0;
36  sign[0]*prot.geometry.get_readVector(),
37  sign[1]*prot.geometry.get_phaseVector(),
38  sign[2]*prot.geometry.get_sliceVector(),
39  prot.geometry.get_center());
40 
41  return true;
42  }
43  FilterStep* allocate() const {return new FilterFlip<Dir>();}
44  void init() {}
45 };
46 
47 #endif
virtual bool process(Data< float, 4 > &data, Protocol &prot) const
dvector get_phaseVector() const
Geometry & set_orientation_and_offset(const dvector &readvec, const dvector &phasevec, const dvector &slicevec, const dvector &centervec)
dvector get_sliceVector() const
dvector get_readVector() const
dvector get_center() const
Protocol proxy.
Definition: protocol.h:33
Geometry geometry
Definition: protocol.h:83
virtual FilterStep * allocate() const=0
virtual STD_string description() const=0
virtual void init()=0
virtual STD_string label() const=0