DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

ChangeDimensions

Changes the order of the dimensions in an image

SYNOPSIS

dip_Error dip_ChangeDimensions( image, neworder )

FUNCTION

Re-orders the dimensions in an image, optionally removing or adding singleton dimensions (those dimensions with size 1), without copying the data. neworder is a list of the dimension numbers in the new order, for example (1,0,2) will swap the first two dimensions. Setting neworder to 0 removes all singleton dimensions without altering the order. This is useful, for example, after calling a function such as Maximum to compute a maximum projection over one dimension. The output image of Maximum keeps the dimensionality of the input image, and thus has a singleton dimension. To add singleton dimensions, use a negative value in the neworder array. For example, (0,1,-1) adds a 3rd dimension of size 1 to the image.

ARGUMENTS

Data typeNameDescription
dip_ImageimageThe image to modify
dip_IntegerArrayneworderThe new order of the dimensions

SEE ALSO

The image structure

ImageGetDimensions, ImageSetDimensions, ImageGetStride