Wolfram言語

ユーザインターフェースの拡張

三次元画像の強化

デフォルトでは,三次元画像は照明に反応しない.色の値は,単に指定の色関数で決定される.

完全なWolfram言語入力を表示する
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]=

立体の照明をオンにすることによって,曲面の詳細をハイライトすることができる.この場合,スクリーンの平面に向けた指向性照明が追加され,鏡面性が画像オブジェクトに加えられている.

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]=

値を補間することによって,きめの粗い画像をさらにきれいにすることができる.

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]=

もとの画像から補間されハイライトされた画像への変化を可視化する.

完全なWolfram言語入力を表示する
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]
動画を開始
動画を中止

関連する例

de en es fr ko pt-br ru zh