kopia lustrzana https://github.com/animator/learn-python
Visualizing_nifti_files.md
rodzic
0e54b70649
commit
dbe3af270a
|
@ -84,6 +84,37 @@ plt.imshow(brain_vol_data[96], cmap='bone')
|
|||
plt.axis('off')
|
||||
plt.show()
|
||||
```
|
||||
The image can be rotated
|
||||
```
|
||||
plt.imshow(ndi.rotate(brain_vol_data[96], 90), cmap='bone')
|
||||
plt.axis('off')
|
||||
plt.show()
|
||||
```
|
||||
### Plot a series of slices
|
||||
```
|
||||
fig_rows = 4
|
||||
fig_cols = 4
|
||||
n_subplots = fig_rows * fig_cols
|
||||
n_slice = brain_vol_data.shape[0]
|
||||
step_size = n_slice // n_subplots
|
||||
plot_range = n_subplots * step_size
|
||||
start_stop = int((n_slice - plot_range) / 2)
|
||||
|
||||
fig, axs = plt.subplots(fig_rows, fig_cols, figsize=[10, 10])
|
||||
|
||||
for idx, img in enumerate(range(start_stop, plot_range, step_size)):
|
||||
axs.flat[idx].imshow(ndi.rotate(brain_vol_data[img, :, :], 90), cmap='gray')
|
||||
axs.flat[idx].axis('off')
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
```
|
||||
### Multiples slices at once
|
||||
```
|
||||
plotting.plot_img(brain_vol, display_mode='mosaic', cmap='gray')
|
||||
plt.show()
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue