({{, (RefLink[Image3D, paclet:ref/Image3D])[data] 
represents a 3D image with pixel values given by the array data.}, {, (RefLink[Image3D, paclet:ref/Image3D])[{(Subscript[image, 1]),(Subscript[image, 2]),…}]
creates a 3D image from a list of 2D images.}, {, (RefLink[Image3D, paclet:ref/Image3D])[obj,"type"]
creates a 3D image of the specified data type.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[Image3D, paclet:ref/Image3D]) displays in a notebook as a rendered volume.

In (RefLink[Image3D, paclet:ref/Image3D])[data], by default the first three dimensions correspond to slices, rows, and columns of the 3D image, respectively. Slices are enumerated from top to bottom, rows from back to front, and columns from left to right.

An (RefLink[Image3D, paclet:ref/Image3D]) object with (RefLink[ImageDimensions, paclet:ref/ImageDimensions]) of {width,depth,height} is placed in the 3D space so that in a position {x,y,z} given in the standard image coordinate system, x runs from 0 to width, y runs from 0 to depth, and z runs from 0 to height. The position {0,0,0} corresponds to the bottom-left front corner.

(RefLink[Image3D, paclet:ref/Image3D])[{(Subscript[image, 1]),(Subscript[image, 2]),…,(Subscript[image, height])}] will have (RefLink[ImageDimensions, paclet:ref/ImageDimensions]) of {width,depth,height}, where (RefLink[ImageDimensions, paclet:ref/ImageDimensions])[(Subscript[image, j])] is {width,depth} for each of the 2D images, stacked from top to bottom. »

In (RefLink[Image3D, paclet:ref/Image3D])[data], each element of data can specify values for any number of channels.

Elements of data can be one of the following:

The input array data can be given as a (RefLink[List, paclet:ref/List]), (RefLink[NumericArray, paclet:ref/NumericArray]), (RefLink[SparseArray, paclet:ref/SparseArray]), etc.

(RefLink[Image3D, paclet:ref/Image3D])[data] by default allows values in any range, but displays only values between 0 and 1.

(RefLink[Image3D, paclet:ref/Image3D])[data,"type"] can be used to create a 3D image of a specified data type. Values in data are coerced to the specified type by rounding or clipping. By default, "Real32" is assumed.

Possible settings for "type" include:

(RefLink[Image3D, paclet:ref/Image3D])[image,"type"] can be used to convert between types.

(RefLink[Image3D, paclet:ref/Image3D])[{(Subscript[i, 1]),(Subscript[i, 2]),…}] converts all images to the largest type among the input images.

(RefLink[Image3D, paclet:ref/Image3D])[{(Subscript[i, 1]),(Subscript[i, 2]),…},"type"] converts all images to the specified type.

(RefLink[Image3D, paclet:ref/Image3D]) takes the following options:

(RefLink[Image3D, paclet:ref/Image3D]) also accepts the following (RefLink[Raster3D, paclet:ref/Raster3D]) options:

(RefLink[Image3D, paclet:ref/Image3D]) also accepts the following (RefLink[Graphics3D, paclet:ref/Graphics3D]) options:

With the setting (RefLink[BoxRatios, paclet:ref/BoxRatios])->{(Subscript[s, x]),(Subscript[s, y]),(Subscript[s, z])}, the (RefLink[Image3D, paclet:ref/Image3D]) is rendered in a box of the given side-length ratios.

With (RefLink[ColorFunction, paclet:ref/ColorFunction])->cf, color and opacity of each voxel can be specified. An interactive color function editor is available via the (RefLink[Image3D, paclet:ref/Image3D]) contextual (right-click) menu.

(RefLink[ColorSpace, paclet:ref/ColorSpace])->"space" specifies that values in the data should be interpreted as coordinates in a particular color space. (RefLink[ColorSpace, paclet:ref/ColorSpace])->(RefLink[Automatic, paclet:ref/Automatic]) treats values as arbitrary channel intensities.

Bit images always have (RefLink[ColorSpace, paclet:ref/ColorSpace]) set to (RefLink[Automatic, paclet:ref/Automatic]).

With the setting (RefLink[ColorSpace, paclet:ref/ColorSpace])->"RGB", data given as {r,g,b,a} is taken to include an opacity value a.

With the default setting (RefLink[Interleaving, paclet:ref/Interleaving])->(RefLink[True, paclet:ref/True]), (RefLink[Image3D, paclet:ref/Image3D])[data,…] takes data to be a 3D array of lists {(Subscript[c, 1]),(Subscript[c, 2]),…} of channel values.

With (RefLink[Interleaving, paclet:ref/Interleaving])->(RefLink[False, paclet:ref/False]), (RefLink[Image3D, paclet:ref/Image3D])[data,…] takes data to be a list {(Subscript[v, 1]),(Subscript[v, 2]), …} of 3D arrays of values for each channel.

Explicit settings for (RefLink[ImageSize, paclet:ref/ImageSize]) determine the absolute size at which (RefLink[Image3D, paclet:ref/Image3D]) should be displayed.

With (RefLink[ImageSize, paclet:ref/ImageSize])->(RefLink[Automatic, paclet:ref/Automatic]), the size at which the 3D image should be displayed is determined by the setting for (RefLink[Magnification, paclet:ref/Magnification]).

A setting (RefLink[Magnification, paclet:ref/Magnification])->m specifies that each displayed voxel in (RefLink[Image3D, paclet:ref/Image3D]) is magnified by a factor of m.

With (RefLink[Magnification, paclet:ref/Magnification])->(RefLink[Automatic, paclet:ref/Automatic]), smaller 3D images are typically displayed at larger magnifications, and large 3D images are reduced to fit within available notebook or other display areas.

(RefLink[Image3D, paclet:ref/Image3D])[Image3D[…],opts] effectively resets the options for an (RefLink[Image3D, paclet:ref/Image3D]).

(RefLink[ImageDimensions, paclet:ref/ImageDimensions]), (RefLink[ImageChannels, paclet:ref/ImageChannels]), and (RefLink[ImageType, paclet:ref/ImageType]) find information on the structure of a 3D image.

(RefLink[Image3D, paclet:ref/Image3D])[(RefLink[Raster3D, paclet:ref/Raster3D])[…]] converts a (RefLink[Raster3D, paclet:ref/Raster3D]) object to a 3D image.

Arithmetic and statistical operations such as (RefLink[Log, paclet:ref/Log]), (RefLink[Plus, paclet:ref/Plus]) and (RefLink[Mean, paclet:ref/Mean]) can work directly with images.

(RefLink[Information, paclet:ref/Information]) for (RefLink[Image3D, paclet:ref/Image3D]) may include the following properties:

OpenersPrimaryExamplesSection(Spacer1)Examples  (18)

OpenersExampleSection0(Spacer1)Basic Examples  (4)

Create a real-value 3D image from numbers in the range 0 to 1:

Image3D[RandomReal[1,{5,10,10}]]

Create a three-channel 3D image:

Image3D[RandomReal[1,{5,10,10,3}]]

Create a 3D image from a stack of images:

Image3D[{,,}]

Import a list of images as a 3D volume:

Import["ExampleData/CTengine.tiff","Image3D"]

OpenersExampleSection1(Spacer1)Scope  (4)

OpenersExampleSubsection0(Spacer1)Creating a 3D Image  (2)

Create from a 3D region:

RegionImage[KnotData["Trefoil","Region"]]

Create a 3D volume from an elevation map:

everest=;
data=ImageData[ImageReflect[everest,Top->Bottom]];
data3D=Map[# Table[UnitStep[50 #-k],{k,50}]&,data,{-1}];

Image3D[Reverse@Transpose[data3D,{3,2,1}],ColorFunction->"DarkTerrainOpacity"]

OpenersExampleSubsection1(Spacer1)Arithmetic & Statistical Operations  (2)

Multiply two volumes to highlight a region of interest:

×

Compute statistical measures on images:

i=Import["ExampleData/CTengine.tiff","Image3D"]

stats={Total,Min, Max,Mean,Median,StandardDeviation};Dataset[AssociationThread[Text/@stats->Through[stats[i]]]]

OpenersExampleSection2(Spacer1)Options  (3)

OpenersExampleSubsection2(Spacer1)Background  (1)

Use a black background for volume rendering:

Image3D[ExampleData[{"TestImage3D","MRknee"}],ColorFunction->"XRay",Background->Black]

OpenersExampleSubsection3(Spacer1)BoxRatios  (1)

By default, (RefLink[BoxRatios, paclet:ref/BoxRatios]) is set to the dimensions ratios of the 3D volume:

i=ExampleData[{"TestImage3D","CThead"}]

Set (RefLink[BoxRatios, paclet:ref/BoxRatios]) to the ratios of the object:

Image3D[i,BoxRatios->{1,1,1}]

OpenersExampleSubsection4(Spacer1)ColorFunction  (1)

Default rendering of a grayscale volume:

engine=ExampleData[{"TestImage3D","CTengine"}]

A gray color function with linear opacity is commonly used for rendering of grayscale volumes:

Image3D[engine,ColorFunction->"GrayLevelOpacity"]

Use a gray color function with constant opacity:

Image3D[engine,ColorFunction->(GrayLevel[#,.005]&)]

Use one of the predefined color functions:

Labeled[Image3D[engine,ColorFunction->#],#]&/@{"XRay","HighRange","LowRange","WhiteBlackOpacity","SunsetColorsOpacity","RainbowOpacity"}

Use a customized color function:

Image3D[engine,ColorFunction->(Append[Blend[{LightBlue,Blue,Orange},#],#]&)]

With a fully opaque color function, only the box surface is visible:

Image3D[engine,ColorFunction->GrayLevel]

OpenersExampleSection3(Spacer1)Applications  (1)

Display a motion pattern by blurring an animation in the temporal dimension:

anim = {,,,,,,,,,,,,,,};

Convert the animation frames into an (RefLink[Image3D, paclet:ref/Image3D]) object:

image3D=Image3D[anim,ColorFunction->"GrayLevelOpacity",BoxRatios->{1,1,1/4}]

Blur along the slices to get a temporal interpolation:

Image3DSlices[Blur[image3D,{3,0,0}],{10}][[1]]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Use (RefLink[Show, paclet:ref/Show]) to combine 3D vector graphics and (RefLink[Image3D, paclet:ref/Image3D]) objects:

i=;
{dx,dy,dz}=ImageDimensions[i];
s=20;
Show[i,Graphics3D[{RGBColor[0,0,1,.2],Polygon[{{0,0,s},{0,dy,s},{dx,dy,s},{dy,0,s}}]}]]

OpenersExampleSection5(Spacer1)Possible Issues  (2)

Placing a grayscale image into an (RefLink[Image3D, paclet:ref/Image3D]) object will change the overall visualization:

i=;

Image3D[{i}]

Use (RefLink[GrayLevel, paclet:ref/GrayLevel]) color function to see similar gray values:

Image3D[{i},ColorFunction->GrayLevel]

White background is not suitable when rendering binary images with a gray color function:

Image3D[DiskMatrix[{10,10,10}],"Bit",ColorFunction->"GrayLevelOpacity"]

Use a black background:

Image3D[DiskMatrix[{10,10,10}],"Bit",ColorFunction->"GrayLevelOpacity",Background->Black]

Adding a box can also help make the 3D object more visible:

Image3D[DiskMatrix[{10,10,10}],"Bit",ColorFunction->"GrayLevelOpacity",Background->Black,Boxed->True]

OpenersExampleSection6(Spacer1)Neat Examples  (3)

Evolution of a 2D cellular automaton:

Image3D[#, ImageSize -> 150] & /@
 CellularAutomaton[{14, {2, 1}, {1, 1, 1}}, {{{{1}}}, 0},8]

Evolution of a Game of Life cellular automaton:

Image3D[CellularAutomaton[{224,{2,{{2,2,2},{2,1,2},{2,2,2}}},{1,1}},{SeedRandom[1];RandomInteger[1,{15,15}],0},50]]

Blurred evolution of a discrete 2D cellular automaton, reminiscent of diffusion processes in the continuous domain:

Blur[Image3D[CellularAutomaton[{52212111133224,{3,{{2,2,2},{2,1,2},{2,2,2}}},{1,1}},{SeedRandom[1];RandomInteger[1,{15,15}],0},150],ImageSize->100],3]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Raster3D, paclet:ref/Raster3D])  ▪  (RefLink[Image, paclet:ref/Image])  ▪  (RefLink[Import, paclet:ref/Import])  ▪  (RefLink[ImageData, paclet:ref/ImageData])  ▪  (RefLink[Image3DSlices, paclet:ref/Image3DSlices])  ▪  (RefLink[Image3DProjection, paclet:ref/Image3DProjection])  ▪  (RefLink[ImageType, paclet:ref/ImageType])  ▪  (RefLink[ImageDimensions, paclet:ref/ImageDimensions])  ▪  (RefLink[Graphics3D, paclet:ref/Graphics3D])  ▪  (RefLink[ImageQ, paclet:ref/ImageQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[3D Images, paclet:guide/3DImages])}, {▪(RefLinkPlain[Image Processing & Analysis, paclet:guide/ImageProcessing])}, {▪(RefLinkPlain[Image Representation, paclet:guide/ImageRepresentation])}, {▪(RefLinkPlain[Creating & Importing Images, paclet:guide/CreatingAndImportingImages])}, {▪(RefLinkPlain[Image Computation for Microscopy, paclet:guide/ImageComputationForMicroscopy])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/13-arrays-or-lists-of-lists.html])(WebLink[: Arrays, or Lists of Lists, https://www.wolfram.com/language/elementary-introduction/13-arrays-or-lists-of-lists.html])}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/29-more-about-pure-functions.html])(WebLink[: More about Pure Functions, https://www.wolfram.com/language/elementary-introduction/29-more-about-pure-functions.html])}})}})