mango.image.subsample

mango.image.subsample(input, step=None, start=None, stop=None)

Sub-sample/slice a mango.Dds object. This is akin to numpy.array basic slicing , however a copy of the data is generated (not a view ).

Parameters:
  • input (mango.Dds) – mango.Dds image which is to be sub-sampled.
  • step (3-sequence of int) – The sub-sampling step size, (zStep, yStep, xStep).
  • start (3-sequence of int) – The global index (relative to input.origin) of the first sub-sampled voxel, (zStart, yStart, xStart).
  • stop (3-sequence of int) – The global index (relative to input.origin) of the next-to-last sub-sampled voxel, (zStop, yStop, xStop).
Return type:

mango.Dds

Returns:

Sub-sampled image.

For example::
>>> import mango;
>>> dds = mango.zeros(origin=(16,-32,64), shape=(32,64,128))
>>> ssDds = mango.image.subsample(dds, start=(8,8,16), stop=(24,56,116), step=(2,4,8))
>>> print("ssDds.origin = %s" % (ssDds.origin,))
ssDds.origin = [ 24 -24  80]
>>> print("ssDds.shape  = %s" % (ssDds.shape,))
ssDds.shape  = [ 8 12 13]

Previous topic

mango.image.subset

Next topic

mango.image.gather_slice

This Page