From 8a6442acea7f3760ce62fdbfae0fe9635c378df7 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Tue, 19 Mar 2024 12:05:07 +0100 Subject: [PATCH 01/27] Update breathing_motion_module notebook --- notebooks/trajectory_modules/breathing_motion_module.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/trajectory_modules/breathing_motion_module.ipynb b/notebooks/trajectory_modules/breathing_motion_module.ipynb index 6d19d23..7aa2b42 100644 --- a/notebooks/trajectory_modules/breathing_motion_module.ipynb +++ b/notebooks/trajectory_modules/breathing_motion_module.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a3586145ec8e482232ff0d175c210a9403945b1a3b86d6635ca7dcdd7b7c1e03 -size 12980893 +oid sha256:35bf6d74eada1aca889e0a3d5f062a6a0c26f14522a11077d89a7af7a3a99c58 +size 5934834 -- GitLab From e30001162f55e8933c23133aa8c76d2dd8a3f10a Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Tue, 19 Mar 2024 13:13:35 +0100 Subject: [PATCH 02/27] Update cardiac_mesh_pod --- notebooks/trajectory_modules/cardiac_mesh_pod.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb index 21f3b0b..3dcc1de 100644 --- a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb +++ b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84f0141bac2adcefaa3cc53f54a167c5e292f4ace19be013be28ec7824e2c576 -size 18265188 +oid sha256:1186f046fa5e43e027b7a318fc9e35571fd6418f17e449d3bbeb57e1caa3b025 +size 14123333 -- GitLab From 93e505357aaa5e5ad0d3b54ebd830b9c6ccdc57d Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Tue, 19 Mar 2024 18:12:51 +0100 Subject: [PATCH 03/27] Update random motion trajectory notebook Additionally fixed bug in CardiacMeshDataset introduced by changed pyvista definition --- cmrsim/datasets/_cardiac_mesh.py | 4 ++-- notebooks/trajectory_modules/cardiac_mesh_pod.ipynb | 4 ++-- .../contracting_cardiac_mesh_with_random_disp.ipynb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmrsim/datasets/_cardiac_mesh.py b/cmrsim/datasets/_cardiac_mesh.py index 8cae45e..5721fdf 100644 --- a/cmrsim/datasets/_cardiac_mesh.py +++ b/cmrsim/datasets/_cardiac_mesh.py @@ -56,7 +56,7 @@ class MeshDataset: # pylint: disable=E1101 deformation_mesh = pyvista.UnstructuredGrid( - {vtk.VTK_TETRA: self.mesh.cell_connectivity.reshape(-1, 4)}, + {vtk.VTK_TETRA: self.mesh.cells.reshape(-1, 5)[:, 1:]}, reference_positions) # Apply transformation for all time steps @@ -200,7 +200,7 @@ class MeshDataset: # pylint: disable=E1101 probing_mesh = pyvista.UnstructuredGrid( - {vtk.VTK_TETRA: self.mesh.cell_connectivity.reshape(-1, 4)}, + {vtk.VTK_TETRA: self.mesh.cells.reshape(-1, 5)[:, 1:]}, reference_positions) probing_mesh = reference_mesh.probe(probing_mesh) for name in field_names: diff --git a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb index 3dcc1de..f31608e 100644 --- a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb +++ b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1186f046fa5e43e027b7a318fc9e35571fd6418f17e449d3bbeb57e1caa3b025 -size 14123333 +oid sha256:76ca9390f44b703043d57015c29d165e235b11327ddaffdab4ebfa6a538646ca +size 14123286 diff --git a/notebooks/trajectory_modules/contracting_cardiac_mesh_with_random_disp.ipynb b/notebooks/trajectory_modules/contracting_cardiac_mesh_with_random_disp.ipynb index 67f2601..5a6f830 100644 --- a/notebooks/trajectory_modules/contracting_cardiac_mesh_with_random_disp.ipynb +++ b/notebooks/trajectory_modules/contracting_cardiac_mesh_with_random_disp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:254275501dfc8af05decf03bc49f424767e1441f7642dd4f5d667a5132032202 -size 17627048 +oid sha256:573816a73c04364c5783a1302dc431a973b9ff3b5d5077cbcceebb9b1194344d +size 17457606 -- GitLab From 74fe4a0ab8a040cc0aab50d6167969f542a927a8 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Tue, 19 Mar 2024 19:04:45 +0100 Subject: [PATCH 04/27] Updated taylor_trajectories notebook --- notebooks/trajectory_modules/taylor_trajectories.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/trajectory_modules/taylor_trajectories.ipynb b/notebooks/trajectory_modules/taylor_trajectories.ipynb index 5ae746c..cebfa4e 100644 --- a/notebooks/trajectory_modules/taylor_trajectories.ipynb +++ b/notebooks/trajectory_modules/taylor_trajectories.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ce52c5e9cc0845d6bc4c2eff6100f9c96d14e571c16b22d4c5c8eff3c0843bf -size 13255771 +oid sha256:85fc5747d6c50ecf22b65348a9096a7c29404e1dfb679cc094d13d2a8a75e927 +size 6542766 -- GitLab From 56061ec7ca7ad734714cd5a83f5bee581e980235 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Tue, 19 Mar 2024 19:44:21 +0100 Subject: [PATCH 05/27] Updated all trajectory module notebooks --- notebooks/trajectory_modules/cardiac_mesh_pod.ipynb | 4 ++-- notebooks/trajectory_modules/flow_trajectory_module.ipynb | 4 ++-- notebooks/trajectory_modules/turbulent_flow.ipynb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb index f31608e..9a8d846 100644 --- a/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb +++ b/notebooks/trajectory_modules/cardiac_mesh_pod.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:76ca9390f44b703043d57015c29d165e235b11327ddaffdab4ebfa6a538646ca -size 14123286 +oid sha256:eb3d7ce0a295a68ddcfbd018c4e423298a75779d0ba0d30909273cdda4fca4ed +size 14088078 diff --git a/notebooks/trajectory_modules/flow_trajectory_module.ipynb b/notebooks/trajectory_modules/flow_trajectory_module.ipynb index 2312e92..8f0177e 100644 --- a/notebooks/trajectory_modules/flow_trajectory_module.ipynb +++ b/notebooks/trajectory_modules/flow_trajectory_module.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4f8768cd61b257338cc1c779d1ab130a4243c53c18a89a2d957334a0a986ba4 -size 17426126 +oid sha256:514018be341822e8ca3bfd6c4b04bf7838944d67d8875f410d00668bc0ec456e +size 17432232 diff --git a/notebooks/trajectory_modules/turbulent_flow.ipynb b/notebooks/trajectory_modules/turbulent_flow.ipynb index 55bf1d2..975d3bb 100644 --- a/notebooks/trajectory_modules/turbulent_flow.ipynb +++ b/notebooks/trajectory_modules/turbulent_flow.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b6b9ab88ef1f9b9269e74fc1802b8dea40a113c595041a939184eb2820b62d9 -size 1423425 +oid sha256:106071132844a022feef2b6d1f2f1f3bff0a03f4da1784ff978e57e46a6da256 +size 1545670 -- GitLab From bf911685d6a14bea02810d128200068d92c0a663 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Mon, 25 Mar 2024 13:07:11 +0100 Subject: [PATCH 06/27] Updated notebooks --- notebooks/bloch_simulation/static_multi_coil_bssfp.ipynb | 4 ++-- notebooks/trajectory_modules/turbulent_flow.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notebooks/bloch_simulation/static_multi_coil_bssfp.ipynb b/notebooks/bloch_simulation/static_multi_coil_bssfp.ipynb index 8ea2978..0c32eaf 100644 --- a/notebooks/bloch_simulation/static_multi_coil_bssfp.ipynb +++ b/notebooks/bloch_simulation/static_multi_coil_bssfp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d025dad54f823dfc15315d916ca2c6b3478c38bc45e3f4d5c008854ec947783c -size 1803176 +oid sha256:c1bcfdc32f75b36340b5e6502918b95d9dbcd32deda2845e3b5f8f6c625311eb +size 1327080 diff --git a/notebooks/trajectory_modules/turbulent_flow.ipynb b/notebooks/trajectory_modules/turbulent_flow.ipynb index 975d3bb..1ae9f88 100644 --- a/notebooks/trajectory_modules/turbulent_flow.ipynb +++ b/notebooks/trajectory_modules/turbulent_flow.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:106071132844a022feef2b6d1f2f1f3bff0a03f4da1784ff978e57e46a6da256 -size 1545670 +oid sha256:50dd9b7b00419da603048f9325070682b41307d466197ac8cd4513043493b638 +size 1400552 -- GitLab From 12c14e52a0ebb8f2bb1f492e655db58a0351ebac Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Mon, 25 Mar 2024 13:56:31 +0100 Subject: [PATCH 07/27] Updated CPMG notebook --- notebooks/bloch_simulation/static_CPMG_t2star.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/static_CPMG_t2star.ipynb b/notebooks/bloch_simulation/static_CPMG_t2star.ipynb index dbb388b..c0ea5a8 100644 --- a/notebooks/bloch_simulation/static_CPMG_t2star.ipynb +++ b/notebooks/bloch_simulation/static_CPMG_t2star.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e6e6100c2e6e9cb049e92d544dc5cc881f2d1b988549476d39980ff5c7cde885 -size 73094 +oid sha256:deb5d97f256c92b233f94ec1b6e96b4f49fe6d3f55b0a64e77ea0b8323caafe1 +size 140848 -- GitLab From f8c3e763d1e11a4fe90c8d31aa2c292c3cc29b59 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Mon, 25 Mar 2024 13:57:24 +0100 Subject: [PATCH 08/27] Replaced deprecate pyvista.probe with .sample See issue #181 --- cmrsim/datasets/_flow.py | 12 ++++++++---- cmrsim/datasets/_regular_grid.py | 21 +++++++++++++-------- notebooks/local_functions.py | 4 ++-- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/cmrsim/datasets/_flow.py b/cmrsim/datasets/_flow.py index 3cf2014..8be17cb 100644 --- a/cmrsim/datasets/_flow.py +++ b/cmrsim/datasets/_flow.py @@ -174,8 +174,10 @@ class RefillingFlowDataset(tf.Module): gridded_seeding_volume = pyvista.ImageData(dimensions=dims + 1, spacing=resolution, origin=origin) - self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) - + + # self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) + self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh) + active_indx = np.where(self.gridded_seeding_volume.ptc().cell_data["in_mesh"] > 0.7) active_cell_centers = self.gridded_seeding_volume.cell_centers().ptc().points[active_indx] @@ -251,7 +253,8 @@ class RefillingFlowDataset(tf.Module): # Re-seed particles in un-populated areas with Monte-Carlo rejection: # 1. Estimate current particle density within slice self._estimate_particle_density(residual_particle_pos[in_tolerance]) - sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) + # sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) + sampled_particle_pos = sampled_particle_pos.sample(self.gridded_seeding_volume) density = np.array(sampled_particle_pos["density"]) decision_boundaries = density / particle_density # 2. To prevent unintentionally increasing particle density, set the decision boundary @@ -413,4 +416,5 @@ class RefillingFlowDataset(tf.Module): smoothed_histogram = gaussian_filter(residual_histogram / sampling_volume, sigma=sigma, truncate=2.5) self.gridded_mesh.cell_data["density"] = smoothed_histogram.reshape(-1, order="F") - return self.gridded_mesh.probe(self.original_mesh) \ No newline at end of file + # return self.gridded_mesh.probe(self.original_mesh) + return self.original_mesh.sample(self.gridded_mesh) \ No newline at end of file diff --git a/cmrsim/datasets/_regular_grid.py b/cmrsim/datasets/_regular_grid.py index f460738..99f035e 100644 --- a/cmrsim/datasets/_regular_grid.py +++ b/cmrsim/datasets/_regular_grid.py @@ -103,9 +103,10 @@ class RegularGridDataset: readout_direction) nbins = (field_of_view / spacing).m_as("dimensionless").astype(int) new_slice = pyvista.ImageData(dimensions=nbins, spacing=spacing.m_as("m"), - origin=-field_of_view.m_as("m") / 2) + origin=-field_of_view.m_as("m") / 2) new_slice = new_slice.transform(total_transform, inplace=False) - new_slice = self.mesh.probe(new_slice) + new_slice = new_slice.sample(self.mesh) + # new_slice = self.mesh.probe(new_slice) if in_mps: inv_transform = np.eye(4, 4) @@ -123,7 +124,7 @@ class RegularGridDataset: Assumes that the main magnetic field is pointing in z-direction of the contained mesh. The susceptibility os assumed to be specified as parts per million - (e.g. :math:`\chi_{air} = 0.36ppm`). + (e.g. :math:`\\chi_{air} = 0.36ppm`). The result is store in self.mesh["offres"] and is also returned as Quantity. @@ -163,8 +164,10 @@ class RegularGridDataset: # ft_chi_3d_dual = tf.signal.fft3d(chi_3d + 1j * imaginary_channel) ft_chi_3d_dual = tf.signal.fft3d(chi_3d) # 2) multiplication with the dipole function - dipole_kernel = self._compute_fourier_dipole_kernel(field_of_view, - np.array(ft_chi_3d_dual.shape)) + dipole_kernel = self._compute_fourier_dipole_kernel( + field_of_view, + np.array(ft_chi_3d_dual.shape)) + ft_field_3d = ft_chi_3d_dual * dipole_kernel # 3) inverse FT to spatial domain field_3d_dual = tf.signal.ifft3d(ft_field_3d) @@ -207,7 +210,8 @@ class RegularGridDataset: r_min = np.min(input_mesh.points, axis=0) - padding.m_as("m") / 2 nbins = (Quantity(r_max - r_min, "m") / pixel_spacing.to("m")).m.astype(int) mesh = pyvista.ImageData(dimensions=nbins, spacing=pixel_spacing.m_as("m"), origin=r_min) - mesh = input_mesh.probe(mesh) + mesh = mesh.sample(input_mesh) + # mesh = input_mesh.probe(mesh) return cls(mesh) @classmethod @@ -248,8 +252,9 @@ class RegularGridDataset: shape = np.array(shapes[0][0:3]) origin = - pixel_spacing * shape / 2 + origin_offset - mesh = pyvista.ImageData(dimensions=shape, spacing=pixel_spacing.m_as("m"), - origin=origin.m_as("m")) + mesh = pyvista.ImageData(dimensions=shape, + spacing=pixel_spacing.m_as("m"), + origin=origin.m_as("m")) for name, arr in data.items(): mesh[name] = arr.reshape([shape.prod(), *arr.shape[3:]], order="F") diff --git a/notebooks/local_functions.py b/notebooks/local_functions.py index d099780..c37a4f5 100644 --- a/notebooks/local_functions.py +++ b/notebooks/local_functions.py @@ -68,7 +68,7 @@ def create_cylinder_phantom(dimensions=(200, 200, 4), spacing=(0.001, 0.001, 0.0 :return: pyvista.UnstructuredGrid """ - raster = pyvista.UniformGrid(dimensions=dimensions, spacing=spacing, origin=-np.array(dimensions) * np.array(spacing) / 2) + raster = pyvista.ImageData(dimensions=dimensions, spacing=spacing, origin=-np.array(dimensions) * np.array(spacing) / 2) cylinders = [pyvista.Cylinder(center=(*xy_positions[i].m_as("m"), 0.), direction=(0., 0., 1.), radius=radii[i].m_as("m"),) for i in range(len(radii))] max_radius = np.max(np.array(dimensions[0:2]) * np.array(spacing[0:2])) / 2 @@ -110,7 +110,7 @@ def create_spherical_phantom(dimensions=(120, 120, 120), spacing=(0.002, 0.002, :param big_radius: float in meter :return: pyvista.UnstructuredGrid """ - raster = pyvista.UniformGrid(dimensions=dimensions, spacing=spacing, + raster = pyvista.ImageData(dimensions=dimensions, spacing=spacing, origin=-np.array(dimensions) * np.array(spacing) / 2) sphere_big = pyvista.Sphere(radius=big_radius).extract_surface() box = pyvista.Box(bounds=(-big_radius * 0.3, big_radius * 0.3, -big_radius/5, -- GitLab From 4ad249dcaf0c86364bb86dbaef19da4be95089f7 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Mon, 25 Mar 2024 14:13:57 +0100 Subject: [PATCH 09/27] Reverted breaking change --- cmrsim/datasets/_flow.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmrsim/datasets/_flow.py b/cmrsim/datasets/_flow.py index 8be17cb..5f6bb11 100644 --- a/cmrsim/datasets/_flow.py +++ b/cmrsim/datasets/_flow.py @@ -172,8 +172,8 @@ class RefillingFlowDataset(tf.Module): resolution = image_box / dims origin = np.min(r_slice, axis=0) gridded_seeding_volume = pyvista.ImageData(dimensions=dims + 1, - spacing=resolution, - origin=origin) + spacing=resolution, + origin=origin) # self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh) @@ -253,8 +253,8 @@ class RefillingFlowDataset(tf.Module): # Re-seed particles in un-populated areas with Monte-Carlo rejection: # 1. Estimate current particle density within slice self._estimate_particle_density(residual_particle_pos[in_tolerance]) - # sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) - sampled_particle_pos = sampled_particle_pos.sample(self.gridded_seeding_volume) + sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) + # sampled_particle_pos = sampled_particle_pos.sample(self.gridded_seeding_volume) density = np.array(sampled_particle_pos["density"]) decision_boundaries = density / particle_density # 2. To prevent unintentionally increasing particle density, set the decision boundary -- GitLab From 3b891343cfd2e39853a99b1b8eccda31f4580a42 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Mon, 25 Mar 2024 14:20:00 +0100 Subject: [PATCH 10/27] revert breaking changes --- cmrsim/datasets/_flow.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmrsim/datasets/_flow.py b/cmrsim/datasets/_flow.py index 5f6bb11..3cf2014 100644 --- a/cmrsim/datasets/_flow.py +++ b/cmrsim/datasets/_flow.py @@ -172,12 +172,10 @@ class RefillingFlowDataset(tf.Module): resolution = image_box / dims origin = np.min(r_slice, axis=0) gridded_seeding_volume = pyvista.ImageData(dimensions=dims + 1, - spacing=resolution, - origin=origin) - - # self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) - self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh) - + spacing=resolution, + origin=origin) + self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) + active_indx = np.where(self.gridded_seeding_volume.ptc().cell_data["in_mesh"] > 0.7) active_cell_centers = self.gridded_seeding_volume.cell_centers().ptc().points[active_indx] @@ -254,7 +252,6 @@ class RefillingFlowDataset(tf.Module): # 1. Estimate current particle density within slice self._estimate_particle_density(residual_particle_pos[in_tolerance]) sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) - # sampled_particle_pos = sampled_particle_pos.sample(self.gridded_seeding_volume) density = np.array(sampled_particle_pos["density"]) decision_boundaries = density / particle_density # 2. To prevent unintentionally increasing particle density, set the decision boundary @@ -416,5 +413,4 @@ class RefillingFlowDataset(tf.Module): smoothed_histogram = gaussian_filter(residual_histogram / sampling_volume, sigma=sigma, truncate=2.5) self.gridded_mesh.cell_data["density"] = smoothed_histogram.reshape(-1, order="F") - # return self.gridded_mesh.probe(self.original_mesh) - return self.original_mesh.sample(self.gridded_mesh) \ No newline at end of file + return self.gridded_mesh.probe(self.original_mesh) \ No newline at end of file -- GitLab From b4271b45a46f0d19d6f06389aebb65eec5189352 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 11:17:37 +0200 Subject: [PATCH 11/27] Updated static GRE shepp logan notebook --- notebooks/bloch_simulation/static_CPMG_t2star.ipynb | 4 ++-- notebooks/bloch_simulation/static_cartesian_sGRE_shepp.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/notebooks/bloch_simulation/static_CPMG_t2star.ipynb b/notebooks/bloch_simulation/static_CPMG_t2star.ipynb index c0ea5a8..4c56401 100644 --- a/notebooks/bloch_simulation/static_CPMG_t2star.ipynb +++ b/notebooks/bloch_simulation/static_CPMG_t2star.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:deb5d97f256c92b233f94ec1b6e96b4f49fe6d3f55b0a64e77ea0b8323caafe1 -size 140848 +oid sha256:860ccac3d1f4243c86a7de2d8b05012d4653b579813c0c2b8a0719126d688816 +size 137377 diff --git a/notebooks/bloch_simulation/static_cartesian_sGRE_shepp.ipynb b/notebooks/bloch_simulation/static_cartesian_sGRE_shepp.ipynb index 9e53352..f8229d3 100644 --- a/notebooks/bloch_simulation/static_cartesian_sGRE_shepp.ipynb +++ b/notebooks/bloch_simulation/static_cartesian_sGRE_shepp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:abb2f6223c8451ddefa4ef7a591d5555157f607e74428de730947246842ff18d -size 928969 +oid sha256:e4bd34c845c0e2587e9e962a2217eae2b3c159c3d7e09ca3b726d8e7404814f5 +size 1555249 -- GitLab From 66905aa02a419225540dfb001350c18c69e4110f Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 11:54:34 +0200 Subject: [PATCH 12/27] Updated SS_EPI shepp logan notebook --- notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb b/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb index cd3e13f..0554459 100644 --- a/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb +++ b/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:648096692b220ab320d00779c5e7ee13920aa655818767c450226e9e1b25c24d -size 430074 +oid sha256:b1b111275d7ad422aa23b6fe7d16340051f60b977d8f3e48c52724d2e23d471d +size 266713 -- GitLab From 90cba0fa9b6efebfe43c8187fbf1cba83246149a Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 11:55:01 +0200 Subject: [PATCH 13/27] removed typo --- notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb b/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb index 0554459..d703f11 100644 --- a/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb +++ b/notebooks/bloch_simulation/static_cartesian_SEEPI_shepp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1b111275d7ad422aa23b6fe7d16340051f60b977d8f3e48c52724d2e23d471d -size 266713 +oid sha256:06b8f534f078e671955cedf52427dc1428e49a017f3975bccd56cf6ae8561f68 +size 266719 -- GitLab From 4e8bbbc62c01eb924a519fc6ebbd14e8ab567a34 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 13:54:55 +0200 Subject: [PATCH 14/27] updated bssfp offress notebook --- notebooks/bloch_simulation/static_BSSFP_offresonance.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/static_BSSFP_offresonance.ipynb b/notebooks/bloch_simulation/static_BSSFP_offresonance.ipynb index ba22b48..9aef2dd 100644 --- a/notebooks/bloch_simulation/static_BSSFP_offresonance.ipynb +++ b/notebooks/bloch_simulation/static_BSSFP_offresonance.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7c61f5259b8763f53cdb4bda406e6d6a298398f10b648218a8c02bc3da2c224 -size 919330 +oid sha256:934f14e79d779801c2857d48973003540c644ec080233d745208c731c0de1e61 +size 1160455 -- GitLab From 5958f3643656940b6b22747d7475bc74eaebe95b Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 18:33:46 +0200 Subject: [PATCH 15/27] Updated simple example from paper --- notebooks/bloch_simulation/movmesh_bssfp.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/movmesh_bssfp.ipynb b/notebooks/bloch_simulation/movmesh_bssfp.ipynb index c68ff5b..bc53407 100644 --- a/notebooks/bloch_simulation/movmesh_bssfp.ipynb +++ b/notebooks/bloch_simulation/movmesh_bssfp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97cfc4518fe865454384402b4e822c4516795453c2b54a1f5e8ab1923970d9c1 -size 2666390 +oid sha256:171b06ac848ff03994b8fe9374ded3dd7f958933decad7c35757ae3983123e05 +size 2733609 -- GitLab From 1b5ef5e1ff9541bc86cd27d4a39972df06d85743 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Thu, 11 Apr 2024 22:09:05 +0200 Subject: [PATCH 16/27] Update turbulent flow notebook --- notebooks/bloch_simulation/flow_venc_sGRE_turbUBend.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/flow_venc_sGRE_turbUBend.ipynb b/notebooks/bloch_simulation/flow_venc_sGRE_turbUBend.ipynb index c038395..cb544a2 100644 --- a/notebooks/bloch_simulation/flow_venc_sGRE_turbUBend.ipynb +++ b/notebooks/bloch_simulation/flow_venc_sGRE_turbUBend.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b34dfa25b129eeba56c9ce378bb11a98aef853f41ded6ae759a305e28d4de01b -size 7080260 +oid sha256:64fc9ecb3da8ca9cc24a2b8687a26302564b82f606bb84bd6a26e48123a1832a +size 6371687 -- GitLab From 327684a2bd0a2fa901f8b254d8fe2b8609252787 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 10:21:14 +0200 Subject: [PATCH 17/27] Replaced all occurances of .probe with .sample Future deprecation of .probe is announced by pyvista, the recommended replacement is .sample --- cmrsim/datasets/_flow.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmrsim/datasets/_flow.py b/cmrsim/datasets/_flow.py index 3cf2014..5eed8ae 100644 --- a/cmrsim/datasets/_flow.py +++ b/cmrsim/datasets/_flow.py @@ -174,7 +174,8 @@ class RefillingFlowDataset(tf.Module): gridded_seeding_volume = pyvista.ImageData(dimensions=dims + 1, spacing=resolution, origin=origin) - self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) + # self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) + self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh) active_indx = np.where(self.gridded_seeding_volume.ptc().cell_data["in_mesh"] > 0.7) active_cell_centers = self.gridded_seeding_volume.cell_centers().ptc().points[active_indx] @@ -251,7 +252,8 @@ class RefillingFlowDataset(tf.Module): # Re-seed particles in un-populated areas with Monte-Carlo rejection: # 1. Estimate current particle density within slice self._estimate_particle_density(residual_particle_pos[in_tolerance]) - sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) + # sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) + sampled_particle_pos = pyvista.PointSet(sampled_particle_pos).sample(self.gridded_seeding_volume) density = np.array(sampled_particle_pos["density"]) decision_boundaries = density / particle_density # 2. To prevent unintentionally increasing particle density, set the decision boundary @@ -413,4 +415,5 @@ class RefillingFlowDataset(tf.Module): smoothed_histogram = gaussian_filter(residual_histogram / sampling_volume, sigma=sigma, truncate=2.5) self.gridded_mesh.cell_data["density"] = smoothed_histogram.reshape(-1, order="F") - return self.gridded_mesh.probe(self.original_mesh) \ No newline at end of file + return self.original_mesh.sample(self.gridded_mesh) + # return self.gridded_mesh.probe(self.original_mesh) \ No newline at end of file -- GitLab From 85bf59cd1a7413adc2927c76aa5799e96497164d Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 10:22:06 +0200 Subject: [PATCH 18/27] Updated and improved laminar flow with sequental call notebook --- .../bloch_simulation/flow_venc_sGRE_stenosis_sequential.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/flow_venc_sGRE_stenosis_sequential.ipynb b/notebooks/bloch_simulation/flow_venc_sGRE_stenosis_sequential.ipynb index 2da49a6..0ae7f4d 100644 --- a/notebooks/bloch_simulation/flow_venc_sGRE_stenosis_sequential.ipynb +++ b/notebooks/bloch_simulation/flow_venc_sGRE_stenosis_sequential.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf503ff29ee0534f69a43ba7fe5214b31c9e8d8ea43151b98b52f98cad40698a -size 15541521 +oid sha256:7ab05a78ae8be2ac1310584434b29e0bd46985637f15b4b72188e5a42d1a9923 +size 654582 -- GitLab From bf68462da69d1c1e8a7b34bcbbad1b2473e98a3a Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 12:15:53 +0200 Subject: [PATCH 19/27] Updated parallel venc laminar flow notebook --- .../bloch_simulation/flow_mvenc_sGRE_ubend_parallel.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/flow_mvenc_sGRE_ubend_parallel.ipynb b/notebooks/bloch_simulation/flow_mvenc_sGRE_ubend_parallel.ipynb index a0e472c..5e6d5ab 100644 --- a/notebooks/bloch_simulation/flow_mvenc_sGRE_ubend_parallel.ipynb +++ b/notebooks/bloch_simulation/flow_mvenc_sGRE_ubend_parallel.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ab1685f95db98146fe387453b034078b168a7f3c639b0dcbb0f9032c01c9927 -size 3628975 +oid sha256:6be5d373f0fa1b9b29c1b8cb0c32b3042d8f3e8e0b20390c3a843c1f9d3b3a50 +size 2209619 -- GitLab From 844df969b724050605039749d9f53b86f65b1b91 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 13:24:25 +0200 Subject: [PATCH 20/27] updated flow bssp which needs a rerun after fixing .sample bug --- notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb b/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb index dfc5048..3f1f39f 100644 --- a/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb +++ b/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:608c9bae48c6d237eb6c107244ca57fecefd8b661b35bb08e6ad2876095a3a66 -size 718553 +oid sha256:6b6b0bc98bf0640096c3b68a3d555da28ebb12e9fbf4b73fd39a770c4bbaf692 +size 994153 -- GitLab From ddcf595098107181e33d854d899a19abeba5e670 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 21:05:37 +0200 Subject: [PATCH 21/27] Found the reason why the density was not preserved in reseeding when using .sample --- cmrsim/datasets/_flow.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cmrsim/datasets/_flow.py b/cmrsim/datasets/_flow.py index 5eed8ae..305da0d 100644 --- a/cmrsim/datasets/_flow.py +++ b/cmrsim/datasets/_flow.py @@ -109,20 +109,18 @@ class RefillingFlowDataset(tf.Module): uniformly gridded mesh :return: None """ + self.original_mesh = mesh.copy() image_box = np.max(mesh.points, axis=0) - np.min(mesh.points, axis=0) dims = (image_box / lookup_map_spacing).astype(int) resolution = image_box / dims origin = np.min(mesh.points, axis=0) - uniform_grid = pyvista.ImageData(dimensions=dims, - spacing=resolution, - origin=origin) + uniform_grid = pyvista.ImageData(dimensions=dims, spacing=resolution, origin=origin) self.lookup_map_spacing = lookup_map_spacing - - uniform_grid = uniform_grid.sample(mesh) + uniform_grid = uniform_grid.sample(mesh, mark_blank=False) uniform_grid["in_mesh"] = np.array(uniform_grid["vtkValidPointMask"], dtype=np.float64) self.gridded_mesh = uniform_grid - self.original_mesh = mesh + print("Updated Mesh") # pylint: disable=multiple-statements @@ -172,10 +170,9 @@ class RefillingFlowDataset(tf.Module): resolution = image_box / dims origin = np.min(r_slice, axis=0) gridded_seeding_volume = pyvista.ImageData(dimensions=dims + 1, - spacing=resolution, - origin=origin) - # self.gridded_seeding_volume = self.gridded_mesh.probe(gridded_seeding_volume) - self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh) + spacing=resolution, + origin=origin) + self.gridded_seeding_volume = gridded_seeding_volume.sample(self.gridded_mesh, mark_blank=False) active_indx = np.where(self.gridded_seeding_volume.ptc().cell_data["in_mesh"] > 0.7) active_cell_centers = self.gridded_seeding_volume.cell_centers().ptc().points[active_indx] @@ -252,7 +249,6 @@ class RefillingFlowDataset(tf.Module): # Re-seed particles in un-populated areas with Monte-Carlo rejection: # 1. Estimate current particle density within slice self._estimate_particle_density(residual_particle_pos[in_tolerance]) - # sampled_particle_pos = self.gridded_seeding_volume.probe(sampled_particle_pos) sampled_particle_pos = pyvista.PointSet(sampled_particle_pos).sample(self.gridded_seeding_volume) density = np.array(sampled_particle_pos["density"]) decision_boundaries = density / particle_density @@ -416,4 +412,3 @@ class RefillingFlowDataset(tf.Module): sigma=sigma, truncate=2.5) self.gridded_mesh.cell_data["density"] = smoothed_histogram.reshape(-1, order="F") return self.original_mesh.sample(self.gridded_mesh) - # return self.gridded_mesh.probe(self.original_mesh) \ No newline at end of file -- GitLab From f6b8b64015d632c1b8803ad4836ae6129aa8d394 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 21:30:20 +0200 Subject: [PATCH 22/27] rerun with correct re-seeding --- notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb b/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb index 3f1f39f..048a09b 100644 --- a/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb +++ b/notebooks/bloch_simulation/flow_bssfp_submodules_aorta.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6b6b0bc98bf0640096c3b68a3d555da28ebb12e9fbf4b73fd39a770c4bbaf692 -size 994153 +oid sha256:cfbaf63e9a642a2d3bf56aa84084211d14ce4764c42dce40241d211118a65199 +size 979310 -- GitLab From a613339b3fac9cae4d20ff927582a89fca50e023 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 22:16:09 +0200 Subject: [PATCH 23/27] finished bloch notebooks --- notebooks/bloch_simulation/movmesh_bssfp.ipynb | 4 ++-- notebooks/bloch_simulation/movmesh_general_bloch.ipynb | 4 ++-- notebooks/datasets/cardiac_mesh_dataset.ipynb | 4 ++-- notebooks/datasets/refilling_flow_dataset.ipynb | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/notebooks/bloch_simulation/movmesh_bssfp.ipynb b/notebooks/bloch_simulation/movmesh_bssfp.ipynb index bc53407..19be967 100644 --- a/notebooks/bloch_simulation/movmesh_bssfp.ipynb +++ b/notebooks/bloch_simulation/movmesh_bssfp.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:171b06ac848ff03994b8fe9374ded3dd7f958933decad7c35757ae3983123e05 -size 2733609 +oid sha256:9b8df2c2f6a698a5ce28a06441aacf5c3f93c3e95f723bc57ee8a9381e2aa552 +size 2639915 diff --git a/notebooks/bloch_simulation/movmesh_general_bloch.ipynb b/notebooks/bloch_simulation/movmesh_general_bloch.ipynb index 0612af1..7ce68dd 100644 --- a/notebooks/bloch_simulation/movmesh_general_bloch.ipynb +++ b/notebooks/bloch_simulation/movmesh_general_bloch.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:26802a84586ba0ce715b160d22f7a8255b625fd8ecbb1d7058cf7e3b67cfb0a2 -size 90998 +oid sha256:eca080b6452d59631ea97068fbcd817c6d3bb6c78d569e6075faabf1fd406c78 +size 90999 diff --git a/notebooks/datasets/cardiac_mesh_dataset.ipynb b/notebooks/datasets/cardiac_mesh_dataset.ipynb index b7b8138..210e4c9 100644 --- a/notebooks/datasets/cardiac_mesh_dataset.ipynb +++ b/notebooks/datasets/cardiac_mesh_dataset.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7253e082a73975d3e7ea6dcdcd9fa607d3504a4abc5dbb29671071f435a195c5 -size 3793044 +oid sha256:051d57400cd087d33ba33b247fe86381a141a45294c1557187d6b39ebf32161d +size 3821399 diff --git a/notebooks/datasets/refilling_flow_dataset.ipynb b/notebooks/datasets/refilling_flow_dataset.ipynb index f8dbfc8..471205c 100644 --- a/notebooks/datasets/refilling_flow_dataset.ipynb +++ b/notebooks/datasets/refilling_flow_dataset.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:996458fb864d8b98c10ab68c3222c062c4d1cf62260d439625973bcf4c94c37d -size 279000 +oid sha256:b7ec7146a560f6ab24dca736b162b2ba868e4b11e7cd9b0285416ccafe4b7467 +size 646135 -- GitLab From 6d69d14da477b502ad8288da26d1ff26b3a32209 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Fri, 12 Apr 2024 22:16:43 +0200 Subject: [PATCH 24/27] Reran basic functionality notebook --- notebooks/analytic_simulation/1_basic_functionality.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/analytic_simulation/1_basic_functionality.ipynb b/notebooks/analytic_simulation/1_basic_functionality.ipynb index d87822c..f44430a 100644 --- a/notebooks/analytic_simulation/1_basic_functionality.ipynb +++ b/notebooks/analytic_simulation/1_basic_functionality.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6bf9680412df66ad08a714289785460b5ffa245712d0f966aafdbfae05a5efb8 -size 1219948 +oid sha256:c011ef80d4c1f1b5a6f5db422fcab9bbda77c632ef0721344a01f1a69b122729 +size 1306899 -- GitLab From 616e7ec4ca18f7acfec0d36ea37cc2fba74c6713 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Sun, 14 Apr 2024 21:56:32 +0200 Subject: [PATCH 25/27] Updated Bssf analytic notebook --- cmrsim/analytic/encoding/_from_sequence.py | 13 +++++++------ .../analytic_simulation/1_basic_functionality.ipynb | 4 ++-- notebooks/analytic_simulation/2_motion.ipynb | 4 ++-- .../analytic_simulation/3_multiple_coils.ipynb | 4 ++-- .../analytic_simulation/BSSFP_offresonance.ipynb | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/cmrsim/analytic/encoding/_from_sequence.py b/cmrsim/analytic/encoding/_from_sequence.py index f367999..c66df44 100644 --- a/cmrsim/analytic/encoding/_from_sequence.py +++ b/cmrsim/analytic/encoding/_from_sequence.py @@ -81,12 +81,13 @@ class GenericEncoding(BaseSampling): _, k_adc, t_adc = seq.calculate_kspace() k_space.append(k_adc.T) timings.append(t_adc) - - # pylint: disable=no-value-for-parameter, unexpected-keyword-arg - k_space = tf.cast(tf.concat(k_space, axis=0), tf.float32) - # pylint: disable=no-value-for-parameter, unexpected-keyword-arg - timings = tf.cast(tf.concat(timings, axis=0), tf.float32) - return cls(name, k_space, timings, absolute_noise_std, k_space_segments, device) + k_space = np.concatenate(k_space, axis=0, dtype=np.float32) + timings = np.concatenate(timings, axis=0, dtype=np.float32) + # # pylint: disable=no-value-for-parameter, unexpected-keyword-arg + # k_space = tf.cast(tf.concat(k_space, axis=0), tf.float32) + # # pylint: disable=no-value-for-parameter, unexpected-keyword-arg + # timings = tf.cast(tf.concat(timings, axis=0), tf.float32) + return cls(name, [k_space, ], [timings, ], absolute_noise_std, k_space_segments, device) def from_pulseq(self): raise NotImplementedError("Pulseq interface not yet implemented") \ No newline at end of file diff --git a/notebooks/analytic_simulation/1_basic_functionality.ipynb b/notebooks/analytic_simulation/1_basic_functionality.ipynb index f44430a..b4d0dd1 100644 --- a/notebooks/analytic_simulation/1_basic_functionality.ipynb +++ b/notebooks/analytic_simulation/1_basic_functionality.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c011ef80d4c1f1b5a6f5db422fcab9bbda77c632ef0721344a01f1a69b122729 -size 1306899 +oid sha256:b8d56d63e89341adc9e7ef890e94fa029b7ecc8cee5e87ed3944fef570ee7391 +size 1306438 diff --git a/notebooks/analytic_simulation/2_motion.ipynb b/notebooks/analytic_simulation/2_motion.ipynb index b4c1cfe..f86ad21 100644 --- a/notebooks/analytic_simulation/2_motion.ipynb +++ b/notebooks/analytic_simulation/2_motion.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f7ffbb659227027875a88243eb395255f03f7c19eeb248d4fa4d38f77990b3a -size 3231222 +oid sha256:c0382e4d5c6832fa6d13c0c45a27c90314291aeeff35082cb0bbd747dc84aedf +size 3150514 diff --git a/notebooks/analytic_simulation/3_multiple_coils.ipynb b/notebooks/analytic_simulation/3_multiple_coils.ipynb index bbd815c..0952332 100644 --- a/notebooks/analytic_simulation/3_multiple_coils.ipynb +++ b/notebooks/analytic_simulation/3_multiple_coils.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:daacf2559adad01b78ecf763ec4eaa6962edb47bd454064db07352ef5dc51610 -size 2568841 +oid sha256:277fa0161aa58d7ed2598f215a2355ede6f3977e4ef2695a701d4c55a9045521 +size 4888167 diff --git a/notebooks/analytic_simulation/BSSFP_offresonance.ipynb b/notebooks/analytic_simulation/BSSFP_offresonance.ipynb index cd7b41c..96c4f98 100644 --- a/notebooks/analytic_simulation/BSSFP_offresonance.ipynb +++ b/notebooks/analytic_simulation/BSSFP_offresonance.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb017045678b9a3a2299fa7512712d6d045d67a3edd5158adc6ca6d7cbb57964 -size 539217 +oid sha256:593385a3434d5cfd7ea952c1040b071d3074655c41b22144f71bae35db2e31f1 +size 705165 -- GitLab From 96268e44d961193d97ac5c7a4fdfeb39b7aa7922 Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Sun, 14 Apr 2024 22:05:53 +0200 Subject: [PATCH 26/27] Integrated slice selective analytic into docs --- docs/source/conf.py | 2 +- notebooks/analytic_simulation/slice_profile_weighting.ipynb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 299aecd..f3728a7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -177,7 +177,7 @@ nbsphinx_thumbnails = { 'example_gallery/analytic_simulation/3_multiple_coils': '_static/notebook_thumbnails/analytic_multiple_coils.png', 'example_gallery/analytic_simulation/BSSFP_offresonance': '_static/notebook_thumbnails/analytic_static_bssfp.png', 'example_gallery/analytic_simulation/cardiac_dti_with_background': '_static/notebook_thumbnails/analytic_cdti_stylized.png', - 'example_gallery/analytic_simulation/simulate_mrxcat_cmrsim': '_static/notebook_thumbnails/analytic_bssfp.svg', + 'example_gallery/analytic_simulation/slice_profile_weighting': '_static/notebook_thumbnails/analytic_slice_select.png', # Bloch 'example_gallery/bloch_simulation/static_cartesian_SEEPI_shepp': '_static/notebook_thumbnails/static_bloch_epi.svg', 'example_gallery/bloch_simulation/static_cartesian_sGRE_shepp': '_static/notebook_thumbnails/static_bloch_spoiled_gre.svg', diff --git a/notebooks/analytic_simulation/slice_profile_weighting.ipynb b/notebooks/analytic_simulation/slice_profile_weighting.ipynb index ee90635..fc176be 100644 --- a/notebooks/analytic_simulation/slice_profile_weighting.ipynb +++ b/notebooks/analytic_simulation/slice_profile_weighting.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d98481fc96d5498b6863c01f06366c84edf704bb555a610002f485c3132e7426 -size 795512 +oid sha256:ead40d9cec098416e02ae58bdf19c52a0eee73e4c197f1eb9f4b1ff94eece6b8 +size 584225 -- GitLab From 4c78b1b059fbb860f112fca2092805765537bf9c Mon Sep 17 00:00:00 2001 From: Jonathan Weine <jweine@ethz.ch> Date: Sun, 14 Apr 2024 22:06:38 +0200 Subject: [PATCH 27/27] added reduce retracing --- cmrsim/trajectory/_proper_ortho_decomp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmrsim/trajectory/_proper_ortho_decomp.py b/cmrsim/trajectory/_proper_ortho_decomp.py index ce771cd..e9be968 100644 --- a/cmrsim/trajectory/_proper_ortho_decomp.py +++ b/cmrsim/trajectory/_proper_ortho_decomp.py @@ -194,7 +194,7 @@ class PODTrajectoryModule(BaseTrajectoryModule): return tf.ensure_shape(data[:, 0, :3], (None, 3)), additional_data - @tf.function(jit_compile=False) + @tf.function(jit_compile=False, reduce_retracing=True) def _evaluate_trajectory(self, t: tf.Tensor) -> tf.Tensor: """Reconstructs the data state at given times t, by evaluating the taylor series of mode-weights and computing the weighted sum. -- GitLab