grappa.h
1 /***************************************************************************
2  grappa.h - description
3  -------------------
4  begin : Fri Feb 2 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 RECOGRAPPA_H
19 #define RECOGRAPPA_H
20 
21 
22 #include "step.h"
23 #include "measindex.h"
24 
25 
26 
27 
28 
30 
31 
32  // NOTE: Dimensions of the weights are: dstchannel * reduction index * srcchannel * phase * read
33 
34 template<recoDim interpolDim, recoDim orthoDim, int interpolIndex, int orthoIndex, class Ignore=RecoDim<0> >
35 class RecoGrappaWeights : public RecoStep {
36 
37  // implementing virtual functions of RecoStep
38  STD_string label() const {
39  STD_string result="grappaweights";
40  if(Ignore::dim()>0) result+="templ";
41  if(interpolDim==line3d) result+="3d";
42  return result;
43  }
44  STD_string description() const {return "Calculate GRAPPA weights in dimension '"+STD_string(recoDimLabel[interpolDim])+"' and post them on the blackboard with the label 'grappaweights_"+recoDimLabel[interpolDim]+"'.";}
45  bool process(RecoData& rd, RecoController& controller);
46  RecoCoord input_coord() const {return RecoCoord::coord_with_mode(RecoIndex::collected,channel,line3d,line,readout);}
47  void modify_coord(RecoCoord& coord) const {}
48  bool query(RecoQueryContext& context);
49  RecoStep* allocate() const {return new RecoGrappaWeights;}
50  void init();
51 
52  LDRint reduction_factor;
53  LDRint neighbours_read;
54  LDRint neighbours_phase;
55  LDRfloat svd_trunc;
56  LDRfloat discard_level;
57 
58  // helper functions
59  ivector acl_lines(const RecoCoord& coord, int numof_neighb, int ired) const;
60  bool calc_weights(ComplexData<5>& weights, const RecoCoord& trainingcoord, const ComplexData<4>& trainingdata);
61 
62 
63  // Instance of RecoMeasIndex to get k-space sampling pattern,
64  // i.e. hase-encoding lines actually measured,
65  // by assuming the same for channel, freq, repetition and separate
66  // schemes for the orthogonal phase-encoding direction
68 
69 };
70 
71 
73 
74 
75 template<recoDim interpolDim, recoDim orthoDim, int interpolIndex, int orthoIndex>
76 class RecoGrappa : public RecoStep {
77 
78  // implementing virtual functions of RecoStep
79  STD_string label() const {if(interpolDim==line3d) return "grappa3d"; else return "grappa";}
80  STD_string description() const {return "Perform GRAPPA interpolation in dimension '"+STD_string(recoDimLabel[interpolDim])+"'";}
81  bool process(RecoData& rd, RecoController& controller);
82  RecoCoord input_coord() const {return RecoCoord::coord_with_mode(RecoIndex::collected,channel,line3d,line,readout);}
83  void modify_coord(RecoCoord& coord) const {}
84  bool query(RecoQueryContext& context);
85  RecoStep* allocate() const {return new RecoGrappa;}
86  void init();
87 
88  LDRint reduction_factor;
89  LDRbool keep_shape;
90 
91  // helper functions
92  int reduction_index(const ivector& indexvec, int sizePhase, int iphase) const;
93  bool correct_shape(RecoData& rdkspace, const RecoController& controller) const;
94 
95 
96  // Instance of RecoMeasIndex to get k-space sampling pattern,
97  // i.e. hase-encoding lines actually measured,
98  // by assuming the same for channel, freq, repetition and separate
99  // schemes for the orthogonal phase-encoding direction
101 
102 };
103 
104 
105 
106 
107 #endif
108 
grappaweights, grappaweights3d, grappaweightstempl, grappaweightstempl3d: Calculate GRAPPA weights in...
Definition: grappa.h:35
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
Definition: index.h:372
grappa, grappa3d: Perform GRAPPA interpolation in dimension &#39;line3d&#39;
Definition: grappa.h:76