Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data containing NaN values #1279

Open
Zy18438415851 opened this issue Oct 13, 2023 · 0 comments
Open

Data containing NaN values #1279

Zy18438415851 opened this issue Oct 13, 2023 · 0 comments

Comments

@Zy18438415851
Copy link

Zy18438415851 commented Oct 13, 2023

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!!!
image
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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant