User Interface Enhancements

3D Image Enhancements

By default, 3D images do not respond to lighting. The color values are purely determined by the given color function.

show complete Wolfram Language input
In[1]:=
Click for copyable input
func = Blend[{{0, RGBColor[0.035, 0.058, 0, 0]}, {0.1, RGBColor[0.015, 0, 0.035, 0]}, {0.2, RGBColor[0, 0, 0, 0.032]}, {0.3, RGBColor[0.103, 0.032, 0, 0]}, {0.4, RGBColor[0, 0, 0, 0]}, {0.5, RGBColor[0.202, 0.203, 0.218, 0.337]}, {0.6, RGBColor[0.403, 0.405, 0.400, 0.457]}, {0.7, RGBColor[0.485, 0.474, 0.603, 0.682]}, {0.8, RGBColor[0.861, 0.836, 0.838, 0.794]}, {0.9, RGBColor[0.459, 0.475, 0.458, 0.842]}, {1, RGBColor[0.562, 0.519, 0.554, 0.962]}}, #] &; options = {BoxRatios -> {1, 1, 1}, ViewVertical -> {0, -0.5, -1}, ViewPoint -> {Left, Front}, ColorFunction -> func, Boxed -> False};
In[2]:=
Click for copyable input
data = Import["ExampleData/CThead.tiff", "Data"];
In[3]:=
Click for copyable input
img3d = Image3D[data, "Byte", options, ImageSize -> 400]
Out[3]=

Turning on volume lighting can help to highlight surface details. In this case, a directional light is added pointing into the plane of the screen, and specularity is added to the image object.

In[4]:=
Click for copyable input
ImageCrop[ Show[Graphics3D[Specularity[Orange, 3], Background -> Black], Image3D[img3d, Method -> {"VolumeLighting" -> True}], options, Lighting -> {{"Directional", White, ImageScaled[{0, 0, 2}]}}, ImageSize -> 700], {410, 410}]
Out[4]=

Grainy images can be further enhanced by interpolating the values.

In[5]:=
Click for copyable input
fine = ImageCrop[ Show[Graphics3D[Specularity[Orange, 3], Background -> Black], Image3D[img3d, Method -> {"VolumeLighting" -> True, "InterpolateValues" -> True}], options, Lighting -> {{"Directional", White, ImageScaled[{0, 0, 2}]}}, ImageSize -> 700], {410, 410}]
Out[5]=

Visualize the transition from the original to the interpolated and highlighted image.

show complete Wolfram Language input
In[6]:=
Click for copyable input
original = ImageCrop[ Show[img3d, options, Background -> Black, ImageSize -> 700], {410, 410}];
In[7]:=
Click for copyable input
Animate[Overlay[{original, SetAlphaChannel[fine, i]}], {i, 0, 1}, AnimationRate -> 1/3, AnimationDirection -> ForwardBackward]
Play Animation
Stop Animation

Related Examples

de es fr ja ko pt-br ru zh