Skip to content

Not able to plot object with original intensity #453

@pranaysingh25

Description

@pranaysingh25

ss
Hi,

I need to plot a vtkimageData, I am using pyvista.plot for this and using add_mesh method. I need to plot my object with original intensity which I am not able to do, For example, the attached picture shows the color of my object which happens to be a tooth in black color, while the original intensity is somewhat white, of different intensities. When I use add_mesh_threshold for plotting, the color of the tooth that gets plotted appears green is color, which is not realistic.

After reading the plotting guide and APIs, I somewhat understand that it has something to do with scalar argument(or is it ?) I also have a little vague understanding of what 'scalars' are ? scalars are optional arguments that can be supplied to add_mesh method, and the documentaiton says "Scalars used to “color” the mesh". I have also tried other intuitive parameters such as "log_scale" = False. But I was not able to get my plot which shows original intensity of the tooth with accurate intensity level at every voxel.
If someone can guide me to understand what are the proper parameters need to be set of which plotting method to use to get what I want, that would be extremely helpful.

For reference to the original intensity , I have also attached a slice from my data which shows the original intensity of the tooth.
Also, here is the code snipped I am using:

import pyvista as pv
Ugrid = pv.UniformGrid(imageData)
plotter = pv.Plotter()
plotter.enable()
plotter.add_mesh_threshold(Ugrid, log_scale=False, cmap='gray')
actor = plotter.show_bounds(grid='front', location='outer', all_edges=True)
cpos = plotter.show(jupyter_backend = 'static', interactive=True)

thanks,
Pranay
ss2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions