|
22 | 22 | =============== =============================== |
23 | 23 |
|
24 | 24 | 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 |
26 | 27 | with a lower resolution in one of the three dimensions, e.g., photographing |
27 | 28 | thin slices to approximate a 3D structure as a stack of 2D images. |
28 | 29 | 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): |
94 | 95 | ax.set_title(title) |
95 | 96 |
|
96 | 97 |
|
| 98 | +(n_plane, n_row, n_col) = data.shape |
97 | 99 | _, (a, b, c) = plt.subplots(ncols=3, figsize=(15, 5)) |
98 | 100 |
|
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)) |
102 | 104 |
|
103 | 105 | ##################################################################### |
104 | 106 | # As hinted before, a three-dimensional image can be viewed as a series of |
|
0 commit comments