Skip to content

Commit

Permalink
traj/seq: use indices_from_position in traj-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mackner authored and uecker committed Dec 7, 2024
1 parent 78028bb commit bad3a59
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/noncart/traj.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,26 @@ void calc_base_angles(double base_angle[DIMS], int Y, int E, struct traj_conf co
}



void indices_from_position(long ind[DIMS], const long pos[DIMS], struct traj_conf conf, long start_pos_GA)
{
ind[PHS2_DIM] = pos[PHS2_DIM];
ind[SLICE_DIM] = pos[SLICE_DIM];
ind[TE_DIM] = pos[TE_DIM];
ind[TIME_DIM] = pos[TIME_DIM];

if (conf.rational)
return;

if (conf.turns > 1)
ind[TIME_DIM] = pos[TIME_DIM] % conf.turns;

if (conf.golden && conf.aligned)
ind[TIME_DIM] = start_pos_GA + pos[TIME_DIM];
}



// z-Undersampling
bool zpartition_skip(long partitions, long z_usamp[2], long partition, long frame)
{
Expand Down
1 change: 1 addition & 0 deletions src/noncart/traj.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern const struct traj_conf rmfreq_defaults;
extern void euler(float dir[3], float phi, float psi);
extern void gradient_delay(float d[3], float coeff[2][3], float phi, float psi);
extern void calc_base_angles(double base_angle[DIMS], int Y, int E, struct traj_conf conf);
extern void indices_from_position(long ind[DIMS], const long pos[DIMS], struct traj_conf conf, long start_pos_GA);
extern bool zpartition_skip(long partitions, long z_usamp[2], long partition, long frame);
extern int gen_fibonacci(int n, int ind);
extern int recover_gen_fib_ind(int Y, int inc);
Expand Down
5 changes: 4 additions & 1 deletion src/traj.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,11 @@ int main_traj(int argc, char* argv[argc])

double angle = 0.;

long ind[DIMS] = { 0L };
indices_from_position(ind, pos, conf, 0);

for (int d = 1; d < DIMS; d++)
angle += (double)pos[d] * base_angle[d];
angle += (double)ind[d] * base_angle[d];


if (conf.half_circle_gold)
Expand Down

0 comments on commit bad3a59

Please sign in to comment.