How to display the nan values in the 3D data body as transparent or white colors when using 'volume_slice'?In the below image, brown represents the area with nan value. How can I replace brown with transparent or white color?Hope to receive an answer, thanks a lot!!!my code is as follows:import numpy as npfrom mayavi import mlabpre_cwt = np.load('predicted_Zp_better.npy')fig = mlab.figure(figure='PI', bgcolor=(1, 1, 1), fgcolor=(0, 0, 0))pre_cwt[pre_cwt == 0] = np.nanscalars = pre_cwt # specifying the data arraymlab.volume_slice(scalars, slice_index=0, plane_orientation='x_axes', figure=fig, colormap='jet') # Time slicemlab.volume_slice(scalars, slice_index=0, plane_orientation='y_axes', figure=fig, colormap='jet') # Inline slicemlab.volume_slice(scalars, slice_index=0, plane_orientation='z_axes', figure=fig, colormap='jet') # Xline slicemlab.axes(xlabel='Times(ms)', ylabel='Inline', zlabel='Xline', nb_labels=1) # Add axes labelsmlab.colorbar()mlab.outline()mlab.show()
How to display the nan values in the 3D data body as transparent or white colors when using 'volume_slice'? In the below image, brown represents the area with nan value. How can I replace brown with transparent or white color? Hope to receive an answer, thanks a lot!!! my code is as follows:
import numpy as np
from mayavi import mlab
pre_cwt = np.load('predicted_Zp_better.npy')
fig = mlab.figure(figure='PI', bgcolor=(1, 1, 1), fgcolor=(0, 0, 0))
pre_cwt[pre_cwt == 0] = np.nan
scalars = pre_cwt # specifying the data array
mlab.volume_slice(scalars, slice_index=0, plane_orientation='x_axes', figure=fig, colormap='jet') # Time slice
mlab.volume_slice(scalars, slice_index=0, plane_orientation='y_axes', figure=fig, colormap='jet') # Inline slice
mlab.volume_slice(scalars, slice_index=0, plane_orientation='z_axes', figure=fig, colormap='jet') # Xline slice
mlab.axes(xlabel='Times(ms)', ylabel='Inline', zlabel='Xline', nb_labels=1) # Add axes labels
mlab.colorbar()
mlab.outline()
mlab.show()