MeVisLab Scripting Reference
MLPagedImageWrapper Class Reference
Inheritance diagram for MLPagedImageWrapper:
MLWriteablePagedImageWrapper

Public Types

enum  DataTypes {
  MLuint8Type = ::MLuint8Type , MLint8Type = ::MLint8Type , MLuint16Type = ::MLuint16Type , MLint16Type = ::MLint16Type ,
  MLuint32Type = ::MLuint32Type , MLint32Type = ::MLint32Type , MLuint64Type = ::MLuint64Type , MLint64Type = ::MLint64Type ,
  MLfloatType = ::MLfloatType , MLdoubleType = ::MLdoubleType , MLcomplexfType = ::MLComplexfType , MLcomplexdType = ::MLComplexdType ,
  MLComplexfType = ::MLComplexfType , MLComplexdType = ::MLComplexdType , MLQuaternionfType = ::MLQuaternionfType , MLQuaterniondType = ::MLQuaterniondType ,
  MLVector2fType = ::MLVector2fType , MLVector2dType = ::MLVector2dType , MLVector3fType = ::MLVector3fType , MLVector3dType = ::MLVector3dType ,
  MLVector4fType = ::MLVector4fType , MLVector4dType = ::MLVector4dType , MLVector5fType = ::MLVector5fType , MLVector5dType = ::MLVector5dType ,
  MLVector6fType = ::MLVector6fType , MLVector6dType = ::MLVector6dType , MLVector7fType = ::MLVector7fType , MLVector7dType = ::MLVector7dType ,
  MLVector8fType = ::MLVector8fType , MLVector8dType = ::MLVector8dType , MLVector9fType = ::MLVector9fType , MLVector9dType = ::MLVector9dType ,
  MLVector10fType = ::MLVector10fType , MLVector10dType = ::MLVector10dType , MLVector16fType = ::MLVector16fType , MLVector16dType = ::MLVector16dType ,
  MLVector32fType = ::MLVector32fType , MLVector32dType = ::MLVector32dType , MLVector64fType = ::MLVector64fType , MLVector64dType = ::MLVector64dType ,
  MLMatrix2fType = ::MLMatrix2fType , MLMatrix2dType = ::MLMatrix2dType , MLMatrix3fType = ::MLMatrix3fType , MLMatrix3dType = ::MLMatrix3dType ,
  MLMatrix4fType = ::MLMatrix4fType , MLMatrix4dType = ::MLMatrix4dType , MLMatrix5fType = ::MLMatrix5fType , MLMatrix5dType = ::MLMatrix5dType ,
  MLMatrix6fType = ::MLMatrix6fType , MLMatrix6dType = ::MLMatrix6dType
}
 
enum  Options { UseImageExtent = -4711 }
 

Public Slots

Property read access


QList< qint64 > imageExtent () const
 
QList< qint64 > pageExtent () const
 
int dataType () const
 
int numPyDataType () const
 
const char * dataTypeName () const
 
QList< double > voxelSize () const
 
double voxelVolumeInCubicMillimeters () const
 
double voxelVolumeInMilliliters () const
 
QVariantList worldToVoxelMatrix () const
 
QVariantList voxelToWorldMatrix () const
 
SbMatrixd worldToVoxelMatrixInventor () const
 
SbMatrixd voxelToWorldMatrixInventor () const
 
QList< double > mapVoxelToWorld (QList< double > vector) const
 
QList< double > mapVoxelToWorld (double x, double y, double z) const
 
QList< double > mapWorldToVoxel (QList< double > vector) const
 
QList< double > mapWorldToVoxel (double x, double y, double z) const
 
double minVoxelValue () const
 
double maxVoxelValue () const
 
QStringList getCDimensionInfos () const
 
QList< QDateTime > getTDimensionInfos () const
 
QStringList getUDimensionInfos () const
 
Image access


PySubImage getTile (const QList< qint64 > &pos, const QList< qint64 > &extent, int dataType=-2, double scale=1.0, double shift=0.)
 
double getInterpolatedValue (const QList< double > xyzPosition, qint64 c=0, qint64 t=0, qint64 u=0, double outsideFillValue=0)
 
QPixmap getSliceAsQPixmap (qint64 z=0, qint64 t=0, qint64 u=0)
 
QImage getSliceAsQImage (qint64 z=0, qint64 t=0, qint64 u=0)
 

Detailed Description

This class allows scripting read access to a ml::PagedImage.

It is available via MLABImageField::image().

Member Enumeration Documentation

◆ DataTypes

static datatypes via enum

Enumerator
MLuint8Type 

MLuint8Type.

MLint8Type 

MLint8Type.

MLuint16Type 

MLuint16Type.

MLint16Type 

MLint16Type.

MLuint32Type 

MLuint32Type.

MLint32Type 

MLint32Type.

MLuint64Type 

MLuint64Type.

MLint64Type 

MLint64Type.

MLfloatType 

MLfloatType.

MLdoubleType 

MLdoubleType.

MLcomplexdType 

MLcomplexfType

MLComplexfType 

MLcomplexdType

MLComplexdType 

MLcomplexfType

MLQuaternionfType 

MLcomplexdType

◆ Options

Additional options that can be used instead of image extent.

Enumerator
UseImageExtent 

special value that can be used when using getTile()

Member Function Documentation

◆ dataType

int MLPagedImageWrapper::dataType ( ) const
slot

get datatype as ML datatype id

◆ dataTypeName

const char* MLPagedImageWrapper::dataTypeName ( ) const
slot

get name of the current datatype as string

◆ getCDimensionInfos

QStringList MLPagedImageWrapper::getCDimensionInfos ( ) const
slot

get information about C dimension

◆ getInterpolatedValue

double MLPagedImageWrapper::getInterpolatedValue ( const QList< double >  xyzPosition,
qint64  c = 0,
qint64  t = 0,
qint64  u = 0,
double  outsideFillValue = 0 
)
slot

Get trilinear interpolated image value at given voxel position (center of a voxel is 0.5,0.5,0.5).

This method can be used for random access, but should not be used to e.g. resample a full dataset, since it has a much larger overhead compared to modules that do the resampling on pages. Values on the image border are filled with the nearest image values and values completely outside of the image are filled with outsideFillValue.

◆ getSliceAsQImage

QImage MLPagedImageWrapper::getSliceAsQImage ( qint64  z = 0,
qint64  t = 0,
qint64  u = 0 
)
slot

Get the selected slice as a QImage.

This returned image is either an RGB or an RGBA image, depending on the number of channels of the image. Only images with at least 3 color channels are supported, an empty image is returned otherwise.

◆ getSliceAsQPixmap

QPixmap MLPagedImageWrapper::getSliceAsQPixmap ( qint64  z = 0,
qint64  t = 0,
qint64  u = 0 
)
slot

Get the selected slice as a QPixmap, see getSliceAsQImage for details.

◆ getTDimensionInfos

QList<QDateTime> MLPagedImageWrapper::getTDimensionInfos ( ) const
slot

get information about T dimension

◆ getTile

PySubImage MLPagedImageWrapper::getTile ( const QList< qint64 > &  pos,
const QList< qint64 > &  extent,
int  dataType = -2,
double  scale = 1.0,
double  shift = 0. 
)
slot

Get the image tile defined by the box [pos,pos+extent-1] as a PySubImage (which is derived from NumPy's ndarray).

The ordering of the dimensions in pos and extent is (x,y,z,c,t,u). The returned image is an N dimensional image where N == len(extent). So if you request an image of extent (256,256), you will get a 2D image. If you request (256,256,3,1,1,1), you will get a 6D image, regardless of the size of 1 of the trailing dimensions. If pos or extent contain less than 6 dimensions, they are filled with 0 for pos and 1 for extent. If one of the values of extent contains the MLPagedImageWrapper::UseImageExtent enum, that value is filled with the image extent. If no datatype is given, the datatype of the input image is used. The data is stored in the ML Memory manager and is owned by the Python scripting engine, it will be automatically garbage collected when the reference to it is lost. Note: This method is only callable via Python scripting. Have a look at the PythonGetTileExample module and example network to see how getTile() is used.

// get first x/y slice using UseImageExtent
image.getTile((0,0,0,0,0,0), (image.UseImageExtent,image.UseImageExtent,1,1,1,1))

◆ getUDimensionInfos

QStringList MLPagedImageWrapper::getUDimensionInfos ( ) const
slot

get information about U dimension

◆ imageExtent

QList<qint64> MLPagedImageWrapper::imageExtent ( ) const
slot

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

◆ mapVoxelToWorld [1/2]

QList<double> MLPagedImageWrapper::mapVoxelToWorld ( double  x,
double  y,
double  z 
) const
slot

transform the given 3d input vector to world coordinates

◆ mapVoxelToWorld [2/2]

QList<double> MLPagedImageWrapper::mapVoxelToWorld ( QList< double >  vector) const
slot

transform the given 3d input vector to world coordinates

◆ mapWorldToVoxel [1/2]

QList<double> MLPagedImageWrapper::mapWorldToVoxel ( double  x,
double  y,
double  z 
) const
slot

transform the given 3d input vector to voxel coordinates

◆ mapWorldToVoxel [2/2]

QList<double> MLPagedImageWrapper::mapWorldToVoxel ( QList< double >  vector) const
slot

transform the given 3d input vector to voxel coordinates

◆ maxVoxelValue

double MLPagedImageWrapper::maxVoxelValue ( ) const
inlineslot

get the maximum voxel value (which defines an upper bound to the values in the image data, not the really present max value)

◆ minVoxelValue

double MLPagedImageWrapper::minVoxelValue ( ) const
inlineslot

get the minimum voxel value (which defines a lower bound to the values in the image data, not the really present min value)

◆ numPyDataType

int MLPagedImageWrapper::numPyDataType ( ) const
slot

get datatype as numpy datatype id

◆ pageExtent

QList<qint64> MLPagedImageWrapper::pageExtent ( ) const
slot

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

◆ voxelSize

QList<double> MLPagedImageWrapper::voxelSize ( ) const
slot

get the voxelsize in (vx, vy, vz) order

◆ voxelToWorldMatrix

QVariantList MLPagedImageWrapper::voxelToWorldMatrix ( ) const
slot

get the voxel to world matrix

◆ voxelToWorldMatrixInventor

SbMatrixd MLPagedImageWrapper::voxelToWorldMatrixInventor ( ) const
slot

get the voxel to world matrix

◆ voxelVolumeInCubicMillimeters

double MLPagedImageWrapper::voxelVolumeInCubicMillimeters ( ) const
slot

Returns the volume of a single voxel in cubic millimeters (mm3).

This returns the correct volume for sheared datasets and calculates fabs( inImg->getVoxelToWorldMatrix().det() ).

◆ voxelVolumeInMilliliters

double MLPagedImageWrapper::voxelVolumeInMilliliters ( ) const
slot

Returns the volume of a single voxel in milliliters (ml).

This returns the correct volume for sheared datasets and calculates fabs( inImg->getVoxelToWorldMatrix().det() ) / 1000.

◆ worldToVoxelMatrix

QVariantList MLPagedImageWrapper::worldToVoxelMatrix ( ) const
slot

get the world to voxel matrix

◆ worldToVoxelMatrixInventor

SbMatrixd MLPagedImageWrapper::worldToVoxelMatrixInventor ( ) const
slot

get the world to voxel matrix as Inventor matrix.