mrzerocore 0.2.10__cp37-abi3-win32.whl → 0.2.12__cp37-abi3-win32.whl

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/_prepass.pyd CHANGED
Binary file
@@ -151,7 +151,7 @@ def generate_brainweb_phantoms(
151
151
  print("Adding tissue to phantom", end="", flush=True)
152
152
  maps["PD_map"] += tissue_data["PD"] * tissue_map * noise()
153
153
  maps["T1_map"] += tissue_data["T1"] * tissue_map * noise()
154
- maps["T2_map"] += tissue_data["T2"] * noise()
154
+ maps["T2_map"] += tissue_data["T2"] * tissue_map * noise()
155
155
  maps["T2dash_map"] += tissue_data["T2'"] * tissue_map * noise()
156
156
  maps["D_map"] += tissue_data["D"] * tissue_map * noise()
157
157
  print(" - done")
@@ -33,7 +33,7 @@
33
33
  "gm": {
34
34
  "PD": 0.8,
35
35
  "T1": 1.56,
36
- "T2": 0.0083,
36
+ "T2": 0.083,
37
37
  "T2'": 0.32,
38
38
  "D": 0.83
39
39
  },
@@ -157,6 +157,10 @@ class VoxelGridPhantom:
157
157
  T2dash = torch.tensor(data['T2dash_map'])
158
158
  PD = torch.tensor(data['PD_map'])
159
159
  D = torch.tensor(data['D_map'])
160
+ try:
161
+ size = torch.tensor(data['FOV'])
162
+ except KeyError:
163
+ size = torch.tensor([0.192, 0.192, 0.192])
160
164
 
161
165
  # Generate a somewhat plausible B0 and B1 map.
162
166
  # Visually fitted to look similar to the numerical_brain_cropped
@@ -174,11 +178,6 @@ class VoxelGridPhantom:
174
178
  B0 -= (B0 * weight).sum()
175
179
  B1 /= (B1 * weight).sum()
176
180
 
177
- try:
178
- size = torch.tensor(data['FOV'])
179
- except KeyError:
180
- size = torch.tensor([0.192, 0.192, 0.192])
181
-
182
181
  return cls(
183
182
  PD, T1, T2, T2dash, D, B0, B1[None, ...],
184
183
  torch.ones(1, *PD.shape), size,
@@ -18,12 +18,9 @@ def execute_graph(graph: Graph,
18
18
  min_emitted_signal: float = 1e-2,
19
19
  min_latent_signal: float = 1e-2,
20
20
  print_progress: bool = True,
21
- ) -> torch.Tensor:
22
- """Calculate the signal of the sequence by computing the graph.
23
-
24
- This function can optionally return the + or z magnetisation and the
25
- encoding of all states, if requested. The encoding consists of the signal
26
- of a distribution and its k-t space trajectory.
21
+ return_mag_z: int | bool | None = None,
22
+ ) -> torch.Tensor | list:
23
+ """Calculate the signal of the sequence by executing the phase graph.
27
24
 
28
25
  Parameters
29
26
  ----------
@@ -40,11 +37,18 @@ def execute_graph(graph: Graph,
40
37
  Should be <= than min_emitted_signal.
41
38
  print_progress : bool
42
39
  If true, the current repetition is printed while simulating.
40
+ return_mag_z : int or bool, optional
41
+ If set, returns the longitudinal magnetisation of either the given
42
+ repetition (int) or all repetitions (``True``).
43
+
43
44
 
44
45
  Returns
45
46
  -------
46
47
  signal : torch.Tensor
47
48
  The simulated signal of the sequence.
49
+ mag_z : torch.Tensor | list[torch.Tensor]
50
+ The longitudinal magnetisation of the specified or all repetition(s).
51
+
48
52
  """
49
53
  if seq.normalized_grads:
50
54
  grad_scale = 1 / data.size
@@ -67,6 +71,7 @@ def execute_graph(graph: Graph,
67
71
  # Calculate kt_vec ourselves for autograd
68
72
  graph[0][0].kt_vec = torch.zeros(4, device=data.device)
69
73
 
74
+ mag_z = []
70
75
  for i, (dists, rep) in enumerate(zip(graph[1:], seq)):
71
76
  if print_progress:
72
77
  print(f"\rCalculating repetition {i+1} / {len(seq)}", end='')
@@ -129,7 +134,8 @@ def execute_graph(graph: Graph,
129
134
  # Use the same adc phase for all coils
130
135
  adc_rot = torch.exp(1j * rep.adc_phase).unsqueeze(1)
131
136
 
132
-
137
+ mag_z_rep = []
138
+ mag_z.append(mag_z_rep)
133
139
  for dist in dists:
134
140
  # Create a list only containing ancestors that were simulated
135
141
  ancestors = list(filter(
@@ -142,6 +148,9 @@ def execute_graph(graph: Graph,
142
148
  continue # skip dists for which no ancestors were simulated
143
149
 
144
150
  dist.mag = sum([calc_mag(ancestor) for ancestor in ancestors])
151
+ if dist.dist_type in ['z0', 'z'] and return_mag_z in [i, True]:
152
+ mag_z_rep.append(dist.mag)
153
+
145
154
  # The pre_pass already calculates kt_vec, but that does not
146
155
  # work with autograd -> we need to calculate it with torch
147
156
  if dist.dist_type == 'z0':
@@ -224,6 +233,10 @@ def execute_graph(graph: Graph,
224
233
  print(" - done")
225
234
 
226
235
  # Only return measured samples
227
- return torch.cat([
236
+ measured = torch.cat([
228
237
  sig[rep.adc_usage > 0, :] for sig, rep in zip(signal, seq)
229
238
  ])
239
+ if return_mag_z is not None:
240
+ return measured, mag_z
241
+ else:
242
+ return measured
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MRzeroCore
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -18,9 +18,9 @@ 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
  [![Documentation Status](https://readthedocs.org/projects/mrzero-core/badge/?version=latest)](https://mrzero-core.readthedocs.io/en/latest/?badge=latest)
26
26
 
@@ -1,13 +1,13 @@
1
- MRzeroCore-0.2.10.dist-info/METADATA,sha256=QVGqnWXhjyHY8RqGRhPwRnr_MIkWiLveY00qEnCZAXw,3801
2
- MRzeroCore-0.2.10.dist-info/WHEEL,sha256=gXYpX75r-fJLXR2RD6r-k3EXD66bMIXTAL43kNqJgxg,92
3
- MRzeroCore-0.2.10.dist-info/license_files/LICENSE,sha256=rd_IFJ484uAluv8CigP2CpXg4l2GJLLKENqB6-RXPp4,35112
4
- MRzeroCore/phantom/brainweb/brainweb_data.json,sha256=HETnXgLJndWbqeL4yfm8N-f9t0EwO-v6HzRA46f4VPU,1795
1
+ MRzeroCore-0.2.12.dist-info/METADATA,sha256=Bbz05wbitS0vBO9HNYxnuOVtFPfzqjx4Z_bEvGeLCy0,3801
2
+ MRzeroCore-0.2.12.dist-info/WHEEL,sha256=gXYpX75r-fJLXR2RD6r-k3EXD66bMIXTAL43kNqJgxg,92
3
+ MRzeroCore-0.2.12.dist-info/license_files/LICENSE,sha256=rd_IFJ484uAluv8CigP2CpXg4l2GJLLKENqB6-RXPp4,35112
4
+ MRzeroCore/phantom/brainweb/brainweb_data.json,sha256=El9J5dfEIwGi4_SoRif6ic6IVSMKh01jK0hNRbBYNqA,1794
5
5
  MRzeroCore/phantom/brainweb/brainweb_data_sources.txt,sha256=Sh6NFLU1bhdaD0pp12D_Hc70cA_UC1s7KdHcuoGTKuA,1853
6
6
  MRzeroCore/phantom/brainweb/output/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- MRzeroCore/phantom/brainweb/__init__.py,sha256=R48NlkMNpMgyKKwFm-5iUlhxBKctQ6dXx7yCmyVwm6E,6828
7
+ MRzeroCore/phantom/brainweb/__init__.py,sha256=f0mGtGMO0oi4d-HyRlvE042UgLD-jgsVKLF-7h9JD1g,6841
8
8
  MRzeroCore/phantom/custom_voxel_phantom.py,sha256=Pt5X1KjOgzNo6ebINyl4oT8drFTWp4NU3Mi3e5a0YVM,10413
9
9
  MRzeroCore/phantom/sim_data.py,sha256=rL0eRk_CuvzxIHrjcjHA2nexYEBieu70B2nS6VlhcxQ,7118
10
- MRzeroCore/phantom/voxel_grid_phantom.py,sha256=wAereuWTbJRBYVPRKT93tQlI-jDDOx1QDT2z5nrhFeY,16613
10
+ MRzeroCore/phantom/voxel_grid_phantom.py,sha256=h1UAsOzQRQPBuC6m_qpIj2eTYtjBl2Ogz_Kkt4ZQH3E,16627
11
11
  MRzeroCore/pulseq/exporter.py,sha256=RlIHkXNVmQy-ywixIPeWeICnb9jq4_1_9O8HujBigLs,17226
12
12
  MRzeroCore/pulseq/exporter_v2.py,sha256=GVnhC6bmbxbYq4CFrBbL2nj98B_u3OVglOt50J19pkk,30554
13
13
  MRzeroCore/pulseq/helpers.py,sha256=ZEtctXy7qm6BLexcwNRDd8xPSBFNiy5dUeifOo5bYkw,8774
@@ -28,9 +28,9 @@ MRzeroCore/pulseq/pulseq_loader/__init__.py,sha256=6OLwC3k9LSjl8aRin9pV4-Rb-Q3YS
28
28
  MRzeroCore/reconstruction.py,sha256=LGk5EdgQ4AkhWN-7Q81YMkIEEW0T9Q37O2Pat0d-d4o,4277
29
29
  MRzeroCore/sequence.py,sha256=wqRwpUIKdX9mgmctmIL2Ttr3eZPJ_H1ACLamkzPp7sY,27647
30
30
  MRzeroCore/simulation/isochromat_sim.py,sha256=u6KbN7S8REOHiKqzDGMma7937cKX4bnmj3gXoAiNLi0,9185
31
- MRzeroCore/simulation/main_pass.py,sha256=u2LrBYnKkS5FSJVUaCTSVyM7NCgQvtFUr1BQNmNriWk,9361
31
+ MRzeroCore/simulation/main_pass.py,sha256=DNXEJmN7AEWuqNbMma6AWqJpHH4ihhC3YRJKRhoi4RU,9830
32
32
  MRzeroCore/simulation/pre_pass.py,sha256=5wmXKxgFeGwA7yrqTkOjcWoFuGuRYEPzedRGqkx2Evg,5117
33
33
  MRzeroCore/util.py,sha256=39TPselHu7f218BRdjHB4_kCSPnFuCC45YmdGotc4uA,11460
34
34
  MRzeroCore/__init__.py,sha256=8WViV9GQRwnksnopAAfKWRmtRYk75DC3ke4OQwLx-fU,850
35
- MRzeroCore/_prepass.pyd,sha256=sFkaev8d637tr-84sX-DyDP8BigAztIR0SxbW8NSKbY,351232
36
- MRzeroCore-0.2.10.dist-info/RECORD,,
35
+ MRzeroCore/_prepass.pyd,sha256=NIJkecmf-necJn1FPdJw_IOaiN-hr08NiyYWBslD6z8,354304
36
+ MRzeroCore-0.2.12.dist-info/RECORD,,