grid.h
1 /***************************************************************************
2  grid.h - description
3  -------------------
4  begin : Wed Feb 21 2007
5  copyright : (C) 2000-2015 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 RECOGRID_H
19 #define RECOGRID_H
20 
21 #include "step.h"
22 
23 
24 
25 template<int NDim>
26 class RecoGrid : public RecoStep {
27 
28  // implementing virtual functions of RecoStep
29  STD_string label() const {return "grid"+postfix();}
30  STD_string description() const {return "Grid signal data with arbitrary k-space trajectory in "+itos(NDim)+" dimensions";}
31  bool process(RecoData& rd, RecoController& controller);
32  RecoCoord input_coord() const {return RecoCoord::coord_with_mode(RecoIndex::collected, readout);}
33  void modify_coord(RecoCoord& coord) const {if(NDim==2) coord.set_mode(RecoIndex::collected, line);}
34  bool query(RecoQueryContext& context);
35  RecoStep* allocate() const {return new RecoGrid<NDim>;}
36  void init();
37 
38  LDRbool deapo_shift;
39  LDRfilter kernel;
40  LDRfloat kernelwidth;
41  LDRfloat gridScale;
42 
43  static TinyVector<int,NDim> gridshape(const RecoCoord& coord, RecoController& controller);
44 
45  const Gridding<STD_complex,NDim>& get_gridder(const RecoCoord& coord, RecoController& controller);
46 
47  // cache gridders
48  typedef STD_map<const KspaceTraj*, Gridding<STD_complex,NDim> > GridderMap;
49  GridderMap gridmap;
50  Mutex gridmutex;
51 
52  public: // to accessed by RecoDeapodize
53  static STD_string postfix() {return itos(NDim)+"d";}
54 };
55 
56 
58 
59 
60 template<int NDim>
61 class RecoDeapodize : public RecoStep {
62 
63  // implementing virtual functions of RecoStep
64  STD_string label() const {return "deapodize"+postfix();}
65  STD_string description() const {return "De-apodize gridded data in "+itos(NDim)+" dimensions";}
66  bool process(RecoData& rd, RecoController& controller);
67  RecoCoord input_coord() const {return RecoCoord::coord_with_mode(RecoIndex::collected, line3d, line, readout);}
68  void modify_coord(RecoCoord& coord) const {}
69  RecoStep* allocate() const {return new RecoDeapodize;}
70  void init() {}
71 
72  static STD_string postfix() {return RecoGrid<NDim>::postfix();}
73 
74 };
75 
76 
78 
79 
80 class RecoGridCut : public RecoStep {
81 
82  // implementing virtual functions of RecoStep
83  STD_string label() const {return "gridcut"; }
84  STD_string description() const {return "Cut out central part of image to remove effects from gridding on a denser grid";}
85  bool process(RecoData& rd, RecoController& controller);
86  RecoCoord input_coord() const {return RecoCoord::coord_with_mode(RecoIndex::collected, line3d, line, readout);}
87  void modify_coord(RecoCoord& coord) const {}
88  RecoStep* allocate() const {return new RecoGridCut;}
89  void init() {}
90 };
91 
92 
93 #endif
94 
RecoCoord & set_mode(RecoIndex::indexMode m, recoDim d1=n_recoDims, recoDim d2=n_recoDims, recoDim d3=n_recoDims, recoDim d4=n_recoDims, recoDim d5=n_recoDims, recoDim d6=n_recoDims, recoDim d7=n_recoDims, recoDim d8=n_recoDims)
Definition: index.h:238
Definition: tjthread.h:46
static RecoCoord coord_with_mode(RecoIndex::indexMode m, recoDim d1=n_recoDims, recoDim d2=n_recoDims, recoDim d3=n_recoDims, recoDim d4=n_recoDims, recoDim d5=n_recoDims, recoDim d6=n_recoDims, recoDim d7=n_recoDims, recoDim d8=n_recoDims)
Definition: index.h:254
gridcut: Cut out central part of image to remove effects from gridding on a denser grid ...
Definition: grid.h:80
grid1d, grid2d: Grid signal data with arbitrary k-space trajectory in 2 dimensions ...
Definition: grid.h:26
deapodize1d, deapodize2d: De-apodize gridded data in 2 dimensions
Definition: grid.h:61
STD_string itos(int i, unsigned int maxabs=0)