IR_block.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. A subroutine to add IR block.
  4. Requires the params structure as input.
  5. Need to think of the reequired output (pulse sequence variable itself?)
  6. @author: petrm
  7. """
  8. #imports
  9. from math import pi
  10. import numpy as np
  11. from MRI_sequences.pypulseq.make_sinc_pulse import make_sinc_pulse
  12. from MRI_sequences.pypulseq.make_delay import make_delay
  13. def IR_block(params, scanner_parameters):
  14. #function creates inversion recovery block with delay
  15. #params['IR_time'] = 0.140 # STIR # TODO add to GUI
  16. #params['IR_time'] = 2.250 # FLAIR # TODO add to GUI
  17. flip_ir = round(180 * pi / 180, 3) # TODO add to GUI
  18. rf_ir, gz_ir, _ = make_sinc_pulse(flip_angle=flip_ir,
  19. system=scanner_parameters,
  20. duration=params['t_inv'],
  21. slice_thickness=params['sl_thkn'],
  22. apodization=0.5,
  23. time_bw_product=round(params['t_BW_product_inv'], 8),
  24. phase_offset=90 * pi / 180,
  25. return_gz=True)
  26. delay_IR = np.ceil(params['TI'] / scanner_parameters.grad_raster_time) \
  27. * scanner_parameters.grad_raster_time
  28. delay_IR = make_delay(delay_IR)
  29. return rf_ir, gz_ir, delay_IR