Skip to content

Commit 3255a72

Browse files
authored
Merge pull request #247 from ACRF-Image-X-Institute/new_plot
New plot
2 parents ebfff8c + c7669cd commit 3255a72

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

mri_distortion_toolkit/MarkerAnalysis.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ def plot_markers_inner(plot_data):
11921192
plot_markers_inner(plot_data)
11931193
plt.show()
11941194

1195-
def plot_reference_markers(self, title='Reference alignment markers'):
1195+
def plot_reference_markers(self, title='Reference alignment markers'): # pragma: no cover
11961196

11971197
try:
11981198
fig = plt.figure()
@@ -1213,6 +1213,39 @@ def plot_reference_markers(self, title='Reference alignment markers'):
12131213
plt.legend(['ground truth', 'distorted'])
12141214
plt.show()
12151215

1216+
def plot_3D_markers_with_color_scale(self, cmap=None, title=None, elevation=None, azimuth=None,
1217+
vmin=None, vmax=None, return_axs=False): # pragma: no cover
1218+
1219+
if cmap is None:
1220+
cmap = plt.cm.viridis
1221+
1222+
fig = plt.figure()
1223+
axs = fig.add_subplot(111, projection='3d')
1224+
1225+
x_dis = np.abs(self.MatchedCentroids.x_gt - self.MatchedCentroids.x_gnl)
1226+
y_dis = np.abs(self.MatchedCentroids.y_gt - self.MatchedCentroids.y_gnl)
1227+
z_dis = np.abs(self.MatchedCentroids.z_gt - self.MatchedCentroids.z_gnl)
1228+
abs_dis = np.sqrt(x_dis ** 2 + y_dis ** 2 + z_dis ** 2)
1229+
p = axs.scatter(self.MatchedCentroids.x_gt, self.MatchedCentroids.y_gt, self.MatchedCentroids.z_gt,
1230+
c=abs_dis, cmap=cmap, vmin=vmin, vmax=vmax)
1231+
fig.colorbar(p, ax=axs)
1232+
if elevation:
1233+
axs.elev = elevation
1234+
if azimuth:
1235+
axs.azim = azimuth
1236+
axs.set_xlabel('X [mm]')
1237+
axs.set_ylabel('Y [mm]')
1238+
axs.set_zlabel('Z [mm]')
1239+
if title:
1240+
axs.set_title(title)
1241+
axs.set_box_aspect((np.ptp(self.MatchedCentroids.x_gt), np.ptp(self.MatchedCentroids.y_gt),
1242+
np.ptp(self.MatchedCentroids.z_gt)))
1243+
1244+
if return_axs:
1245+
return axs
1246+
else:
1247+
plt.show()
1248+
12161249

12171250
def report(self):
12181251
x_dis = np.abs(self.MatchedCentroids.x_gt - self.MatchedCentroids.x_gnl)

mri_distortion_toolkit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
https://acrf-image-x-institute.github.io/MRI_DistortionQA/index.html
55
"""
66

7-
__version__ = '0.14.2'
7+
__version__ = '0.14.3'
88
try:
99
import FreeCAD
1010
except ImportError:

0 commit comments

Comments
 (0)