Skip to content

Commit 9bb3123

Browse files
committed
Apply suggestions from code review
1 parent b5e6e4d commit 9bb3123

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

doc/examples/applications/plot_3d_image_processing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
=============== ===============================
2323
2424
Some 3D images are constructed with equal resolution in each dimension (e.g.,
25-
synchrotron tomography or computer-generated rendering of a sphere). Most experimental data are captured
25+
synchrotron tomography or computer-generated rendering of a sphere).
26+
But most experimental data are captured
2627
with a lower resolution in one of the three dimensions, e.g., photographing
2728
thin slices to approximate a 3D structure as a stack of 2D images.
2829
The distance between pixels in each dimension, called spacing, is encoded as a
@@ -94,11 +95,12 @@ def show_plane(ax, plane, cmap="gray", title=None):
9495
ax.set_title(title)
9596

9697

98+
(n_plane, n_row, n_col) = data.shape
9799
_, (a, b, c) = plt.subplots(ncols=3, figsize=(15, 5))
98100

99-
show_plane(a, data[32], title="Plane = 32")
100-
show_plane(b, data[:, 128, :], title="Row = 128")
101-
show_plane(c, data[:, :, 128], title="Column = 128")
101+
show_plane(a, data[n_plane // 2], title="Plane = {}".format(n_plane // 2))
102+
show_plane(b, data[:, n_row // 2, :], title="Row = {}".format(n_row // 2))
103+
show_plane(c, data[:, :, n_col // 2], title="Column = {}".format(n_col // 2))
102104

103105
#####################################################################
104106
# As hinted before, a three-dimensional image can be viewed as a series of

0 commit comments

Comments
 (0)