MRI
fpc.mri
mri.py - magnetic resonance imaging signal physics.
MRI contrast comes from how fast hydrogen nuclei (protons) recover after an RF pulse: T1 is longitudinal recovery, T2 is transverse decay. By choosing the repetition time (TR) and echo time (TE) the operator decides which of these differences dominates the image - T1-weighted, T2-weighted, or proton-density (PD) weighted. These methods let you compute that contrast instead of just memorizing "fat is bright on T1".
MRI
MRI precession, relaxation, and spin-echo contrast calculations.
Source code in fpc/mri.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
larmor_frequency(*, field_strength_t, nucleus='1H')
Precession (Larmor) frequency f = gamma_bar * B0.
The RF coil must transmit and receive at exactly this frequency; the scanner's gradients make it vary with position, which is how MRI knows WHERE the signal came from.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field_strength_t
|
main magnetic field B0 [T] |
required | |
nucleus
|
key of :attr: |
'1H'
|
Returns:
| Type | Description |
|---|---|
|
frequency [MHz] (1H at 1.5 T -> ~63.9 MHz) |
Source code in fpc/mri.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
t1_recovery(*, time_ms, t1_ms, equilibrium_magnetization=1.0)
Longitudinal recovery after a 90 deg pulse: Mz = M0 * (1 - exp(-t/T1)).
After one T1, magnetization is back to ~63% of equilibrium.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_ms
|
time since the 90 deg pulse [ms] |
required | |
t1_ms
|
tissue T1 [ms] |
required | |
equilibrium_magnetization
|
M0 (defaults to 1, i.e. a fraction) |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Mz, same unit as M0 |
Source code in fpc/mri.py
57 58 59 60 61 62 63 64 65 66 67 | |
t2_decay(*, time_ms, t2_ms, initial_magnetization=1.0)
Transverse decay: Mxy = M0 * exp(-t/T2).
After one T2, only ~37% of the transverse signal remains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_ms
|
time since excitation [ms] |
required | |
t2_ms
|
tissue T2 [ms] |
required | |
initial_magnetization
|
Mxy at t = 0 (defaults to 1) |
1.0
|
Returns:
| Type | Description |
|---|---|
|
Mxy, same unit as the initial magnetization |
Source code in fpc/mri.py
69 70 71 72 73 74 75 76 77 78 79 | |
spin_echo_signal(*, repetition_time_ms, echo_time_ms, t1_ms=None, t2_ms=None, proton_density=1.0, tissue=None)
Relative spin-echo signal S = PD * (1 - exp(-TR/T1)) * exp(-TE/T2).
TR controls how much T1 recovery happens between pulses; TE controls
how much T2 decay happens before the echo is read. Pass explicit
T1/T2/PD, or a tissue name from :attr:TISSUE_PROPERTIES_1_5T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repetition_time_ms
|
TR [ms] |
required | |
echo_time_ms
|
TE [ms] |
required | |
t1_ms
|
tissue T1 [ms] |
None
|
|
t2_ms
|
tissue T2 [ms] |
None
|
|
proton_density
|
relative proton density [-] |
1.0
|
|
tissue
|
optional tissue name that supplies T1, T2, and PD |
None
|
Returns:
| Type | Description |
|---|---|
|
relative signal intensity [-] |
Source code in fpc/mri.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
sequence_weighting(*, repetition_time_ms, echo_time_ms)
Classify a spin-echo TR/TE pair as T1-, T2-, or PD-weighted.
Rule of thumb at 1.5 T: short TR (< 800 ms) + short TE (< 30 ms) -> T1-weighted long TR (> 2000 ms) + long TE (> 80 ms) -> T2-weighted long TR + short TE -> PD-weighted
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repetition_time_ms
|
TR [ms] |
required | |
echo_time_ms
|
TE [ms] |
required |
Returns:
| Type | Description |
|---|---|
|
"T1-weighted", "T2-weighted", "PD-weighted", or "mixed" |
Source code in fpc/mri.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |