"Image3D" (Net Encoder)


represents an encoder that converts a 3D image to a rank-4 tensor of pixel values.


represents an encoder that resizes the 3D input image to size.


represents an encoder that resizes the input 3D image to the specified dimensions.


represents an encoder with specific parameters for preprocessing.


  • NetEncoder[][input] applies the encoder to an input to produce a "Real32" output.
  • NetEncoder[][{input1,input2,}] applies the encoder to a list of inputs to produce a list of outputs.
  • When given a NumericArray as input, the output will be a NumericArray.
  • The input to the encoder can be an Image3D[] object or a File[] expression.
  • NetEncoder["Image3D"] is equivalent to NetEncoder[{"Image3D",{128,128,128}}].
  • The output of the encoder is a rank-4 tensor with dimensions {channelsize,height,depth,width}.
  • An encoder can be attached to an input port of a net by specifying "port"->NetEncoder[] when constructing the net.
  • Parameters
  • The following parameters are supported:
  • ColorSpace"RGB"color space to use for encoding
    InterleavingFalsewhether channels are interleaved
    "MeanImage"Nonemean image to subtract
    "VarianceImage"Nonevariance image to normalize by
    Method"Stretch"how to conform the size
    ResamplingAutomaticresampling method
    AlignmentCenterhow to align the image for Method"Fit" or "Fill"
    PaddingBlackpadding scheme for Method"Fit"
  • Possible values for Method are:
  • "Stretch"stretch the image to fit by resampling
    "Fit"fit the whole image; keep the aspect ratio; pad if necessary
    "Fill"fit the smaller dimension; crop the other if necessary
  • The parameter ColorSpace can take the same values as the ColorSpace option.
  • The output of the encoder is a rank-4 array of shape {c,height,depth,width} when InterleavingFalse and {height,depth,width,c} when InterleavingTrue, where c is the number of color channels.
  • The following settings can be used for "MeanImage" and "VarianceImage":
  • Nonedo not subtract anything
    mvalue to subtract from each channel of each pixel
    {m1,m2,}values to be subtracted from different channels
    Image3D[]overall image to subtract
  • Pixels are normalized to lie between 0 and 1 before doing subtraction.


Basic Examples  (1)

Create a 3D image encoder with a specified output size:

Apply the encoder to a 3D image: