• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List

filter_flip.h

00001 /***************************************************************************
00002                           filter_flip.h  -  description
00003                              -------------------
00004     begin                : Tue Jan 22 2008
00005     copyright            : (C) 2001 by Thies Jochimsen
00006     email                : jochimse@cns.mpg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef FILTER_FLIP_H
00019 #define FILTER_FLIP_H
00020 
00021 #include <odindata/filter_step.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";} // Use only 1st letter
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     // Adjust protocol
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

Generated on Tue Dec 18 2012 15:11:14 by  doxygen 1.7.1