mrzerocore 0.2.12__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/.gitignore +0 -1
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/CHANGELOG.md +10 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/Cargo.lock +91 -69
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/Cargo.toml +3 -3
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/PKG-INFO +9 -9
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/phantom.md +2 -0
- MRzeroCore-0.3.0/documentation/playground/generated/seqs/FLASH.ipynb +1 -0
- MRzeroCore-0.3.0/documentation/playground/quantified_brain.npz +0 -0
- MRzeroCore-0.3.0/documentation/playground/templates/generate.py +82 -0
- MRzeroCore-0.3.0/documentation/playground/templates/seqs.ipynb +119 -0
- MRzeroCore-0.3.0/documentation/playground/templates/template_A.ipynb +396 -0
- MRzeroCore-0.3.0/documentation/playground_mr0/flash.ipynb +292 -0
- MRzeroCore-0.3.0/documentation/playground_mr0/mr0_DWI_GRE_2D_seq.ipynb +417 -0
- MRzeroCore-0.3.0/documentation/playground_mr0/mr0_bSSFP_2D_seq.ipynb +1 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/pyproject.toml +1 -1
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/__init__.py +8 -5
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/brainweb/__init__.py +5 -5
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/custom_voxel_phantom.py +4 -3
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/sim_data.py +11 -2
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/voxel_grid_phantom.py +63 -41
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/sequence.py +1 -1
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/simulation/isochromat_sim.py +37 -13
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/simulation/main_pass.py +68 -18
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/simulation/pre_pass.py +10 -1
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/util.py +30 -2
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/src/lib.rs +4 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/src/pre_pass.rs +8 -2
- MRzeroCore-0.2.12/documentation/playground_mr0/flash.ipynb +0 -187
- MRzeroCore-0.2.12/documentation/playground_mr0/mr0_DWI_GRE_2D_seq.ipynb +0 -1
- MRzeroCore-0.2.12/documentation/playground_mr0/mr0_bSSFP_2D_seq.ipynb +0 -1
- MRzeroCore-0.2.12/documentation/resources/logo.blend +0 -0
- MRzeroCore-0.2.12/documentation/resources/logo.png +0 -0
- MRzeroCore-0.2.12/documentation/resources/studio_small_09_2k.hdr +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/.github/workflows/pypi_publish.yml +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/.readthedocs.yaml +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/EULA.txt +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/LICENSE +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/README.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/_config.yml +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/_toc.yml +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/reco.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/sequence.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/simulation/isochromat_sim.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/simulation/pdg_sim.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/simulation.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api/util.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/api.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/intro.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/logo.png +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/phantom_generation.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/AdjDataUser2gB0_transversal_0.08moving_average.mat +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/flash_DWI.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr00_FLASH_2D_ernstAngle_opt.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_CS_cartesian_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_CS_radial_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_DREAM_STE_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_DREAM_STID_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_EPI_2D_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_FID_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_FLASH_2D_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_GRE_to_FLASH.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_RARE_2D_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_SE_CPMG_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_STE_3pulses_5echoes_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_burst_TSE.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_opt_FLASH_2D_IR_Fit_T1.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_opt_FLASH_2D_IR_voxelNN_T1.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_pypulseq_exmpls_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/mr0_upload_seq.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/numerical_brain_cropped.mat +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/overview.md +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/ptx_phantom.p +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/pulseq_flash.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/pulseq_rf_shim.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/pulseq_sim_pTx.ipynb +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/seqs/flash pTx CP.seq +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/seqs/flash pTx EP.seq +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/seqs/flash pTx QM.seq +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/playground_mr0/subject05.npz +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/documentation/requirements.txt +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/brainweb/brainweb_data.json +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/brainweb/brainweb_data_sources.txt +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/phantom/brainweb/output/.gitkeep +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/exporter.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/exporter_v2.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/helpers.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_exporter.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/__init__.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/adc.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/helpers.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulse.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/__init__.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/adc.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/block.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/definitons.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/gradient.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/helpers.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/rf.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/pulseq_file/trap.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/pulseq/pulseq_loader/spoiler.py +0 -0
- {MRzeroCore-0.2.12 → MRzeroCore-0.3.0}/python/MRzeroCore/reconstruction.py +0 -0
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
- 0.3.0
|
|
2
|
+
- Bugfixes (seq.get_contrast(), pTx shim phase, pytorch deprecation warnings, > 360° pulses, pulseq plot, missing 2pi in diffusion, phantom plot titles)
|
|
3
|
+
- WIP rigid phantom motion simulation - not yet documented and subject to change
|
|
4
|
+
- Added option to return transversal magnetization from simulation
|
|
5
|
+
- New imshow() function in util.py for consistent plotting
|
|
6
|
+
- Some fixes to playground sequences - bigger overhaul coming soon
|
|
7
|
+
- Allow loading B0 / B1 in new VoxelGridPhantom.load() function
|
|
8
|
+
- Introduced quantified brain
|
|
9
|
+
- Performance improvement - only calculate signal for measured ADC samples
|
|
10
|
+
- Added latent_signal_unormalized to prepass graph for vizualisation
|
|
1
11
|
- 0.2.12
|
|
2
12
|
- Fixed Brainweb phantom loading and generation
|
|
3
13
|
- Switched pre-pass kt precision from f32 to f64
|
|
@@ -4,15 +4,15 @@ version = 3
|
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "autocfg"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.3.0"
|
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
-
checksum = "
|
|
9
|
+
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
|
10
10
|
|
|
11
11
|
[[package]]
|
|
12
12
|
name = "bitflags"
|
|
13
|
-
version = "
|
|
13
|
+
version = "2.5.0"
|
|
14
14
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
-
checksum = "
|
|
15
|
+
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
|
16
16
|
|
|
17
17
|
[[package]]
|
|
18
18
|
name = "cfg-if"
|
|
@@ -20,23 +20,29 @@ version = "1.0.0"
|
|
|
20
20
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
21
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
22
22
|
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "heck"
|
|
25
|
+
version = "0.4.1"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
28
|
+
|
|
23
29
|
[[package]]
|
|
24
30
|
name = "indoc"
|
|
25
|
-
version = "
|
|
31
|
+
version = "2.0.5"
|
|
26
32
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
-
checksum = "
|
|
33
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
|
28
34
|
|
|
29
35
|
[[package]]
|
|
30
36
|
name = "libc"
|
|
31
|
-
version = "0.2.
|
|
37
|
+
version = "0.2.155"
|
|
32
38
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
-
checksum = "
|
|
39
|
+
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
|
34
40
|
|
|
35
41
|
[[package]]
|
|
36
42
|
name = "lock_api"
|
|
37
|
-
version = "0.4.
|
|
43
|
+
version = "0.4.12"
|
|
38
44
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
39
|
-
checksum = "
|
|
45
|
+
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
|
40
46
|
dependencies = [
|
|
41
47
|
"autocfg",
|
|
42
48
|
"scopeguard",
|
|
@@ -44,16 +50,16 @@ dependencies = [
|
|
|
44
50
|
|
|
45
51
|
[[package]]
|
|
46
52
|
name = "memoffset"
|
|
47
|
-
version = "0.
|
|
53
|
+
version = "0.9.1"
|
|
48
54
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
-
checksum = "
|
|
55
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
50
56
|
dependencies = [
|
|
51
57
|
"autocfg",
|
|
52
58
|
]
|
|
53
59
|
|
|
54
60
|
[[package]]
|
|
55
61
|
name = "mrzero_core"
|
|
56
|
-
version = "0.
|
|
62
|
+
version = "0.3.0"
|
|
57
63
|
dependencies = [
|
|
58
64
|
"num-complex",
|
|
59
65
|
"pyo3",
|
|
@@ -61,33 +67,33 @@ dependencies = [
|
|
|
61
67
|
|
|
62
68
|
[[package]]
|
|
63
69
|
name = "num-complex"
|
|
64
|
-
version = "0.4.
|
|
70
|
+
version = "0.4.6"
|
|
65
71
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
-
checksum = "
|
|
72
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
67
73
|
dependencies = [
|
|
68
74
|
"num-traits",
|
|
69
75
|
]
|
|
70
76
|
|
|
71
77
|
[[package]]
|
|
72
78
|
name = "num-traits"
|
|
73
|
-
version = "0.2.
|
|
79
|
+
version = "0.2.19"
|
|
74
80
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
-
checksum = "
|
|
81
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
76
82
|
dependencies = [
|
|
77
83
|
"autocfg",
|
|
78
84
|
]
|
|
79
85
|
|
|
80
86
|
[[package]]
|
|
81
87
|
name = "once_cell"
|
|
82
|
-
version = "1.
|
|
88
|
+
version = "1.19.0"
|
|
83
89
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
84
|
-
checksum = "
|
|
90
|
+
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|
85
91
|
|
|
86
92
|
[[package]]
|
|
87
93
|
name = "parking_lot"
|
|
88
|
-
version = "0.12.
|
|
94
|
+
version = "0.12.2"
|
|
89
95
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
-
checksum = "
|
|
96
|
+
checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
|
|
91
97
|
dependencies = [
|
|
92
98
|
"lock_api",
|
|
93
99
|
"parking_lot_core",
|
|
@@ -95,31 +101,37 @@ dependencies = [
|
|
|
95
101
|
|
|
96
102
|
[[package]]
|
|
97
103
|
name = "parking_lot_core"
|
|
98
|
-
version = "0.9.
|
|
104
|
+
version = "0.9.10"
|
|
99
105
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
-
checksum = "
|
|
106
|
+
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
|
101
107
|
dependencies = [
|
|
102
108
|
"cfg-if",
|
|
103
109
|
"libc",
|
|
104
110
|
"redox_syscall",
|
|
105
111
|
"smallvec",
|
|
106
|
-
"windows-
|
|
112
|
+
"windows-targets",
|
|
107
113
|
]
|
|
108
114
|
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "portable-atomic"
|
|
117
|
+
version = "1.6.0"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
|
|
120
|
+
|
|
109
121
|
[[package]]
|
|
110
122
|
name = "proc-macro2"
|
|
111
|
-
version = "1.0.
|
|
123
|
+
version = "1.0.83"
|
|
112
124
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
|
-
checksum = "
|
|
125
|
+
checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
|
|
114
126
|
dependencies = [
|
|
115
127
|
"unicode-ident",
|
|
116
128
|
]
|
|
117
129
|
|
|
118
130
|
[[package]]
|
|
119
131
|
name = "pyo3"
|
|
120
|
-
version = "0.
|
|
132
|
+
version = "0.21.2"
|
|
121
133
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
-
checksum = "
|
|
134
|
+
checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
|
|
123
135
|
dependencies = [
|
|
124
136
|
"cfg-if",
|
|
125
137
|
"indoc",
|
|
@@ -127,6 +139,7 @@ dependencies = [
|
|
|
127
139
|
"memoffset",
|
|
128
140
|
"num-complex",
|
|
129
141
|
"parking_lot",
|
|
142
|
+
"portable-atomic",
|
|
130
143
|
"pyo3-build-config",
|
|
131
144
|
"pyo3-ffi",
|
|
132
145
|
"pyo3-macros",
|
|
@@ -135,9 +148,9 @@ dependencies = [
|
|
|
135
148
|
|
|
136
149
|
[[package]]
|
|
137
150
|
name = "pyo3-build-config"
|
|
138
|
-
version = "0.
|
|
151
|
+
version = "0.21.2"
|
|
139
152
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
140
|
-
checksum = "
|
|
153
|
+
checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
|
|
141
154
|
dependencies = [
|
|
142
155
|
"once_cell",
|
|
143
156
|
"target-lexicon",
|
|
@@ -145,9 +158,9 @@ dependencies = [
|
|
|
145
158
|
|
|
146
159
|
[[package]]
|
|
147
160
|
name = "pyo3-ffi"
|
|
148
|
-
version = "0.
|
|
161
|
+
version = "0.21.2"
|
|
149
162
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
-
checksum = "
|
|
163
|
+
checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
|
|
151
164
|
dependencies = [
|
|
152
165
|
"libc",
|
|
153
166
|
"pyo3-build-config",
|
|
@@ -155,9 +168,9 @@ dependencies = [
|
|
|
155
168
|
|
|
156
169
|
[[package]]
|
|
157
170
|
name = "pyo3-macros"
|
|
158
|
-
version = "0.
|
|
171
|
+
version = "0.21.2"
|
|
159
172
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
160
|
-
checksum = "
|
|
173
|
+
checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
|
|
161
174
|
dependencies = [
|
|
162
175
|
"proc-macro2",
|
|
163
176
|
"pyo3-macros-backend",
|
|
@@ -167,50 +180,52 @@ dependencies = [
|
|
|
167
180
|
|
|
168
181
|
[[package]]
|
|
169
182
|
name = "pyo3-macros-backend"
|
|
170
|
-
version = "0.
|
|
183
|
+
version = "0.21.2"
|
|
171
184
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
-
checksum = "
|
|
185
|
+
checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
|
|
173
186
|
dependencies = [
|
|
187
|
+
"heck",
|
|
174
188
|
"proc-macro2",
|
|
189
|
+
"pyo3-build-config",
|
|
175
190
|
"quote",
|
|
176
191
|
"syn",
|
|
177
192
|
]
|
|
178
193
|
|
|
179
194
|
[[package]]
|
|
180
195
|
name = "quote"
|
|
181
|
-
version = "1.0.
|
|
196
|
+
version = "1.0.36"
|
|
182
197
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
183
|
-
checksum = "
|
|
198
|
+
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
|
184
199
|
dependencies = [
|
|
185
200
|
"proc-macro2",
|
|
186
201
|
]
|
|
187
202
|
|
|
188
203
|
[[package]]
|
|
189
204
|
name = "redox_syscall"
|
|
190
|
-
version = "0.
|
|
205
|
+
version = "0.5.1"
|
|
191
206
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
192
|
-
checksum = "
|
|
207
|
+
checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
|
|
193
208
|
dependencies = [
|
|
194
209
|
"bitflags",
|
|
195
210
|
]
|
|
196
211
|
|
|
197
212
|
[[package]]
|
|
198
213
|
name = "scopeguard"
|
|
199
|
-
version = "1.
|
|
214
|
+
version = "1.2.0"
|
|
200
215
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
-
checksum = "
|
|
216
|
+
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|
202
217
|
|
|
203
218
|
[[package]]
|
|
204
219
|
name = "smallvec"
|
|
205
|
-
version = "1.
|
|
220
|
+
version = "1.13.2"
|
|
206
221
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
-
checksum = "
|
|
222
|
+
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|
208
223
|
|
|
209
224
|
[[package]]
|
|
210
225
|
name = "syn"
|
|
211
|
-
version = "
|
|
226
|
+
version = "2.0.65"
|
|
212
227
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
213
|
-
checksum = "
|
|
228
|
+
checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106"
|
|
214
229
|
dependencies = [
|
|
215
230
|
"proc-macro2",
|
|
216
231
|
"quote",
|
|
@@ -219,31 +234,32 @@ dependencies = [
|
|
|
219
234
|
|
|
220
235
|
[[package]]
|
|
221
236
|
name = "target-lexicon"
|
|
222
|
-
version = "0.12.
|
|
237
|
+
version = "0.12.14"
|
|
223
238
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
-
checksum = "
|
|
239
|
+
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
|
|
225
240
|
|
|
226
241
|
[[package]]
|
|
227
242
|
name = "unicode-ident"
|
|
228
|
-
version = "1.0.
|
|
243
|
+
version = "1.0.12"
|
|
229
244
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
230
|
-
checksum = "
|
|
245
|
+
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|
231
246
|
|
|
232
247
|
[[package]]
|
|
233
248
|
name = "unindent"
|
|
234
|
-
version = "0.
|
|
249
|
+
version = "0.2.3"
|
|
235
250
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
236
|
-
checksum = "
|
|
251
|
+
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
|
237
252
|
|
|
238
253
|
[[package]]
|
|
239
|
-
name = "windows-
|
|
240
|
-
version = "0.
|
|
254
|
+
name = "windows-targets"
|
|
255
|
+
version = "0.52.5"
|
|
241
256
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
242
|
-
checksum = "
|
|
257
|
+
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
|
243
258
|
dependencies = [
|
|
244
259
|
"windows_aarch64_gnullvm",
|
|
245
260
|
"windows_aarch64_msvc",
|
|
246
261
|
"windows_i686_gnu",
|
|
262
|
+
"windows_i686_gnullvm",
|
|
247
263
|
"windows_i686_msvc",
|
|
248
264
|
"windows_x86_64_gnu",
|
|
249
265
|
"windows_x86_64_gnullvm",
|
|
@@ -252,42 +268,48 @@ dependencies = [
|
|
|
252
268
|
|
|
253
269
|
[[package]]
|
|
254
270
|
name = "windows_aarch64_gnullvm"
|
|
255
|
-
version = "0.
|
|
271
|
+
version = "0.52.5"
|
|
256
272
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
-
checksum = "
|
|
273
|
+
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
|
258
274
|
|
|
259
275
|
[[package]]
|
|
260
276
|
name = "windows_aarch64_msvc"
|
|
261
|
-
version = "0.
|
|
277
|
+
version = "0.52.5"
|
|
262
278
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
-
checksum = "
|
|
279
|
+
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
|
264
280
|
|
|
265
281
|
[[package]]
|
|
266
282
|
name = "windows_i686_gnu"
|
|
267
|
-
version = "0.
|
|
283
|
+
version = "0.52.5"
|
|
284
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
285
|
+
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
|
286
|
+
|
|
287
|
+
[[package]]
|
|
288
|
+
name = "windows_i686_gnullvm"
|
|
289
|
+
version = "0.52.5"
|
|
268
290
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
269
|
-
checksum = "
|
|
291
|
+
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
|
270
292
|
|
|
271
293
|
[[package]]
|
|
272
294
|
name = "windows_i686_msvc"
|
|
273
|
-
version = "0.
|
|
295
|
+
version = "0.52.5"
|
|
274
296
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
275
|
-
checksum = "
|
|
297
|
+
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
|
276
298
|
|
|
277
299
|
[[package]]
|
|
278
300
|
name = "windows_x86_64_gnu"
|
|
279
|
-
version = "0.
|
|
301
|
+
version = "0.52.5"
|
|
280
302
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
281
|
-
checksum = "
|
|
303
|
+
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
|
282
304
|
|
|
283
305
|
[[package]]
|
|
284
306
|
name = "windows_x86_64_gnullvm"
|
|
285
|
-
version = "0.
|
|
307
|
+
version = "0.52.5"
|
|
286
308
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
287
|
-
checksum = "
|
|
309
|
+
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
|
288
310
|
|
|
289
311
|
[[package]]
|
|
290
312
|
name = "windows_x86_64_msvc"
|
|
291
|
-
version = "0.
|
|
313
|
+
version = "0.52.5"
|
|
292
314
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
293
|
-
checksum = "
|
|
315
|
+
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "mrzero_core"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
@@ -8,5 +8,5 @@ edition = "2021"
|
|
|
8
8
|
crate-type = ["cdylib"]
|
|
9
9
|
|
|
10
10
|
[dependencies]
|
|
11
|
-
pyo3 = { version = "0.
|
|
12
|
-
num-complex = "0.4.
|
|
11
|
+
pyo3 = { version = "0.21.2", features = ["abi3-py37", "extension-module", "num-complex"] }
|
|
12
|
+
num-complex = "0.4.6"
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: MRzeroCore
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
7
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
8
|
-
Requires-Dist: torch>=1.12
|
|
8
|
+
Requires-Dist: torch >=1.12
|
|
9
9
|
Requires-Dist: pypulseq
|
|
10
|
-
Requires-Dist: matplotlib>=3.5
|
|
11
|
-
Requires-Dist: scipy>=1.7
|
|
12
|
-
Requires-Dist: requests>=2.20
|
|
10
|
+
Requires-Dist: matplotlib >=3.5
|
|
11
|
+
Requires-Dist: scipy >=1.7
|
|
12
|
+
Requires-Dist: requests >=2.20
|
|
13
13
|
Requires-Dist: scikit-image
|
|
14
14
|
Requires-Dist: torchkbnufft
|
|
15
|
-
Requires-Dist: pydisseqt>=0.1.4
|
|
15
|
+
Requires-Dist: pydisseqt >=0.1.4
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Summary: Core functionality of MRzero
|
|
18
18
|
Author-email: Jonathan Endres <jonathan.endres@uk-erlangen.de>
|
|
19
19
|
Requires-Python: >=3.9
|
|
20
20
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
21
|
-
Project-URL: MRzero-Paper, https://arxiv.org/abs/2002.04265
|
|
22
|
-
Project-URL: Documentation, https://mrzero-core.readthedocs.io/
|
|
23
21
|
Project-URL: Repository, https://github.com/MRsources/MRzero-Core
|
|
22
|
+
Project-URL: Documentation, https://mrzero-core.readthedocs.io/
|
|
23
|
+
Project-URL: MRzero-Paper, https://arxiv.org/abs/2002.04265
|
|
24
24
|
|
|
25
25
|
[](https://mrzero-core.readthedocs.io/en/latest/?badge=latest)
|
|
26
26
|
|
|
@@ -59,6 +59,8 @@ When converting to {class}`SimData`, voxels are sinc-shaped by default in order
|
|
|
59
59
|
|
|
60
60
|
Analytical phantom for experimentation. There is no resolution or grid, voxels can be placed anywhere and have any size or shape. Useful for testing reconstruction, sub-voxel positioning etc.
|
|
61
61
|
|
|
62
|
+
The `size` of this phantom is computed from the extends of the voxel positions.
|
|
63
|
+
|
|
62
64
|
:::{note}
|
|
63
65
|
Because of how the voxel k-space responce is implemented currently, all voxels are limited to have the same shape and size. This limitation could be lifted in the future, if required.
|
|
64
66
|
:::
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"cells": [{"cell_type": "markdown", "metadata": {"id": "ZUXedN4MhMJK"}, "source": [""]}, {"cell_type": "markdown", "metadata": {"id": "8TMFbWzzYav1"}, "source": ["# **FID: free induction decay**\n", "In this script a sequence and a phantom are set-up to simulate the measurement of the free induction decay signal.\n", "\n", "References:\n", "1. https://mriquestions.com/free-induction-decay.html, last access: 16-05-2024\n", "\n"]}, {"cell_type": "markdown", "metadata": {"id": "qePtXYPgYWrd"}, "source": ["## 1. Library installation and download of phantom"]}, {"cell_type": "code", "execution_count": null, "metadata": {"execution": {"iopub.execute_input": "2024-05-20T16:07:40.095400Z", "iopub.status.busy": "2024-05-20T16:07:40.094980Z", "iopub.status.idle": "2024-05-20T16:08:56.887833Z", "shell.execute_reply": "2024-05-20T16:08:56.887087Z"}, "id": "TuPWGS5NYM-b", "tags": ["hide-cell"]}, "outputs": [], "source": ["!pip install pypulseq==1.3.1.post1 &> /dev/null\n", "!pip install MRzeroCore &> /dev/null\n", "!wget https://github.com/MRsources/MRzero-Core/raw/main/documentation/playground_mr0/numerical_brain_cropped.mat &> /dev/null"]}, {"cell_type": "markdown", "metadata": {"id": "pdWiq2pyYM-e"}, "source": ["## 2. Library import and setup"]}, {"cell_type": "code", "execution_count": null, "metadata": {"execution": {"iopub.execute_input": "2024-05-20T16:08:56.890416Z", "iopub.status.busy": "2024-05-20T16:08:56.890228Z", "iopub.status.idle": "2024-05-20T16:08:58.479155Z", "shell.execute_reply": "2024-05-20T16:08:58.478693Z"}, "id": "raWci0gpZ-w1"}, "outputs": [], "source": ["import numpy as np\n", "np.int = int\n", "np.float = float\n", "np.complex = complex\n", "\n", "import MRzeroCore as mr0\n", "import pypulseq as pp\n", "import matplotlib.pyplot as plt"]}, {"cell_type": "markdown", "metadata": {"id": "pFNMbQ2UZn5x"}, "source": ["## 3. Acquisition configuration"]}, {"cell_type": "code", "execution_count": null, "metadata": {"execution": {"iopub.execute_input": "2024-05-20T16:08:58.481993Z", "iopub.status.busy": "2024-05-20T16:08:58.481591Z", "iopub.status.idle": "2024-05-20T16:08:58.485048Z", "shell.execute_reply": "2024-05-20T16:08:58.484632Z"}, "id": "pxSmmjAPZuIl"}, "outputs": [], "source": ["# Phantom resolution\n", "sz = [64, 64]\n", "\n", "# Field of view, imaging volume and resolution\n", "fov = 200e-3\n", "slice_thickness = 8e-3\n", "Nread = 64\n", "Nphase = 64\n", "\n", "# Sequence's name\n", "experiment_id = 'flash'\n", "save = True\n", "\n", "# Scanner limits\n", "system = pp.Opts(\n", " max_grad=28, grad_unit='mT/m',\n", " max_slew=150, slew_unit='T/m/s',\n", " rf_ringdown_time=20e-6, rf_dead_time=100e-6,\n", " adc_dead_time=20e-6,\n", " grad_raster_time=50e-6\n", ")"]}, {"cell_type": "markdown", "metadata": {"id": "AbmZsLMCarQO"}, "source": ["## 4. Phantom loading and configuration"]}, {"cell_type": "code", "execution_count": null, "metadata": {"colab": {"base_uri": "https://localhost:8080/", "height": 880}, "execution": {"iopub.execute_input": "2024-05-20T16:08:58.486935Z", "iopub.status.busy": "2024-05-20T16:08:58.486613Z", "iopub.status.idle": "2024-05-20T16:08:59.413395Z", "shell.execute_reply": "2024-05-20T16:08:59.412838Z"}, "executionInfo": {"elapsed": 3631, "status": "ok", "timestamp": 1715863433984, "user": {"displayName": "magda duarte", "userId": "04023483935404706158"}, "user_tz": -120}, "id": "mMH_gkosat5M", "outputId": "c10d24e3-480b-4e98-825f-b0e7cd6a72f0"}, "outputs": [], "source": ["# Load phantom data\n", "obj_p = mr0.VoxelGridPhantom.load('../../quantified_brain.npz')\n", "obj_p = obj_p.interpolate(sz[0], sz[1], 1)\n", "\n", "# Manipulate loaded data\n", "obj_p.D *= 0\n", "obj_p.plot()"]}, {"cell_type": "markdown", "metadata": {"id": "6VlHLvSnZU03"}, "source": ["## 5. Sequence building"]}, {"cell_type": "code", "execution_count": null, "metadata": {"colab": {"base_uri": "https://localhost:8080/"}, "execution": {"iopub.execute_input": "2024-05-20T16:08:59.415735Z", "iopub.status.busy": "2024-05-20T16:08:59.415254Z", "iopub.status.idle": "2024-05-20T16:08:59.423067Z", "shell.execute_reply": "2024-05-20T16:08:59.422600Z"}, "executionInfo": {"elapsed": 255, "status": "ok", "timestamp": 1715864381418, "user": {"displayName": "magda duarte", "userId": "04023483935404706158"}, "user_tz": -120}, "id": "UAbo_q1WGPoi", "outputId": "2f9cb6bf-8a73-49ed-9ef3-771f29cc4078"}, "outputs": [], "source": ["def flash_2D(fov=200e-3, slice_thickness=8e-3,\n", " n_read=64, n_phase=64,\n", " system=system,\n", " flip_angle=10, phase_cycling=84):\n", " \"\"\"Linear, cartesian 2D FLASH with TR = 26 ms + 50 us * n_phase\"\"\"\n", " rf, gz, gzr = pp.make_sinc_pulse(\n", " flip_angle=flip_angle * np.pi / 180, duration=1e-3,\n", " slice_thickness=slice_thickness, apodization=0.5, time_bw_product=4,\n", " return_gz=True, system=system\n", " )\n", "\n", " adc_dur = n_phase * 50e-6\n", " gx = pp.make_trapezoid(channel='x', flat_area=n_read / fov, flat_time=adc_dur, system=system)\n", " adc = pp.make_adc(num_samples=n_read, duration=adc_dur, delay=gx.rise_time, system=system)\n", " gx_pre = pp.make_trapezoid(channel='x', area=-0.5 * gx.area, duration=5e-3, system=system)\n", " gx_spoil = pp.make_trapezoid(channel='x', area=1.5 * gx.area, duration=2e-3, system=system)\n", "\n", " seq = pp.Sequence(system)\n", " for i in range(n_phase):\n", " phase = 0.5 * phase_cycling * (2 + i + i**2)\n", " rf.phase_offset = (phase % 360) * np.pi / 180\n", " adc.phase_offset = rf.phase_offset\n", "\n", " phenc = (i - n_phase // 2) / fov\n", "\n", " seq.add_block(rf, gz)\n", " seq.add_block(gzr, pp.make_delay(5e-3))\n", " gp = pp.make_trapezoid(channel='y', area=phenc, duration=5e-3, system=system)\n", " seq.add_block(gx_pre, gp)\n", " seq.add_block(adc, gx)\n", " gp = pp.make_trapezoid(channel='y', area=-phenc, duration=5e-3, system=system)\n", " seq.add_block(gx_spoil, gp)\n", " seq.add_block(pp.make_delay(10e-3))\n", "\n", " seq.set_definition('FOV', [fov, fov, slice_thickness])\n", " return seq\n", "seq = flash_2D(fov, slice_thickness, Nread, Nphase, system)\n", "seq.set_definition('Name', experiment_id)\n", "seq.write(experiment_id + '.seq')\n", "\n", "# Verify sequence timing\n", "ok, error_report = seq.check_timing()\n", "if ok:\n", " print('Timing check passed successfully')\n", "else:\n", " print('Timing check failed. Error listing follows:')\n", " [print(e) for e in error_report]"]}, {"cell_type": "markdown", "metadata": {"id": "PyupRv7waNWL"}, "source": ["## 6. Simulation"]}, {"cell_type": "markdown", "metadata": {"id": "nzJLNmnSe64H"}, "source": ["### 6.1 Update phantom parameters for simulation"]}, {"cell_type": "code", "execution_count": null, "metadata": {"colab": {"base_uri": "https://localhost:8080/", "height": 880}, "execution": {"iopub.execute_input": "2024-05-20T16:08:59.425063Z", "iopub.status.busy": "2024-05-20T16:08:59.424896Z", "iopub.status.idle": "2024-05-20T16:09:00.397313Z", "shell.execute_reply": "2024-05-20T16:09:00.396794Z"}, "executionInfo": {"elapsed": 2543, "status": "ok", "timestamp": 1715864292107, "user": {"displayName": "magda duarte", "userId": "04023483935404706158"}, "user_tz": -120}, "id": "JMnqlRlujZHf", "outputId": "f2928d48-fc1b-4bfa-b8ba-d16c015da10a"}, "outputs": [], "source": ["#@markdown The B0 inhomogeneity brings you from the rotating frame FID at dB0=0, closer to the lab frame FID at dB0=B0.\n", "#@markdown Try dB0=0 and dB0=500 for a test.\n", "dB0 = 0 #@param {title:'dB0',type:\"slider\", min:0, max:500, step:10}\n", "\n", "# Reload phantom\n", "obj_p = mr0.VoxelGridPhantom.load('../../quantified_brain.npz')\n", "obj_p = obj_p.interpolate(sz[0], sz[1], 1)\n", "\n", "# Manipulate loaded data\n", "obj_p.D *= 0\n", "obj_p.B0 += dB0\n", "obj_p.plot()\n", "# Convert phantom into simulation data\n", "obj_p = obj_p.build()"]}, {"cell_type": "markdown", "metadata": {"id": "Z04m1ZNHfAf2"}, "source": ["### 6.2 Read seq file and simulate"]}, {"cell_type": "code", "execution_count": null, "metadata": {"colab": {"base_uri": "https://localhost:8080/", "height": 843}, "execution": {"iopub.execute_input": "2024-05-20T16:09:00.399569Z", "iopub.status.busy": "2024-05-20T16:09:00.399221Z", "iopub.status.idle": "2024-05-20T16:09:01.662556Z", "shell.execute_reply": "2024-05-20T16:09:01.662062Z"}, "executionInfo": {"elapsed": 2781, "status": "ok", "timestamp": 1715864297525, "user": {"displayName": "magda duarte", "userId": "04023483935404706158"}, "user_tz": -120}, "id": "Xr3zWNwUeoaG", "outputId": "2cce98bd-588e-4c05-e42f-5af22a846767"}, "outputs": [], "source": ["# Read in the sequence\n", "seq0 = mr0.Sequence.import_file(experiment_id + '.seq')\n", "\n", "# Simulate the sequence\n", "graph = mr0.compute_graph(seq0, obj_p, 200, 1e-3)\n", "signal = mr0.execute_graph(graph, seq0, obj_p, print_progress=False)\n", "\n", "# Plot sequence with SIGNAL\n", "sp_adc, t_adc = mr0.util.pulseq_plot(seq=seq,signal=signal.numpy())"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## 7. Save results"]}, {"cell_type": "code", "execution_count": null, "metadata": {"execution": {"iopub.execute_input": "2024-05-20T16:09:01.664813Z", "iopub.status.busy": "2024-05-20T16:09:01.664633Z", "iopub.status.idle": "2024-05-20T16:09:01.696830Z", "shell.execute_reply": "2024-05-20T16:09:01.696440Z"}}, "outputs": [], "source": ["if save:\n", " dir = \"../results/\"\n", " np.savetxt(dir + experiment_id + \"_signal.txt\", signal)\n", " plt.savefig(dir + experiment_id + \"_signal.png\")"]}], "metadata": {"colab": {"provenance": [{"file_id": "https://github.com/MRsources/MRzero-Core/blob/main/documentation/playground_mr0/mr0_FID_seq.ipynb", "timestamp": 1715862582835}, {"file_id": "1GhBrEuUSoKzI0K6QBDdmo5YR3pTpLQ38", "timestamp": 1678617699445}]}, "kernelspec": {"display_name": "Python 3", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9"}}, "nbformat": 4, "nbformat_minor": 0}
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from copy import deepcopy
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def create_nb(source, template, output_path: str):
|
|
7
|
+
snippets = {}
|
|
8
|
+
snip = []
|
|
9
|
+
for line in source:
|
|
10
|
+
if line.startswith("# !!!"):
|
|
11
|
+
name = line[5:].strip()
|
|
12
|
+
if name in snippets:
|
|
13
|
+
print(f"[!] Snippet {name} defined more than once")
|
|
14
|
+
snip = []
|
|
15
|
+
snippets[name] = snip
|
|
16
|
+
else:
|
|
17
|
+
snip.append(line)
|
|
18
|
+
for snippet in snippets.values():
|
|
19
|
+
while len(snippet) > 0 and len(snippet[-1].strip()) == 0:
|
|
20
|
+
snippet.pop()
|
|
21
|
+
|
|
22
|
+
used_snippets = set()
|
|
23
|
+
output = deepcopy(template)
|
|
24
|
+
|
|
25
|
+
for cell in output["cells"]:
|
|
26
|
+
if cell["cell_type"] == "code":
|
|
27
|
+
template_source = cell["source"]
|
|
28
|
+
cell["source"] = []
|
|
29
|
+
|
|
30
|
+
for line in template_source:
|
|
31
|
+
if line.startswith("# !!!"):
|
|
32
|
+
snippet_name = line[5:].strip()
|
|
33
|
+
if snippet_name not in snippets:
|
|
34
|
+
print(f"[!] Snippet {snippet_name} requested but not provided")
|
|
35
|
+
else:
|
|
36
|
+
if snippet_name in used_snippets:
|
|
37
|
+
print(f"[!] Snippet {snippet_name} used more than once")
|
|
38
|
+
else:
|
|
39
|
+
print(f"Used snippet {snippet_name}")
|
|
40
|
+
|
|
41
|
+
cell["source"] += snippets[snippet_name]
|
|
42
|
+
used_snippets.add(snippet_name)
|
|
43
|
+
else:
|
|
44
|
+
cell["source"].append(line)
|
|
45
|
+
|
|
46
|
+
for snippet_name in snippets:
|
|
47
|
+
if snippet_name not in used_snippets:
|
|
48
|
+
print(f"[!] Snippet {snippet_name} provided but not requested")
|
|
49
|
+
|
|
50
|
+
with open(output_path, "w") as output_file:
|
|
51
|
+
json.dump(output, output_file)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
cwd = os.path.dirname(os.path.realpath(__file__))
|
|
55
|
+
files = os.listdir(cwd)
|
|
56
|
+
templates = [f for f in files if f.startswith("template")]
|
|
57
|
+
instatiators = [f for f in files if f not in templates and f.endswith(".ipynb")]
|
|
58
|
+
|
|
59
|
+
print(f"Generating notebooks based on {instatiators}")
|
|
60
|
+
print(f"using the templates {templates}")
|
|
61
|
+
|
|
62
|
+
template_src = {}
|
|
63
|
+
for nb_name in templates:
|
|
64
|
+
with open(os.path.join(cwd, nb_name)) as nb:
|
|
65
|
+
template_src[nb_name] = json.load(nb)
|
|
66
|
+
|
|
67
|
+
for nb_name in instatiators:
|
|
68
|
+
with open(os.path.join(cwd, nb_name)) as nb:
|
|
69
|
+
cells = json.load(nb)["cells"]
|
|
70
|
+
for cell in cells:
|
|
71
|
+
if cell["cell_type"] == "code":
|
|
72
|
+
source = cell["source"]
|
|
73
|
+
if source[0].startswith("# ***"):
|
|
74
|
+
template, _, output = source[0][6:].partition("->")
|
|
75
|
+
output = output.strip()
|
|
76
|
+
outdir = os.path.join(os.path.dirname(cwd), "generated", nb_name.partition(".")[0])
|
|
77
|
+
os.makedirs(outdir, exist_ok=True)
|
|
78
|
+
output = os.path.join(outdir, output)
|
|
79
|
+
|
|
80
|
+
print(f"> Creating notebook: {nb_name} {template.strip()} -> {output.strip()}")
|
|
81
|
+
template = template_src[template.strip()]
|
|
82
|
+
create_nb(source, template, output)
|