IR_block.py 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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 LF_scanner.pypulseq.make_sinc_pulse import make_sinc_pulse
  12. from LF_scanner.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) # TODO add to GUI
  18. rf_ir, gz_ir, _ = make_sinc_pulse(flip_angle=flip_ir, system=scanner_parameters, duration=params['t_ref'],
  19. slice_thickness=params['sl_thkn'], apodization=0.5,
  20. time_bw_product=round(params['t_BW_product_ref'], 8), phase_offset=90 * pi / 180,
  21. return_gz=True)
  22. delay_IR = np.ceil(params['TI'] / scanner_parameters.grad_raster_time) * scanner_parameters.grad_raster_time
  23. delay_IR = make_delay(delay_IR)
  24. return rf_ir, gz_ir, delay_IR