MeVisLab Scripting Reference
PySubImage Class Reference

#include <PySubImage.h>

Public Member Functions

Property read access


ml::ImageVector origin () const
 
void setOrigin (ml::ImageVector origin) const
 
ml::ImageVector extent () const
 
ml::ImageVector imageExtent () const
 
ml::ImageVector validExtent () const
 
ml::SubImageBox validRegion () const
 
bool hasInvalidRegion () const
 
ml::SubImageBox box () const
 
ml::ImageVector sourceImageExtent () const
 
MLDataType dataType () const
 
const char * dataTypeName () const
 
void copySubImage (ml::SubImage *image, double scale=1., double shift=0, ml::ImageVector offset=ml::ImageVector(0), bool ignoreOrigin=false)
 
void fillInvalidRegionWithBorderValues ()
 
void fillInvalidRegionWithValue (double value)
 

Detailed Description

Allows access to the data of an ML subimage.

This is a Python class that is derived from NumPy's ndarray (http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html) and offers all properties of ndarray in addition to the listed methods. NOTE: ML subimages/pages are typically 6 dimensional and NumPy handles the dimensions in a different ordering than the ML convention. So if you use indexing in NumPy, keep in mind that you have to either do ndarray.squeeze() to get rid of the dimensions that are 1 or you need to write N leading zeros to fill up all 6 dimensions. All methods listed below expect/return (x,y,z,c,t,u) order using the ML convention, while NumPy methods like ndarray.shape will return (u,t,c,z,y,x).

Member Function Documentation

◆ box()

ml::SubImageBox PySubImage::box ( ) const

get the box of the subimage (composed of [origin, origin+extent-1]

◆ copySubImage()

void PySubImage::copySubImage ( ml::SubImage * image,
double scale = 1.,
double shift = 0,
ml::ImageVector offset = ml::ImageVector(0),
bool ignoreOrigin = false )

copy the given image into this image, using the region which intersects, optionally scaling/shifting the data.

The given offset can be used to translate the copied image. All arguments are available as Python keyword arguments, so you can for example do:

image.copySubImage(other, offset=(24,24,0,0,0,0))

◆ dataType()

MLDataType PySubImage::dataType ( ) const

get the ML datatype of the subimage

◆ dataTypeName()

const char * PySubImage::dataTypeName ( ) const

get the ML datatype name of the subimage

◆ extent()

ml::ImageVector PySubImage::extent ( ) const

get the extent of the subimage in (x,y,z,c,t,u) order

◆ fillInvalidRegionWithBorderValues()

void PySubImage::fillInvalidRegionWithBorderValues ( )

Fill the invalid region of a page with border image values (this filles everything outside of validRegion() and does nothing if validRegion()==box())

◆ fillInvalidRegionWithValue()

void PySubImage::fillInvalidRegionWithValue ( double value)

Fill the invalid region of a page with clamped image values (this filles everything outside of validRegion() and does nothing if validRegion()==box())

◆ hasInvalidRegion()

bool PySubImage::hasInvalidRegion ( ) const

returns if the image has an invalid region

◆ imageExtent()

ml::ImageVector PySubImage::imageExtent ( ) const

get the extent of the subimage in (x,y,z,c,t,u) order

◆ origin()

ml::ImageVector PySubImage::origin ( ) const

get the origin of the subimage relative to its source image in (x,y,z,c,t,u) order

◆ setOrigin()

void PySubImage::setOrigin ( ml::ImageVector origin) const

set the origin of the subimage relative to its source image in (x,y,z,c,t,u) order

◆ sourceImageExtent()

ml::ImageVector PySubImage::sourceImageExtent ( ) const

get the extent of the source image that this subimage was created from in (x,y,z,c,t,u) order

◆ validExtent()

ml::ImageVector PySubImage::validExtent ( ) const

get the valid extent of the subimage (which means clipping agains the source image extent) in (x,y,z,c,t,u) order

◆ validRegion()

ml::SubImageBox PySubImage::validRegion ( ) const

get the valid region of the subimage (which means clipping agains the source image extent)