KSFoundation  [October2024]
A platform for structured EPIC programming on GE MR systems
Prep sequence module: Spatial Saturation (ksspsat.[h,cc,e])

Data Structures

struct  KSSPSAT_VOLBORDER
 
struct  KSSPSAT_LOC
 
struct  KSSPSAT_DESIGN
 
struct  KSSPSAT_STATE
 
struct  KSSPSAT_MODULE
 

Macros

#define KSSPSAT_DESIGN_EXPLICIT_ON   1
 
#define KSSPSAT_MAXNUMSAT_IMPLICIT   6
 
#define KSSPSAT_MAXNUMSAT_EXPLICIT   6
 
#define KSSPSAT_DEFAULT_FLIP   95
 
#define KSSPSAT_DEFAULT_SPOILERAREA   3000
 
#define KSSPSAT_DEFAULT_SPOILALLAXES   1
 
#define KSSPSAT_DEFAULT_RFSTRETCH   1
 
#define KSSPSAT_EXPLICITSAT_DISABLED   9990.0 /* Set by UI on MR-scanner */
 
#define KSSPSAT_IMPLICITSAT_DISABLED   9999.0 /* Set by UI on MR-scanner */
 
#define KSSPSAT_DEFAULT_SSITIME   1000 /* try to reduce this value */
 
#define KSSPSAT_INIT_VOLBORDER   {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
 
#define KSSPSAT_INIT_LOC   {DEFAULT_AXIAL_SCAN_INFO, 0.0, KS_NOTSET, KSSPSAT_OFF}
 
#define KSSPSAT_INIT_LOC6   {KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC}
 
#define KSSPSAT_INIT_LOC12   {KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC, KSSPSAT_INIT_LOC}
 
#define KSSPSAT_INIT_IMPLICIT_ARRAY   KS_INITVALUE(KSSPSAT_MAXNUMSAT_IMPLICIT, 0.0)
 
#define KSSPSAT_INIT_EXPLICIT_ARRAY   KS_INITVALUE(KSSPSAT_MAXNUMSAT_IMPLICIT, KSSPSAT_OFF)
 
#define KSSPSAT_INIT_DESIGN   {KS_INIT_DESC, KSSPSAT_INIT_IMPLICIT_ARRAY /*slthick*/, KSSPSAT_INIT_IMPLICIT_ARRAY /*slthick*/, KSSPSAT_INIT_LOC6, KSSPSAT_DEFAULT_FLIP, KSSPSAT_RF_COMPLEX, KSSPSAT_DEFAULT_RFSTRETCH, KSSPSAT_DEFAULT_SPOILERAREA, KSSPSAT_DEFAULT_SPOILALLAXES, PSD_ON, PSD_OBL_RESTRICT, KSSPSAT_DEFAULT_SSITIME, KS_INIT_LOGGRD}
 
#define KSSPSAT_INIT_STATE   {KS_INIT_DESC, KSSPSAT_INIT_VOLBORDER, KSSPSAT_INIT_LOC12, 0, 0, 0, 0}
 
#define KSSPSAT_INIT_SELRF6   {KS_INIT_SELRF, KS_INIT_SELRF, KS_INIT_SELRF, KS_INIT_SELRF, KS_INIT_SELRF, KS_INIT_SELRF}
 
#define KSSPSAT_INIT_TRAP6   {KS_INIT_TRAP, KS_INIT_TRAP, KS_INIT_TRAP, KS_INIT_TRAP, KS_INIT_TRAP, KS_INIT_TRAP}
 
#define KSSPSAT_INIT_MODULE   {KSSPSAT_INIT_DESIGN, KSSPSAT_INIT_STATE, KSSPSAT_INIT_SELRF6, KSSPSAT_INIT_TRAP6, 0}
 

Typedefs

typedef float KSSPSAT_IMPLICIT_ARRAY[KSSPSAT_MAXNUMSAT_IMPLICIT]
 
typedef int KSSPSAT_EXPLICIT_ARRAY[KSSPSAT_MAXNUMSAT_EXPLICIT]
 

Enumerations

enum  KSSPSAT_MODE { KSSPSAT_OFF, KSSPSAT_IMPLICIT, KSSPSAT_EXPLICIT }
 
enum  KSSPSAT_MODE_LOCS {
  KSSPSAT_IMPL_FREQ_NEG, KSSPSAT_IMPL_FREQ_POS, KSSPSAT_IMPL_PHASE_NEG, KSSPSAT_IMPL_PHASE_POS,
  KSSPSAT_IMPL_SLICE_NEG, KSSPSAT_IMPL_SLICE_POS, KSSPSAT_EXPL1, KSSPSAT_EXPL2,
  KSSPSAT_EXPL3, KSSPSAT_EXPL4, KSSPSAT_EXPL5, KSSPSAT_EXPL6,
  KSSPSAT_MAXNUMSAT
}
 
enum  KSSPSAT_RF_TYPES { KSSPSAT_RF_STD, KSSPSAT_RF_COMPLEX, KSSPSAT_RF_MAXRFTYPES }
 
enum  KSSPSAT_RF_SIDES { KSSPSAT_NEG =1, KSSPSAT_POS, KSSPSAT_HAD, KSSPSAT_PARA }
 

Functions

void ksspsat_init_design (KSSPSAT_DESIGN *ksspsat_design, const char *desc)
 
void ksspsat_init_state (KSSPSAT_STATE *ksspsat_state)
 
STATUS ksspsat_eval_design_satplacements (KSSPSAT_DESIGN *spsat_design, KSSPSAT_STATE *spsat_state, const SCAN_INFO *ref_scan_info)
 
STATUS ksspsat_eval_satplacements_dump (KSSPSAT_STATE *spsat_state)
 
int ksspsat_any_implicit (KSSPSAT_DESIGN *spsat_design)
 
int ksspsat_any_explicit (KSSPSAT_DESIGN *spsat_design)
 
int ksspsat_any_satpulses (KSSPSAT_DESIGN *spsat_design)
 
STATUS ksspsat_eval_volborder (KSSPSAT_VOLBORDER *v, SCAN_INFO my_scan_info[KS_MAX_RF_SCANINFO], int nslices, float freq_fov, float phase_fov, float slthick)
 
STATUS ksspsat_eval_validatedesign (KSSPSAT_DESIGN *spsat_design)
 
STATUS ksspsat_eval_design (KSSPSAT_MODULE *spsat_module, KS_KSPACE_DESIGN *kspace_design, KS_SLICETIMING_DESIGN *slicetiming_design, float slthick)
 
STATUS ksspsat_eval (KSSPSAT_MODULE *spsat_module, KS_KSPACE_DESIGN *kspace_design, KS_SLICETIMING_DESIGN *slicetiming_design, float slthick)
 
STATUS ksspsat_pg (KSSPSAT_MODULE *spsat_module, int start_time, KS_SEQ_CONTROL *ctrl)
 
void ksspsat_scan_seqstate (const SCAN_INFO *slice_pos, KS_DYNAMIC_STATE *dynamic, KSSPSAT_MODULE *spsat_module)
 
void ksspsat_set_design_implicit_from_UI (KSSPSAT_IMPLICIT_ARRAY implicit_slthick)
 
STATUS ksspsat_set_design_explicit_from_UI (KSSPSAT_LOC *explicit_locs)
 
STATUS ksspsat_set_design_from_UI (KSSPSAT_DESIGN *spsat_design)
 

Variables

SCAN_INFO scan_info []
 
KSSPSAT_MODULE ksspsat = KSSPSAT_INIT_MODULE
 

Detailed Description

Macro Definition Documentation

◆ KSSPSAT_DESIGN_EXPLICIT_ON

#define KSSPSAT_DESIGN_EXPLICIT_ON   1

◆ KSSPSAT_MAXNUMSAT_IMPLICIT

#define KSSPSAT_MAXNUMSAT_IMPLICIT   6

◆ KSSPSAT_MAXNUMSAT_EXPLICIT

#define KSSPSAT_MAXNUMSAT_EXPLICIT   6

◆ KSSPSAT_DEFAULT_FLIP

#define KSSPSAT_DEFAULT_FLIP   95

Default flip angle for a saturation pulse

◆ KSSPSAT_DEFAULT_SPOILERAREA

#define KSSPSAT_DEFAULT_SPOILERAREA   3000

Default spoiler area

◆ KSSPSAT_DEFAULT_SPOILALLAXES

#define KSSPSAT_DEFAULT_SPOILALLAXES   1

By default, spoil on all boards

◆ KSSPSAT_DEFAULT_RFSTRETCH

#define KSSPSAT_DEFAULT_RFSTRETCH   1

By default, do not stretch RF pulses

◆ KSSPSAT_EXPLICITSAT_DISABLED

#define KSSPSAT_EXPLICITSAT_DISABLED   9990.0 /* Set by UI on MR-scanner */

◆ KSSPSAT_IMPLICITSAT_DISABLED

#define KSSPSAT_IMPLICITSAT_DISABLED   9999.0 /* Set by UI on MR-scanner */

◆ KSSPSAT_DEFAULT_SSITIME

#define KSSPSAT_DEFAULT_SSITIME   1000 /* try to reduce this value */

◆ KSSPSAT_INIT_VOLBORDER

#define KSSPSAT_INIT_VOLBORDER   {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}

◆ KSSPSAT_INIT_LOC

#define KSSPSAT_INIT_LOC   {DEFAULT_AXIAL_SCAN_INFO, 0.0, KS_NOTSET, KSSPSAT_OFF}

◆ KSSPSAT_INIT_LOC6

◆ KSSPSAT_INIT_LOC12

◆ KSSPSAT_INIT_IMPLICIT_ARRAY

#define KSSPSAT_INIT_IMPLICIT_ARRAY   KS_INITVALUE(KSSPSAT_MAXNUMSAT_IMPLICIT, 0.0)

◆ KSSPSAT_INIT_EXPLICIT_ARRAY

#define KSSPSAT_INIT_EXPLICIT_ARRAY   KS_INITVALUE(KSSPSAT_MAXNUMSAT_IMPLICIT, KSSPSAT_OFF)

◆ KSSPSAT_INIT_DESIGN

◆ KSSPSAT_INIT_STATE

#define KSSPSAT_INIT_STATE   {KS_INIT_DESC, KSSPSAT_INIT_VOLBORDER, KSSPSAT_INIT_LOC12, 0, 0, 0, 0}

◆ KSSPSAT_INIT_SELRF6

◆ KSSPSAT_INIT_TRAP6

◆ KSSPSAT_INIT_MODULE

Typedef Documentation

◆ KSSPSAT_IMPLICIT_ARRAY

typedef float KSSPSAT_IMPLICIT_ARRAY[KSSPSAT_MAXNUMSAT_IMPLICIT]

◆ KSSPSAT_EXPLICIT_ARRAY

typedef int KSSPSAT_EXPLICIT_ARRAY[KSSPSAT_MAXNUMSAT_EXPLICIT]

Enumeration Type Documentation

◆ KSSPSAT_MODE

Enumerator
KSSPSAT_OFF 
KSSPSAT_IMPLICIT 
KSSPSAT_EXPLICIT 
Definition: ksspsat.h:27
Definition: ksspsat.h:27
Definition: ksspsat.h:27
KSSPSAT_MODE
Definition: ksspsat.h:27

◆ KSSPSAT_MODE_LOCS

Enumerator
KSSPSAT_IMPL_FREQ_NEG 
KSSPSAT_IMPL_FREQ_POS 
KSSPSAT_IMPL_PHASE_NEG 
KSSPSAT_IMPL_PHASE_POS 
KSSPSAT_IMPL_SLICE_NEG 
KSSPSAT_IMPL_SLICE_POS 
KSSPSAT_EXPL1 
KSSPSAT_EXPL2 
KSSPSAT_EXPL3 
KSSPSAT_EXPL4 
KSSPSAT_EXPL5 
KSSPSAT_EXPL6 
KSSPSAT_MAXNUMSAT 
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
KSSPSAT_MODE_LOCS
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31

◆ KSSPSAT_RF_TYPES

Enumerator
KSSPSAT_RF_STD 
KSSPSAT_RF_COMPLEX 
KSSPSAT_RF_MAXRFTYPES 
Definition: ksspsat.h:35
Definition: ksspsat.h:35
KSSPSAT_RF_TYPES
Definition: ksspsat.h:35
Definition: ksspsat.h:35

◆ KSSPSAT_RF_SIDES

Enumerator
KSSPSAT_NEG 
KSSPSAT_POS 
KSSPSAT_HAD 
KSSPSAT_PARA 
Definition: ksspsat.h:36
Definition: ksspsat.h:36
KSSPSAT_RF_SIDES
Definition: ksspsat.h:36
Definition: ksspsat.h:36
Definition: ksspsat.h:36

Function Documentation

◆ ksspsat_init_design()

void ksspsat_init_design ( KSSPSAT_DESIGN ksspsat_design,
const char *  desc 
)

Initialize the design for a spatial sat module

Parameters
[out]ksspsat_designPointer to the design to be initialized
[in]descDestriction
Return values
void
31  {
32  KSSPSAT_DESIGN default_ksspsat_design = KSSPSAT_INIT_DESIGN;
33  *spsat_design = default_ksspsat_design;
34 
35  if (desc != NULL && strlen(desc) > 0) {
36  strcpy(spsat_design->description, desc);
37  }
38 
39 } /* ksspsat_init_design() */
#define KSSPSAT_INIT_DESIGN
Definition: ksspsat.h:93
Definition: ksspsat.h:78

◆ ksspsat_init_state()

void ksspsat_init_state ( KSSPSAT_STATE ksspsat_state)

Initialize the state for a spatial sat module

Parameters
[out]ksspsat_statePointer to the state to be initialized
Returns
void
44  {
45  KSSPSAT_STATE default_ksspsat_state = KSSPSAT_INIT_STATE;
46  *ksspsat_state = default_ksspsat_state;
47 
48 } /* ksspsat_init_state() */
Definition: ksspsat.h:95
#define KSSPSAT_INIT_STATE
Definition: ksspsat.h:104

◆ ksspsat_eval_design_satplacements()

STATUS ksspsat_eval_design_satplacements ( KSSPSAT_DESIGN spsat_design,
KSSPSAT_STATE spsat_state,
const SCAN_INFO *  ref_scan_info 
)

Populate the sat band locations according to the design

Parameters
[in]spsat_designPointer to the design
[out]spsat_statePointer to the state whose locations will be populated
[in]ref_scan_infoReference slice orientation used for the implicit sat bands
Return values
STATUSSUCCESS or FAILURE
53  {
54  /*STATUS status;
55  int j, index;*/
56  int i;
57 
58  /***************** IMPLICIT SAT (at the FOV edges) *****************/
59 
60  /* Init all sat bands to off state */
61  for (i = 0; i < KSSPSAT_MAXNUMSAT; i++)
62  ksspsat_state->satlocation[i].active = KSSPSAT_OFF;
63 
64  /* Init all sat rotations to scan plane */
65  for (i = 0; i < KSSPSAT_MAXNUMSAT_IMPLICIT; i++)
66  memcpy(ksspsat_state->satlocation[i].loc.oprot, ref_scan_info->oprot, 9 * sizeof(float));
67 
68  /* Implicit Sat(s) - Frequency encoding direction */
69  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_FREQ_POS] > 0) {
70  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_POS].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_FREQ_POS];
71  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_POS].active = KSSPSAT_IMPLICIT;
72  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_POS].loc.optloc = ksspsat_state->volborder.freq_max + ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_POS].thickness / 2.0 + spsat_design->implicit_shift[KSSPSAT_IMPL_FREQ_POS];
73  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_POS].gradboard = XGRAD;
74  }
75 
76  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_FREQ_NEG] > 0) {
77  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_NEG].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_FREQ_NEG];
78  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_NEG].active = KSSPSAT_IMPLICIT;
79  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_NEG].loc.optloc = ksspsat_state->volborder.freq_min - ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_NEG].thickness / 2.0 - spsat_design->implicit_shift[KSSPSAT_IMPL_FREQ_NEG];
80  ksspsat_state->satlocation[KSSPSAT_IMPL_FREQ_NEG].gradboard = XGRAD;
81  }
82 
83  /* Implicit Sat(s) - Phase encoding direction */
84  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_PHASE_POS] > 0) {
85  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_POS].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_PHASE_POS];
86  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_POS].active = KSSPSAT_IMPLICIT;
87  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_POS].loc.optloc = ksspsat_state->volborder.phase_max + ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_POS].thickness / 2.0 + spsat_design->implicit_shift[KSSPSAT_IMPL_PHASE_POS];
88  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_POS].gradboard = YGRAD;
89  }
90 
91  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_PHASE_NEG] > 0) {
92  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_NEG].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_PHASE_NEG];
93  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_NEG].active = KSSPSAT_IMPLICIT;
94  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_NEG].loc.optloc = ksspsat_state->volborder.phase_min - ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_NEG].thickness / 2.0 - spsat_design->implicit_shift[KSSPSAT_IMPL_PHASE_NEG];
95  ksspsat_state->satlocation[KSSPSAT_IMPL_PHASE_NEG].gradboard = YGRAD;
96  }
97 
98  /* Implicit Sat(s) - Slice encoding direction */
99  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_SLICE_POS] > 0) {
100  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_POS].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_SLICE_POS];
101  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_POS].active = KSSPSAT_IMPLICIT;
102  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_POS].loc.optloc = ksspsat_state->volborder.slice_max + ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_POS].thickness / 2.0 + spsat_design->implicit_shift[KSSPSAT_IMPL_SLICE_POS];
103  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_POS].gradboard = ZGRAD;
104  }
105 
106  if (spsat_design->implicit_slthick[KSSPSAT_IMPL_SLICE_NEG] > 0) {
107  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_NEG].thickness = spsat_design->implicit_slthick[KSSPSAT_IMPL_SLICE_NEG];
108  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_NEG].active = KSSPSAT_IMPLICIT;
109  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_NEG].loc.optloc = ksspsat_state->volborder.slice_min - ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_NEG].thickness / 2.0 - spsat_design->implicit_shift[KSSPSAT_IMPL_SLICE_NEG];
110  ksspsat_state->satlocation[KSSPSAT_IMPL_SLICE_NEG].gradboard = ZGRAD;
111  }
112 
113 
114  /* Explicit Sat(s) */
115  for (i = 0; i < KSSPSAT_MAXNUMSAT_EXPLICIT; i++) {
116  ksspsat_state->satlocation[KSSPSAT_EXPL1 + i] = spsat_design->explicit_locs[i];
117  }
118 
119  return SUCCESS;
120 
121 } /* ksspsat_eval_design_satplacements() */
#define KSSPSAT_MAXNUMSAT_EXPLICIT
Definition: ksspsat.h:33
Definition: ksspsat.h:27
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:27
KSSPSAT_IMPLICIT_ARRAY implicit_shift
Definition: ksspsat.h:81
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
#define KSSPSAT_MAXNUMSAT_IMPLICIT
Definition: ksspsat.h:32
KSSPSAT_IMPLICIT_ARRAY implicit_slthick
Definition: ksspsat.h:80
KSSPSAT_LOC explicit_locs[KSSPSAT_MAXNUMSAT_EXPLICIT]
Definition: ksspsat.h:82

◆ ksspsat_eval_satplacements_dump()

STATUS ksspsat_eval_satplacements_dump ( KSSPSAT_STATE spsat_state)

Writes out the geometric information of the active sat bands to spsat.txt

On the MR system (PSD_HW), this file will be located in /usr/g/mrraw, while in simulation it will be located in the current psd directory.

Return values
STATUSSUCCESS or FAILURE
126  {
127  float *rot;
128  int i;
129 
130 #ifdef PSD_HW
131 #ifdef IPG
132  return SUCCESS;
133 #endif
134  FILE *fp = fopen("/usr/g/mrraw/ksspsat.txt", "w");
135 #else
136  FILE *fp = fopen("./ksspsat.txt", "w");
137 #endif
138 
139  for (i = 0; i < KSSPSAT_MAXNUMSAT; i++) {
140  fprintf(fp, "Sat Pulse #%d: ", i);
141  if (ksspsat_state->satlocation[i].active == KSSPSAT_OFF)
142  fprintf(fp, "Off\n");
143  else if (ksspsat_state->satlocation[i].active == KSSPSAT_EXPLICIT)
144  fprintf(fp, "Explicit\n");
145  else if (ksspsat_state->satlocation[i].active == KSSPSAT_IMPLICIT)
146  fprintf(fp, "Implicit\n");
147 
148  fprintf(fp, "Grad: ");
149  if (ksspsat_state->satlocation[i].gradboard == XGRAD)
150  fprintf(fp, "XGRAD (Freq)");
151  else if (ksspsat_state->satlocation[i].gradboard == YGRAD)
152  fprintf(fp, "YGRAD (Phase)");
153  else if (ksspsat_state->satlocation[i].gradboard == ZGRAD)
154  fprintf(fp, "ZGRAD (Slice)");
155 
156  fprintf(fp, "\nThickness: %.2f\n", ksspsat_state->satlocation[i].thickness);
157  fprintf(fp, "Location: %.2f\n", ksspsat_state->satlocation[i].loc.optloc);
158 
159  rot = ksspsat_state->satlocation[i].loc.oprot;
160  fprintf(fp, "Rotation:\n");
161  fprintf(fp, "%.3f %.3f %.3f\n%.3f %.3f %.3f\n%.3f %.3f %.3f\n\n", rot[0], rot[3], rot[6], rot[1], rot[4], rot[7], rot[2], rot[5], rot[8]);
162  }
163 
164  fprintf(fp, "Volume borders:\n- Freq: %.2f %.2f\n- Phase: %.2f %.2f\n- Slice: %.2f %.2f\n", ksspsat_state->volborder.freq_min, ksspsat_state->volborder.freq_max, ksspsat_state->volborder.phase_min, ksspsat_state->volborder.phase_max, ksspsat_state->volborder.slice_min, ksspsat_state->volborder.slice_max);
165 
166  rot = scan_info[0].oprot;
167  fprintf(fp, "\nSlice rotation:\n");
168  fprintf(fp, "%.3f %.3f %.3f\n%.3f %.3f %.3f\n%.3f %.3f %.3f\n\n", rot[0], rot[3], rot[6], rot[1], rot[4], rot[7], rot[2], rot[5], rot[8]);
169 
170 
171 
172  fclose(fp);
173 
174  return SUCCESS;
175 
176 } /* ksspsat_eval_satplacements_dump() */
Definition: ksspsat.h:27
Definition: ksspsat.h:31
Definition: ksspsat.h:27
Definition: ksspsat.h:27
SCAN_INFO scan_info[]

◆ ksspsat_any_implicit()

int ksspsat_any_implicit ( KSSPSAT_DESIGN spsat_design)

Returns if any implicit sat bands is active

Parameters
[in]spsat_designPointer to the design
Return values
TRUE(1) or FALSE (0)
181  {
182  return (spsat_design->implicit_slthick[0] > 0 ||
183  spsat_design->implicit_slthick[1] > 0 ||
184  spsat_design->implicit_slthick[2] > 0 ||
185  spsat_design->implicit_slthick[3] > 0 ||
186  spsat_design->implicit_slthick[4] > 0 ||
187  spsat_design->implicit_slthick[5] > 0);
188 
189 } /* ksspsat_any_implicit() */
KSSPSAT_IMPLICIT_ARRAY implicit_slthick
Definition: ksspsat.h:80

◆ ksspsat_any_explicit()

int ksspsat_any_explicit ( KSSPSAT_DESIGN spsat_design)

Returns if any explicit sat bands is active

Parameters
[in]spsat_designPointer to the design
Return values
TRUE(1) or FALSE (0)
194  {
195  return (spsat_design->explicit_locs[0].active != KSSPSAT_OFF ||
196  spsat_design->explicit_locs[1].active != KSSPSAT_OFF ||
197  spsat_design->explicit_locs[2].active != KSSPSAT_OFF ||
198  spsat_design->explicit_locs[3].active != KSSPSAT_OFF ||
199  spsat_design->explicit_locs[4].active != KSSPSAT_OFF ||
200  spsat_design->explicit_locs[5].active != KSSPSAT_OFF);
201 
202 } /* ksspsat_any_explicit() */
Definition: ksspsat.h:27
KSSPSAT_MODE active
Definition: ksspsat.h:66
KSSPSAT_LOC explicit_locs[KSSPSAT_MAXNUMSAT_EXPLICIT]
Definition: ksspsat.h:82

◆ ksspsat_any_satpulses()

int ksspsat_any_satpulses ( KSSPSAT_DESIGN spsat_design)

Returns if any sat bands is active

Parameters
[in]spsat_designPointer to the design
Return values
TRUE(1) or FALSE (0)
207  {
208  return (ksspsat_any_implicit(spsat_design) || ksspsat_any_explicit(spsat_design));
209 
210 } /* ksspsat_any_satpulses() */
int ksspsat_any_implicit(KSSPSAT_DESIGN *spsat_design)
Returns if any implicit sat bands is active
Definition: ksspsat.cc:181
int ksspsat_any_explicit(KSSPSAT_DESIGN *spsat_design)
Returns if any explicit sat bands is active
Definition: ksspsat.cc:194

◆ ksspsat_eval_volborder()

STATUS ksspsat_eval_volborder ( KSSPSAT_VOLBORDER v,
SCAN_INFO  my_scan_info[KS_MAX_RF_SCANINFO],
int  nslices,
float  freq_fov,
float  phase_fov,
float  slthick 
)

Get the FOV volume borders in mm from the isocenter

The FOV volume depends on the positions and thickness of the slices to be excited by the main module. This assumes that all slices have the same orientation.

Parameters
[out]vThe calculated FOV volume
[in]my_scan_infoThe locations for the slices
[in]nslicesThe number of slices
[in]freq_fovFOV along the frequency encoding direction
[in]phase_fovFOV along the phase encoding direction
[in]slthickSlice thickness
Return values
STATUSSUCCESS or FAILURE
215  {
216  int i;
217 
218  v->freq_min = my_scan_info[0].oprloc;
219  v->freq_max = my_scan_info[0].oprloc;
220  v->phase_min = my_scan_info[0].opphasoff;
221  v->phase_max = my_scan_info[0].opphasoff;
222  v->slice_min = my_scan_info[0].optloc;
223  v->slice_max = my_scan_info[0].optloc;
224 
225  for (i = 1; i < nslices; i++) {
226  if (my_scan_info[i].oprloc > v->freq_max)
227  v->freq_max = my_scan_info[i].oprloc;
228  else if (my_scan_info[i].oprloc < v->freq_min)
229  v->freq_min = my_scan_info[i].oprloc;
230 
231  if (my_scan_info[i].opphasoff > v->phase_max)
232  v->phase_max = my_scan_info[i].opphasoff;
233  else if (my_scan_info[i].opphasoff < v->phase_min)
234  v->phase_min = my_scan_info[i].opphasoff;
235 
236  if (my_scan_info[i].optloc > v->slice_max)
237  v->slice_max = my_scan_info[i].optloc;
238  else if (my_scan_info[i].optloc < v->slice_min)
239  v->slice_min = my_scan_info[i].optloc;
240  }
241 
242 
243  v->freq_min -= freq_fov / 2.0;
244  v->freq_max += freq_fov / 2.0;
245  v->phase_min -= phase_fov / 2.0;
246  v->phase_max += phase_fov / 2.0;
247  v->slice_min -= slthick / 2.0;
248  v->slice_max += slthick / 2.0;
249 
250  return SUCCESS;
251 
252 } /* ksspsat_eval_volborder() */
float phase_max
Definition: ksspsat.h:56
float slice_min
Definition: ksspsat.h:57
float phase_min
Definition: ksspsat.h:55
float slice_max
Definition: ksspsat.h:58
float freq_min
Definition: ksspsat.h:53
float freq_max
Definition: ksspsat.h:54

◆ ksspsat_eval_validatedesign()

STATUS ksspsat_eval_validatedesign ( KSSPSAT_DESIGN spsat_design)

Validate the design

Parameters
[in]spsat_designPointer to the design to be validated
Return values
STATUSSUCCESS or FAILURE, the latter means the design is not valid
257  {
258 
259  if (areSame(spsat_design->rfstretch, 1.0) == FALSE && spsat_design->rftype == KSSPSAT_RF_COMPLEX){
260  return KS_THROW("You cannot stretch rfpulse type KSSPSAT_RF_COMPLEX (spsatc_satqptbw12) since it is phase modulated");
261  }
262 
263  return SUCCESS;
264 
265 } /* ksspsat_eval_validatedesign() */
#define areSame(a, b)
Definition: KSFoundation.h:144
int rftype
Definition: ksspsat.h:84
float rfstretch
Definition: ksspsat.h:85
Definition: ksspsat.h:35
#define KS_THROW(format,...)
Definition: KSFoundation.h:181

◆ ksspsat_eval_design()

STATUS ksspsat_eval_design ( KSSPSAT_MODULE spsat_module,
KS_KSPACE_DESIGN kspace_design,
KS_SLICETIMING_DESIGN slicetiming_design,
float  slthick 
)

Evaluate the design of the spatial sat module in order to calculate its state

Parameters
[out]spsat_modulePointer to the spatial sat module to be evaluated
[in]kspace_designPointer to the k-space design of the main module, needed for FOV and resolution
[in]slicetiming_designPointer to the slice timing design, needed for the slice locations
[in]slthickSlice thickness
Return values
STATUSSUCCESS or FAILURE
270  {
271  STATUS status;
272  KS_DESCRIPTION tmpdesc;
273  int i;
274 
275  int nslices = kspace_design->res[ZGRAD] > 0 ? 1 : IMax(2, slicetiming_design->nslices, kspace_design->res[ZGRAD]); /* 3D multislab not implemented */
276  spsat_module->state.N_impl_sat_pulses = 0;
277  spsat_module->state.N_expl_sat_pulses = 0;
278 
279  status = ksspsat_eval_volborder(&spsat_module->state.volborder, slicetiming_design->scan_info, nslices, kspace_design->fov[XGRAD], kspace_design->fov[YGRAD], slthick);
280  KS_RAISE(status);
281 
282  status = ksspsat_eval_design_satplacements(&spsat_module->design, &spsat_module->state, &slicetiming_design->scan_info[0]);
283  KS_RAISE(status);
284 
285  /* up to 6 (KSSPSAT_MAXNUMSAT) selective RF pulses */
286  for (i = 0; i < KSSPSAT_MAXNUMSAT; i++) {
287  if (spsat_module->state.satlocation[i].active == KSSPSAT_OFF) {
288  continue;
289  }
290 
291  if (spsat_module->state.satlocation[i].active == KSSPSAT_IMPLICIT) {
292  spsat_module->state.N_impl_sat_pulses += 1;
293  } else {
294  spsat_module->state.N_expl_sat_pulses += 1;
295  }
296 
297  if (spsat_module->design.rftype == KSSPSAT_RF_COMPLEX){
298  /* Theta modulated pulse NOT stretchable */
299  spsat_module->selrf[i].rf = spsatc_satqptbw12; /* KSFoundation_GERF.h */
300  } else {
301  spsat_module->selrf[i].rf = spsat_dblsatl0; /* KSFoundation_GERF.h */
302  }
303 
304  ks_eval_stretch_rf(&spsat_module->selrf[i].rf, spsat_module->design.rfstretch);
305 
306  spsat_module->selrf[i].rf.flip = spsat_module->design.flip;
307  spsat_module->selrf[i].slthick = spsat_module->state.satlocation[i].thickness;
308  ks_create_suffixed_description(tmpdesc, spsat_module->design.description, "_selrf%d", i);
309 
310  status = ks_eval_selrf_constrained(&spsat_module->selrf[i], tmpdesc,
311  ks_syslimits_ampmax(spsat_module->design.loggrad),
312  ks_syslimits_slewrate(spsat_module->design.loggrad));
313  KS_RAISE(status);
314 
315  /* spoiler */
316  spsat_module->spoiler[i].area = spsat_module->design.spoilerarea;
317  ks_create_suffixed_description(tmpdesc, spsat_module->design.description, "_spoiler%d", i);
318  status = ks_eval_trap_rotation_invariant_75_max_slewrate(&spsat_module->spoiler[i], tmpdesc);
319  KS_RAISE(status);
320  }
321 
322  return SUCCESS;
323 
324 } /* ksspsat_eval_design() */
STATUS ks_eval_trap_rotation_invariant_75_max_slewrate(KS_TRAP *trap, const char *const desc)
Sets up a trapezoid using a KS_TRAP sequence object with physical gradient constraints (invariant to ...
Definition: KSFoundation_host.c:524
Definition: ksspsat.h:27
KS_SELRF selrf[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:109
Definition: ksspsat.h:31
Definition: ksspsat.h:27
float ks_syslimits_ampmax(LOG_GRAD loggrd)
Returns the maximum gradient amplitude that can be used on all gradient boards simultaneously
Definition: KSFoundation_common.c:235
KS_TRAP spoiler[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:110
LOG_GRAD loggrad
Definition: ksspsat.h:91
float spoilerarea
Definition: ksspsat.h:86
KSSPSAT_VOLBORDER volborder
Definition: ksspsat.h:97
STATUS ks_eval_selrf_constrained(KS_SELRF *selrf, const char *const desc, float ampmax, float slewrate) WARN_UNUSED_RESULT
Sets up a KS_SELRF object for RF slice selection, subject to gradients constraints specified as input...
Definition: KSFoundation_host.c:2967
int rftype
Definition: ksspsat.h:84
STATUS ksspsat_eval_volborder(KSSPSAT_VOLBORDER *v, SCAN_INFO my_scan_info[KS_MAX_RF_SCANINFO], int nslices, float freq_fov, float phase_fov, float slthick)
Get the FOV volume borders in mm from the isocenter
Definition: ksspsat.cc:215
float flip
Definition: KSFoundation.h:1028
KS_DESCRIPTION description
Definition: ksspsat.h:79
KSSPSAT_STATE state
Definition: ksspsat.h:108
float rfstretch
Definition: ksspsat.h:85
KSSPSAT_LOC satlocation[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:98
KS_RF rf
Definition: KSFoundation.h:1454
float flip
Definition: ksspsat.h:83
STATUS ksspsat_eval_design_satplacements(KSSPSAT_DESIGN *spsat_design, KSSPSAT_STATE *ksspsat_state, const SCAN_INFO *ref_scan_info)
Populate the sat band locations according to the design
Definition: ksspsat.cc:53
void ks_create_suffixed_description(char *const out, const char *const prefix, const char *suffix,...) __attribute__((format(printf
float area
Definition: KSFoundation.h:670
Definition: ksspsat.h:35
#define KS_RAISE(status)
Definition: KSFoundation.h:190
float ks_syslimits_slewrate(LOG_GRAD loggrd)
Returns the maximum slewrate that can be used on all gradient boards simultaneously
Definition: KSFoundation_common.c:305
DECL_TYPE KS_RF spsatc_satqptbw12
Definition: KSFoundation_GERF.c:2568
DECL_TYPE KS_RF spsat_dblsatl0
Definition: KSFoundation_GERF.c:2470
int N_expl_sat_pulses
Definition: ksspsat.h:101
int nslices
Definition: ksscan.h:23
SCAN_INFO scan_info[SLTAB_MAX]
Definition: ksscan.h:22
KSSPSAT_DESIGN design
Definition: ksspsat.h:107
KSSPSAT_MODE active
Definition: ksspsat.h:66
char KS_DESCRIPTION[KS_DESCRIPTION_LENGTH]
Definition: KSFoundation.h:351
STATUS ks_eval_stretch_rf(KS_RF *rf, float stretch_factor)
In-place stretching of a KS_RF object
Definition: KSFoundation_host.c:3928
int res[3]
Definition: ksdesign.h:80
int N_impl_sat_pulses
Definition: ksspsat.h:100
float fov[3]
Definition: ksdesign.h:79
float slthick
Definition: KSFoundation.h:1456
float thickness
Definition: ksspsat.h:64

◆ ksspsat_eval()

STATUS ksspsat_eval ( KSSPSAT_MODULE spsat_module,
KS_KSPACE_DESIGN kspace_design,
KS_SLICETIMING_DESIGN slicetiming_design,
float  slthick 
)

Helper function that performs all eval functions in order

Initialize the state, validate the design, evaluate the design and log the sat band's location

Parameters
[out]spsat_modulePointer to the spatial sat module to be evaluated
[in]kspace_designPointer to the k-space design of the main module, needed for FOV and resolution
[in]slicetiming_designPointer to the slice timing design, needed for the slice locations
[in]slthickSlice thickness
Return values
STATUSSUCCESS or FAILURE
329  {
330  STATUS status;
331 
332  ksspsat_init_state(&spsat_module->state);
333 
334  /* return early if spsat turned off */
335  if (ksspsat_any_satpulses(&spsat_module->design) == FALSE) {
336  return SUCCESS;
337  }
338 
339  status = ksspsat_eval_validatedesign(&spsat_module->design);
340  KS_RAISE(status);
341 
342  status = ksspsat_eval_design(spsat_module, kspace_design, slicetiming_design, slthick);
343  KS_RAISE(status);
344 
345  status = ksspsat_eval_satplacements_dump(&spsat_module->state);
346  KS_RAISE(status);
347 
348  return SUCCESS;
349 
350 } /* ksspsat_eval() */
STATUS ksspsat_eval_validatedesign(KSSPSAT_DESIGN *spsat_design)
Validate the design
Definition: ksspsat.cc:257
void ksspsat_init_state(KSSPSAT_STATE *ksspsat_state)
Initialize the state for a spatial sat module
Definition: ksspsat.cc:44
KSSPSAT_STATE state
Definition: ksspsat.h:108
STATUS ksspsat_eval_satplacements_dump(KSSPSAT_STATE *ksspsat_state)
Writes out the geometric information of the active sat bands to spsat.txt
Definition: ksspsat.cc:126
STATUS ksspsat_eval_design(KSSPSAT_MODULE *spsat_module, KS_KSPACE_DESIGN *kspace_design, KS_SLICETIMING_DESIGN *slicetiming_design, float slthick)
Evaluate the design of the spatial sat module in order to calculate its state
Definition: ksspsat.cc:270
#define KS_RAISE(status)
Definition: KSFoundation.h:190
KSSPSAT_DESIGN design
Definition: ksspsat.h:107
int ksspsat_any_satpulses(KSSPSAT_DESIGN *spsat_design)
Returns if any sat bands is active
Definition: ksspsat.cc:207

◆ ksspsat_pg()

STATUS ksspsat_pg ( KSSPSAT_MODULE spsat_module,
int  start_time,
KS_SEQ_CONTROL ctrl 
)

Place all waveforms for the spatial sat module

Parameters
[out]spsat_modulePointer to the spatial sat module
[in]start_timeStart time within the relevant KS_SEQ_CONTROL, mostly used when embadding the spsat module into an external KS_SEQ_CONTROL
[in,out]ctrlPointer to the KS_SEQ_CONTROL the spsat module will be embedded into. If NULL, it is assumed that the spsat module is indipendet and will use its own internal KS_SEQ_CONTROL.
Return values
STATUSSUCCESS or FAILURE
358  {
359  STATUS status;
360  KS_SEQLOC tmploc = KS_INIT_SEQLOC;
361  int i, j;
362 
363  /* return early if no spsat pulses active */
364  if (spsat_module->state.N_impl_sat_pulses + spsat_module->state.N_expl_sat_pulses == 0) {
365  spsat_module->state.duration = 0;
366  spsat_module->end_time = start_time;
367  return SUCCESS;
368  }
369 
370  tmploc.pos = RUP_GRD(IMax(2, KS_RFSSP_PRETIME + 32, start_time));
371 
372  /* up to 12 selective RF */
373  for (i = 0; i < KSSPSAT_MAXNUMSAT; i++) {
374  if (spsat_module->state.satlocation[i].active == KSSPSAT_OFF) {
375  continue;
376  }
377 
378  /* SelRF */
379  tmploc.board = spsat_module->state.satlocation[i].gradboard;
380  status = ks_pg_selrf(&spsat_module->selrf[i], tmploc, ctrl);
381  KS_RAISE(status);
382 
383  if (spsat_module->state.satlocation[i].active == KSSPSAT_EXPLICIT) {
384  for (j = XGRAD; j<=ZGRAD; ++j) {
385  if (j == spsat_module->state.satlocation[i].gradboard) {
386  continue;
387  }
388  tmploc.board = j;
389  status = ks_pg_trap(&spsat_module->selrf[i].grad, tmploc, ctrl);
390  KS_RAISE(status);
391  }
392  }
393 
394  tmploc.pos += spsat_module->selrf[i].grad.duration;
395 
396  /* Spoiler */
397  for (j = XGRAD; j<=ZGRAD; ++j) {
398  if (j != ZGRAD && !spsat_module->design.spoilallaxes) {
399  continue;
400  }
401  tmploc.board = j;
402  status = ks_pg_trap(&spsat_module->spoiler[i], tmploc, ctrl);
403  KS_RAISE(status);
404  }
405 
406  tmploc.pos += IMax(2, KS_RFSSP_PRETIME + KS_RFSSP_POSTTIME, spsat_module->spoiler[i].duration);
407  }
408 
409  spsat_module->state.duration = tmploc.pos-start_time;
410  spsat_module->end_time = tmploc.pos;
411 #ifdef HOST_TGT
412  ctrl->ssi_time = spsat_module->design.ssi_time;
413  ks_eval_seqctrl_setminduration(ctrl, spsat_module->end_time);
414 #endif
415 
416  return SUCCESS;
417 
418 } /* ksspsat_pg() */
KS_TRAP grad
Definition: KSFoundation.h:1463
KS_SELRF selrf[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:109
Definition: ksspsat.h:31
int pos
Definition: KSFoundation.h:463
int spoilallaxes
Definition: ksspsat.h:87
Definition: ksspsat.h:27
KS_TRAP spoiler[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:110
STATUS ks_pg_selrf(KS_SELRF *selrf, KS_SEQLOC loc, KS_SEQ_CONTROL *ctrl) WARN_UNUSED_RESULT
Places a KS_SELRF sequence object on a gradient (and RF) board at some position in the pulse sequence...
Definition: KSFoundation_common.c:2817
int board
Definition: KSFoundation.h:462
int gradboard
Definition: ksspsat.h:65
KSSPSAT_STATE state
Definition: ksspsat.h:108
KSSPSAT_LOC satlocation[KSSPSAT_MAXNUMSAT]
Definition: ksspsat.h:98
#define KS_RFSSP_POSTTIME
Definition: KSFoundation.h:218
int end_time
Definition: ksspsat.h:111
Definition: ksspsat.h:27
STATUS ks_pg_trap(KS_TRAP *trap, KS_SEQLOC loc, KS_SEQ_CONTROL *ctrl) WARN_UNUSED_RESULT
Places a KS_TRAP sequence object on a board at some position in the pulse sequence
Definition: KSFoundation_common.c:1802
int ssi_time
Definition: ksspsat.h:90
#define KS_RAISE(status)
Definition: KSFoundation.h:190
typedef struct used as argument to ks_pg_*** functions to control where and when to place a sequence ...
Definition: KSFoundation.h:461
int ssi_time
Definition: KSFoundation.h:1226
STATUS ks_eval_seqctrl_setminduration(KS_SEQ_CONTROL *seqctrl, int mindur)
Sets the minimum duration and duration fields of a KS_SEQ_CONTROL struct based on some minimum time (...
Definition: KSFoundation_host.c:4921
int duration
Definition: ksspsat.h:102
int N_expl_sat_pulses
Definition: ksspsat.h:101
KSSPSAT_DESIGN design
Definition: ksspsat.h:107
KSSPSAT_MODE active
Definition: ksspsat.h:66
#define KS_INIT_SEQLOC
Definition: KSFoundation.h:287
int duration
Definition: KSFoundation.h:673
int N_impl_sat_pulses
Definition: ksspsat.h:100
#define KS_RFSSP_PRETIME
Definition: KSFoundation.h:217

◆ ksspsat_scan_seqstate()

void ksspsat_scan_seqstate ( const SCAN_INFO *  slice_pos,
KS_DYNAMIC_STATE *  dynamic,
KSSPSAT_MODULE spsat_module 
)

Change the dynamic state for a spatial sat module

Parameters
[in]slice_posSlice orientation for the current slice
dynamicDynamic parameters, used for updating the sat band locations according to the Mphysical and Mlogical transformations. The former is used for prospective motion correction while the latter is used for, e.g, rotating the blades in a PROPELLER sequence.
[in,out]spsat_modulePointer to the spatial sat module
Returns
void
425  {
426 #ifdef IPG
427  int i, j;
428  float rfphase = 0;
429 
430  if (spsat->state.N_impl_sat_pulses == 0 && spsat->state.N_expl_sat_pulses == 0) {
431  return;
432  }
433 
434  /* Rotation */
435  SCAN_INFO slice_info_updated = slice_info != NULL ? *slice_info : spsat->state.satlocation[0].loc;
436  if (dynamic != NULL) {
437  ks_scan_update_slice_location(&slice_info_updated, slice_info_updated, dynamic->Mphysical, dynamic->Mlogical);
438  }
439  ks_scan_rotate(slice_info_updated);
440 
441  if (spsat->design.rf_spoiling_flag == PSD_ON){
442  rfphase = ks_scan_rf_phase_spoiling(spsat->state.rf_counter);
443  spsat->state.rf_counter++;
444  }
445 
446  for (i = 0; i < KSSPSAT_MAXNUMSAT; i++) {
447  if (spsat->state.satlocation[i].active == KSSPSAT_OFF) { continue; }
448 
449  ks_scan_selrf_setfreqphase(&spsat->selrf[i], 0, spsat->state.satlocation[i].loc, rfphase);
450 
451  if (spsat->state.satlocation[i].active == KSSPSAT_EXPLICIT) {
452  /* rotate manually by scaling the slice selection gradients */
453  float v[] = {0, 0, 1};
454  float w[3];
455  ks_mat3f_apply(w, spsat->state.satlocation[i].loc.oprot, v);
456  ks_mat3f_invapply(v, slice_info_updated.oprot, w);
457  for (j=0; j<3; ++j) {
458  ks_scan_trap_ampscale(&spsat->selrf[i].grad, j, v[j]);
459  }
460  }
461  }
462 #endif
463 }
float ks_scan_rf_phase_spoiling(int counter)
Returns spoiling phase for a given RF counter
Definition: KSFoundation_common.c:4827
Definition: ksspsat.h:31
void ks_scan_trap_ampscale(KS_TRAP *trap, int instanceno, float ampscale)
Updates the amplitude of one or all instances of a KS_TRAP sequence object
Definition: KSFoundation_tgt.c:306
Definition: ksspsat.h:27
void ks_mat3f_invapply(float *w, const KS_MAT3x3f R, const float *v)
Same as ks_mat3f_apply but use transpose of Rotation (R)
Definition: KSFoundation_common.c:4001
void ks_mat3f_apply(float *w, const KS_MAT3x3f R, const float *v)
Rotate a vector with a 3x3 matrix
Definition: KSFoundation_common.c:3987
void ks_scan_selrf_setfreqphase(KS_SELRF *selrf, int instanceno, SCAN_INFO sliceinfo, float rfphase)
Updates the frequency and phase of one or all instances of a slice selective RF pulse (KS_SELRF)...
Definition: KSFoundation_tgt.c:683
Definition: ksspsat.h:27
void ks_scan_rotate(SCAN_INFO slice_pos)
Performs a rotation of the logical system on hardware (WARP)
Definition: KSFoundation_tgt.c:1179
void ks_scan_update_slice_location(SCAN_INFO *new_loc, const SCAN_INFO orig_loc, const KS_MAT4x4 M_physical, const KS_MAT4x4 M_logical)
Updates a SCAN_INFO struct using physical and logical 4x4 transformation matrices
Definition: KSFoundation_common.c:4015

◆ ksspsat_set_design_implicit_from_UI()

void ksspsat_set_design_implicit_from_UI ( KSSPSAT_IMPLICIT_ARRAY  implicit_slthick)

Populate an array of implict sat band's thickness values according to the scanner's UI

Parameters
[out]implicit_slthickArray of implict sat band's thickness values
62  {
63 
64  if ((opsatx == KSSPSAT_POS || opsatx == KSSPSAT_PARA || opsatx == KSSPSAT_HAD) && exist(opdfsathick2) > 0) {
65  implicit_slthick[KSSPSAT_IMPL_FREQ_POS] = opdfsathick2;
66  }
67  if ((opsatx == KSSPSAT_NEG || opsatx == KSSPSAT_PARA || opsatx == KSSPSAT_HAD) && exist(opdfsathick1) > 0) {
68  implicit_slthick[KSSPSAT_IMPL_FREQ_NEG] = opdfsathick1;
69  }
70 
71  if ((opsaty == KSSPSAT_POS || opsaty == KSSPSAT_PARA || opsaty == KSSPSAT_HAD) && exist(opdfsathick4) > 0) {
72  implicit_slthick[KSSPSAT_IMPL_PHASE_POS] = opdfsathick4;
73  }
74  if ((opsaty == KSSPSAT_NEG || opsaty == KSSPSAT_PARA || opsaty == KSSPSAT_HAD) && exist(opdfsathick3) > 0) {
75  implicit_slthick[KSSPSAT_IMPL_PHASE_NEG] = opdfsathick3;
76  }
77 
78  if ((opsatz == KSSPSAT_POS || opsatz == KSSPSAT_PARA || opsatz == KSSPSAT_HAD) && exist(opdfsathick6) > 0) {
79  implicit_slthick[KSSPSAT_IMPL_SLICE_POS] = opdfsathick6;
80  }
81  if ((opsatz == KSSPSAT_NEG || opsatz == KSSPSAT_PARA || opsatz == KSSPSAT_HAD) && exist(opdfsathick5) > 0) {
82  implicit_slthick[KSSPSAT_IMPL_SLICE_NEG] = opdfsathick5;
83  }
84 
85 } /* ksspsat_set_design_implicit_from_UI() */
Definition: ksspsat.h:36
Definition: ksspsat.h:31
Definition: ksspsat.h:36
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:31
Definition: ksspsat.h:36
Definition: ksspsat.h:36

◆ ksspsat_set_design_explicit_from_UI()

STATUS ksspsat_set_design_explicit_from_UI ( KSSPSAT_LOC explicit_locs)

Populate an array of explicit sat band locations according to the scanner's UI

Parameters
[out]explicit_locsArray of explicit sat band locations
Return values
STATUSSUCCESS or FAILURE
98  {
99  if (!explicit_locs) {
100  KS_THROW("null input");
101  }
102 
103  int i = 0;
104  int exsat_mask = 1;
105  for (; i < KSSPSAT_MAXNUMSAT_EXPLICIT; ++i, exsat_mask = exsat_mask << 1) {
106  if (!(opexsatmask & exsat_mask)) {
107  continue;
108  }
109 
110  explicit_locs[i].active = KSSPSAT_EXPLICIT;
111  explicit_locs[i].gradboard = ZGRAD;
112 
113  /* Copy the rotation matrix */
114  explicit_locs[i].loc.oprot[0] = eg_sat_rot[i][0];
115  explicit_locs[i].loc.oprot[1] = eg_sat_rot[i][3];
116  explicit_locs[i].loc.oprot[2] = eg_sat_rot[i][6];
117  explicit_locs[i].loc.oprot[3] = eg_sat_rot[i][1];
118  explicit_locs[i].loc.oprot[4] = eg_sat_rot[i][4];
119  explicit_locs[i].loc.oprot[5] = eg_sat_rot[i][7];
120  explicit_locs[i].loc.oprot[6] = eg_sat_rot[i][2];
121  explicit_locs[i].loc.oprot[7] = eg_sat_rot[i][5];
122  explicit_locs[i].loc.oprot[8] = eg_sat_rot[i][8];
123  }
124 
125  explicit_locs[0].thickness = opexsathick1;
126  explicit_locs[0].loc.optloc = opexsatloc1;
127  explicit_locs[1].thickness = opexsathick2;
128  explicit_locs[1].loc.optloc = opexsatloc2;
129  explicit_locs[2].thickness = opexsathick3;
130  explicit_locs[2].loc.optloc = opexsatloc3;
131  explicit_locs[3].thickness = opexsathick4;
132  explicit_locs[3].loc.optloc = opexsatloc4;
133  explicit_locs[4].thickness = opexsathick5;
134  explicit_locs[4].loc.optloc = opexsatloc5;
135  explicit_locs[5].thickness = opexsathick6;
136  explicit_locs[5].loc.optloc = opexsatloc6;
137 
138  return SUCCESS;
139 
140 } /* ksspsat_set_design_explicit_from_UI() */
#define KSSPSAT_MAXNUMSAT_EXPLICIT
Definition: ksspsat.h:33
int gradboard
Definition: ksspsat.h:65
Definition: ksspsat.h:27
KSSPSAT_MODE active
Definition: ksspsat.h:66
#define KS_THROW(format,...)
Definition: KSFoundation.h:181
SCAN_INFO loc
Definition: ksspsat.h:63
float thickness
Definition: ksspsat.h:64

◆ ksspsat_set_design_from_UI()

STATUS ksspsat_set_design_from_UI ( KSSPSAT_DESIGN spsat_design)

Set the design values of a spatial sat module according to the scanner's UI

Parameters
[out]spsat_designPointer to a spatial sat's design
Return values
STATUSSUCCESS or FAILURE
153  {
154  STATUS status;
155 
156  ksspsat_init_design(spsat_design, "SpSat");
157 
159 
160  status = ksspsat_set_design_explicit_from_UI(spsat_design->explicit_locs);
161  KS_RAISE(status);
162 
163  int initnewgeo = 1;
164  status = obloptimize_epi(&spsat_design->loggrad, &phygrd, scan_info, 1, spsat_design->oblmethod, exist(opcoax), PSD_ON, 0, &initnewgeo, cfsrmode);
165  KS_RAISE(status);
166 
167  return SUCCESS;
168 
169 } /* ksspsat_set_design_from_UI() */
void ksspsat_init_design(KSSPSAT_DESIGN *spsat_design, const char *desc)
Initialize the design for a spatial sat module
Definition: ksspsat.cc:31
LOG_GRAD loggrad
Definition: ksspsat.h:91
STATUS ksspsat_set_design_explicit_from_UI(KSSPSAT_LOC *explicit_locs)
Populate an array of explicit sat band locations according to the scanner&#39;s UI
Definition: ksspsat.e:98
PHYS_GRAD phygrd
STATUS obloptimize_epi(LOG_GRAD *lgrad, PHYS_GRAD *pgrad, SCAN_INFO *scaninfotab, INT slquant, INT plane_type, INT coaxial, INT method, INT debug, INT *newgeo, INT srmode)
SCAN_INFO scan_info[]
int oblmethod
Definition: ksspsat.h:89
void ksspsat_set_design_implicit_from_UI(KSSPSAT_IMPLICIT_ARRAY implicit_slthick)
Populate an array of implict sat band&#39;s thickness values according to the scanner&#39;s UI...
Definition: ksspsat.e:62
#define KS_RAISE(status)
Definition: KSFoundation.h:190
KSSPSAT_IMPLICIT_ARRAY implicit_slthick
Definition: ksspsat.h:80
KSSPSAT_LOC explicit_locs[KSSPSAT_MAXNUMSAT_EXPLICIT]
Definition: ksspsat.h:82
int cfsrmode

Variable Documentation

◆ scan_info

SCAN_INFO scan_info[]

◆ ksspsat