How to make 3d medical images more contrast?

Hello!
I am trying to plot a 3D medical image, so I get an image like that

This is my code:

How do I get a different angle of light to see the contrast better?

Hi, here is a example you could try:

1 Like

Why I can’t use fig.update(lighting) ?

@phungkien2001

  • It is recommended to use go.Mesh3d to plot meshes. figure_factory.create_trisurfis obsolete.
    It was defined a few years before go.Mesh3d.
  • In addition to setting lighting and lightposition, you can also try setting flatshading=True, in the go.Mesh3d instance, like here:
    https://chart-studio .plotly.com/~empet/14749
  • The values in lighting dict are set by trial and error.

Here are two more examples:
hand:

lighting=dict(ambient=0.1,
              diffuse=1,
              fresnel=4,
              specular=0.5,
              roughness=0.05),
lightposition=dict(x=100,
                   y=200,
                   z=100)

brain settings:

flatshading=true,
lighting=dict(ambient=0.65,
              diffuse=0.5,
              fresnel=0.25,        
              specular=0.25,
              roughness=0.25,
              facenormalsepsilon=0,
              vertexnormalsepsilon=0),
lightposition=dict(x=100,
                   y=100,
                   z=10) 

iso-brain

  • fig.update(lighting) doesn’t work because lighting is a property of the go.Surface or go.Mesh3d, not of go.Figure
    Usefig.update_traces(lighting=dict()) instead.

@empet
Thanks a lot for your reply. In figure_factory.create_trisurf have a function-like ‘simples’, so what is the alternative in go-mesh3D?

@phungkien2001
simplices is an array of ints of shape (n, 3).
The lists ( arrays) of i, j, k from go.Mesh3d definition are:

i, j,k = simplices.T

See here https://chart-studio.plotly.com/~empet/15522 how trisurfs are defined and plotted as go.Mesh3d instances.

Your answer is so amazing !!! Thank you so much.

1 Like