Module: soma.aimsalgo

soma.aimsalgo.AimsChamferDistanceMap()
soma.aimsalgo.AimsConnectivityChamferDistanceMap()
soma.aimsalgo.AimsCorrelationRatio()
soma.aimsalgo.AimsDistanceFrontPropagation()
soma.aimsalgo.AimsEntropy()
soma.aimsalgo.AimsFloatChamferDistanceMap()
soma.aimsalgo.AimsFloatSignedChamferDistanceMap()
soma.aimsalgo.AimsGeneralizedKnnParzenPdf()
class soma.aimsalgo.AimsGradientMethod

Bases: int

class soma.aimsalgo.AimsGradient_FLOAT

Bases: sip.wrapper

T()
X()
Y()
Z()
soma.aimsalgo.AimsJointMaskPdf()
soma.aimsalgo.AimsJointPdf()
soma.aimsalgo.AimsKnnPdf()
soma.aimsalgo.AimsMeshFilterConnectedComponent()
out_tex = AimsMeshFilterConnectedComponent(mesh, inittex, label, background=0,

ncomp=1, min_npts=0, min_surf=0.)

Split label “label” into connected components, then filter smaller ones out. Original values are left unchanged, except for filtered out regions which will be given the label “background” (0 by default).

Filtering can keep the “ncomp” largest components, and suppress regions with fewer than “min_npts” vertices, and regions under the surface area “min_surf”. If any of these criterions is 0, then filtering for this criterion doesn’t happen.

out_tex = AimsMeshFilterConnectedComponent(mesh, inittex, label, background=0,

ncomp=1, min_npts=0, min_surf=0.)

Split label “label” into connected components, then filter smaller ones out. Original values are left unchanged, except for filtered out regions which will be given the label “background” (0 by default).

Filtering can keep the “ncomp” largest components, and suppress regions with fewer than “min_npts” vertices, and regions under the surface area “min_surf”. If any of these criterions is 0, then filtering for this criterion doesn’t happen.

out_tex = AimsMeshFilterConnectedComponent(mesh, inittex, label, background=0,

ncomp=1, min_npts=0, min_surf=0.)

Split label “label” into connected components, then filter smaller ones out. Original values are left unchanged, except for filtered out regions which will be given the label “background” (0 by default).

Filtering can keep the “ncomp” largest components, and suppress regions with fewer than “min_npts” vertices, and regions under the surface area “min_surf”. If any of these criterions is 0, then filtering for this criterion doesn’t happen.

soma.aimsalgo.AimsMeshLabelConnectedComponent()
soma.aimsalgo.AimsMeshLabelConnectedComponent2Texture()
soma.aimsalgo.AimsMorphoChamferClosing()
soma.aimsalgo.AimsMorphoChamferDilation()
soma.aimsalgo.AimsMorphoChamferErosion()
soma.aimsalgo.AimsMorphoChamferOpening()
soma.aimsalgo.AimsMorphoClosing()
soma.aimsalgo.AimsMorphoDilation()
soma.aimsalgo.AimsMorphoErosion()
class soma.aimsalgo.AimsMorphoMode

Bases: int

soma.aimsalgo.AimsMorphoOpening()
soma.aimsalgo.AimsMutualInformation()
soma.aimsalgo.AimsParzenJointPdf()
soma.aimsalgo.AimsParzenPdf()
soma.aimsalgo.AimsPdf()
soma.aimsalgo.AimsVoronoiFrontPropagation()
soma.aimsalgo.AimsWinParzenJointPdf()
soma.aimsalgo.AimsWinParzenPdf()
class soma.aimsalgo.BucketMapSampler_FLOAT_3

Bases: soma.aimsalgo.aimsalgo.GeneralSampler_FLOAT_3

sample()
class soma.aimsalgo.CubicResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.CubicResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using cubic interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.DiffusionSmoother_FLOAT

Bases: sip.wrapper

SetDt()
doSmoothing()
dt()
optimal()
removeConstantSources()
setConstantSources()
class soma.aimsalgo.DiffusionSmoother_S16

Bases: sip.wrapper

SetDt()
doSmoothing()
dt()
optimal()
removeConstantSources()
setConstantSources()
class soma.aimsalgo.Gaussian2DSmoothing_DOUBLE

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_FLOAT

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_S16

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_S32

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_U16

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_U32

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian2DSmoothing_U8

Bases: sip.wrapper

doit()
class soma.aimsalgo.Gaussian3DSmoothing_DOUBLE(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_FLOAT(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_S16(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_S32(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_U16(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_U32(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.Gaussian3DSmoothing_U8(sx=1., sy=1., sz=1.)

Bases: sip.wrapper

Parameters
  • sx (float) – filter stdev (sigma) on x direction (mm)

  • sy (float) – filter stdev (sigma) on y direction (mm)

  • sz (float) – filter stdev (sigma) on z direction (mm)

3D Deriche’s recursive gaussian smoothing filter

doit(volume)

Actually perform the smoothing on the given data.

Parameters

volume (Volume) – data to be smoothed

Returns

smoothed – smoothed volume

Return type

Volume

class soma.aimsalgo.GeneralSampler_FLOAT_3

Bases: sip.wrapper

sample()
class soma.aimsalgo.GeometricMoment_DOUBLE

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_DOUBLE

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_FLOAT

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_FLOAT

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_S16

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_S16

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_S32

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_S32

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_U16

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_U16

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_U32

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_U32

doit()
setMomentType()
update()
class soma.aimsalgo.GeometricMoment_U8

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_U8

doit()
setMomentType()
update()
class soma.aimsalgo.Histogram_DOUBLE

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_FLOAT

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_S16

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_S32

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_U16

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_U32

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.Histogram_U8

Bases: sip.wrapper

data()
doit()
class soma.aimsalgo.LinearResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.LinearResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using linear (order 1) interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MajorityLabelResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using majority vote interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MaskLinearResampler_S16(*args)

Bases: soma.aimsalgo.Resampler_S16

Volume resampler using linear (order 1) interpolation.

This resampler shows unreliable behaviour: depending of the platform it does not always resample the last element along each axis correctly. Also, it uses some clever optimizations that do not check for overflow. If you need such a masked resampler, please consider contributing a fixed version.

This resampler will consider input voxels that are equal to -32768 (hard-coded) as masked. The mask value (-32768) will always be returned for any interpolation involving a masked voxel.

The default background value for this resampler is -32768 (same as the mask value).

The resampling API is described in the base class, Resampler_S16.

class soma.aimsalgo.MaskedDiffusionSmoother_FLOAT

Bases: sip.wrapper

add_neumann_condition()
doSmoothing()
setMask()
class soma.aimsalgo.MaskedDiffusionSmoother_S16

Bases: sip.wrapper

add_neumann_condition()
doSmoothing()
setMask()
class soma.aimsalgo.MedianResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using median interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.MedianSmoothing_DOUBLE

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_FLOAT

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_S16

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_S32

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_U16

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_U32

Bases: sip.wrapper

doit()
class soma.aimsalgo.MedianSmoothing_U8

Bases: sip.wrapper

doit()
class soma.aimsalgo.MeshToVoxelsResampler_BucketMap_VOID

Bases: sip.wrapper

doit()
class soma.aimsalgo.MeshToVoxelsResampler_rc_ptr_Volume_U32

Bases: sip.wrapper

doit()
class soma.aimsalgo.Mesher

Bases: sip.wrapper

Mesh binary objects in a volume and produce surface meshes.

LAPLACIAN = 0
LOWPASS = 3
POLYGONSPRING = 2
SIMPLESPRING = 1
class SmoothingType

Bases: int

decimate()
doit(object_to_mesh, filename_base, write_mode='binar')

Mesh every interface of objects in the input label volume. Each mesh is written in a separate file. Files are numbered according to objects interfaces (label1_label2) and an interface number for this pair of objects. write_mode is an old flag to write files in ascii or binary modes. It’s obsolete.

object_to_mesh may be a volume of int16 values (labels), or a bucket. When meshing a volume, the input volume should have a border of at least 1 voxel, filled with the value -1. If not, a new one will be allocated to perform the operation, thus using more memory and a copy overhead.

mesh_dict = mesher.doit(object_to_mesh)

Mesh every interface of objects in the input label volume or bucket. The result is a map (dict-like) which keys are voxel labels, and values are lists of meshes.

getBrain(object_to_mesh, mesh, insideinterface=False)

Get a smoothed mesh of the external (unless insideinterface is True) interface of the biggest object.

ct_to_mesh may be a volume of int16 values (labels), or a bucket.

meshing a volume, the input volume should have a border of at least

xel, filled with the value -1. If not, a new one will be allocated to perform the operation, thus using more memory and a copy overhead.

getSingleLabel()
getWhite(object_to_mesh, mesh)

Get a smoothed mesh of the intternal interface of the biggest object.

ct_to_mesh may be a volume of int16 values (labels), or a bucket.

meshing a volume, the input volume should have a border of at least

xel, filled with the value -1. If not, a new one will be allocated to perform the operation, thus using more memory and a copy overhead.

setDecimation()
setDecimation(deciReductionRate, deciMaxClearance, deciMaxError,

deciFeatureAngle)

good values: deciReductionRate: 99.0 (%) deciMaxClearance: 3.0 deciMaxError: 0.2 deciFeatureAngle: 180.0 (deg)

setLabelInf()
setLabelSup()
setMinFacetNumber()
setMinSurface()
setSmoothing(smoothType, nIteration, smoothRate)

Smoothing parameters

Parameters
  • smoothType (enum) – LOWPASS, LAPLACIAN, SIMPLESPRING, POLYGONSPRING

  • smoothIt (int) – 30

  • smoothRate (float) – in [0.0;1.0] (instance : 0.4)

setSmoothingLaplacian(featureAngle)

good value: 180. degrees

setSmoothingSpring(smoothForce)

in [0.0;1.0]. Good value: 0.2

setSplitting()
setVerbose()
smooth()
unsetDecimation()
unsetSmoothing()
unsetSplitting()
verbose()
class soma.aimsalgo.MomentBase

Bases: sip.wrapper

Incremental = 1
class MomentType

Bases: int

Normal = 0
Surfacic = 3
Volumic = 2
class soma.aimsalgo.MomentInvariant_DOUBLE

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_FLOAT

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_S16

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_S32

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_U16

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_U32

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.MomentInvariant_U8

Bases: sip.wrapper

I00_2 = 0
I112_23 = 9
I11_3 = 3
I123_23 = 10
I222_3 = 2
I22_2 = 1
I233_23 = 11
I3111_3 = 5
I3131_3 = 6
I3331_3 = 7
I3333_3 = 8
I33_3 = 4
class InvariantId

Bases: int

doit()
invariant()
moment()
update()
class soma.aimsalgo.Moment_DOUBLE

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_FLOAT

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_S16

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_S32

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_U16

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_U32

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.Moment_U8

Bases: sip.wrapper

class MomentId

Bases: int

class Operation

Bases: int

doit()
eigenValue()
eigenVector()
gravity()
m0()
m000 = 0
m001 = 2
m002 = 2
m003 = 2
m010 = 1
m011 = 5
m012 = 8
m020 = 1
m021 = 6
m030 = 1
m1()
m100 = 0
m101 = 4
m102 = 7
m110 = 3
m111 = 9
m120 = 5
m2()
m200 = 0
m201 = 4
m210 = 3
m3()
m300 = 0
mAdd = 1
mSub = -1
orientation()
sum()
class soma.aimsalgo.MorphoGreyLevel_DOUBLE

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_DOUBLE) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_DOUBLE

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_DOUBLE) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_DOUBLE

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_DOUBLE) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_DOUBLE

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_DOUBLE) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_DOUBLE

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_FLOAT

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_FLOAT) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_FLOAT

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_FLOAT) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_FLOAT

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_FLOAT) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_FLOAT

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_FLOAT) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_FLOAT

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_S16

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_S16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S16

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_S16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S16

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_S16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S16

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_S16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S16

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_S32

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_S32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S32

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_S32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S32

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_S32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S32

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_S32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_S32

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_U16

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_U16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U16

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_U16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U16

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_U16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U16

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_U16) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U16

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_U32

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_U32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U32

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_U32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U32

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_U32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U32

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_U32) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U32

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.MorphoGreyLevel_U8

Bases: sip.wrapper

Grey-level mathematical morphology.

when enabled, on binary images, the chamfer-based morphomath is used instead of the grey-level one. This is the default as it is way faster (see setChamferBinaryMorphoEnabled).

In binary mode, the input data (volume) should contain a border of “sufficent” size. The border size will be checked, and a new volume with larger border will be temporarily allocated and used if needed, but it is more efficient (and consumes less memory) if this border is already allocated in the input image.

Grey-level operations do not need a border in input images, the test is included in the algorithm (which makes it even slower).

See the method neededBorderWidth().

This class thus regroups all basic morphological operations, and makes obsolete direct calls to AimsMorphoChamferErosion(), AimsMorphoChamferDilation(), AimsMorphoChamferClosing(), AimsMorphoChamferOpening().

chamferFactor()

chamfer factor is used to store chamfer distances as int with a sufficient precision. Used only in binary operations. The default is 50.

chamferMaskSize()

Get the chamfer mask size used in binary operations. The default is 3x3x3.

Returns

mask_size – size in the 3 directions, in voxels

Return type

Point3df

doClosing(dataIn, radius)

Closing operation (dilation + erosion)

Parameters
  • dataIn (rc_ptr_Volume_U8) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U8

doDilation(dataIn, radius)

Dilation operation

Parameters
  • dataIn (rc_ptr_Volume_U8) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U8

doErosion(dataIn, radius)

Erosion operation

Parameters
  • dataIn (rc_ptr_Volume_U8) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U8

doOpening(dataIn, radius)

Opening operation (erosion + dilation)

Parameters
  • dataIn (rc_ptr_Volume_U8) – volume to perform the operation on

  • radius (float) – radius of the morphological operation (in mm)

Returns

result

Return type

rc_ptr_Volume_U8

isBinary()

Tells if the given volume is considered a binary volume and thus is compatible with binary fast operators.

isChamferBinaryMorphoEnabled()

True if binary moprhological operations are allowed (when binary input data are detected)

neededBorderWidth()

border width needed to perform chamfer mask operations, in binary mode (int).

setChamferBinaryMorphoEnabled(enabled)

Enable or disable binary moprhological operations (when binary input data are detected)

Parameters

enabled (bool) –

setChamferFactor(factor)

Set the chamfer distance factor, used in binary operations.

setChamferMaskSize(size)

Set the chamfer mask size (for binary operations)

Parameters

size (Point3d) – mask size triplet, in voxels

class soma.aimsalgo.NearestNeighborResampler_DOUBLE(*args)

Bases: soma.aimsalgo.Resampler_DOUBLE

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_FLOAT(*args)

Bases: soma.aimsalgo.Resampler_FLOAT

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_HSV(*args)

Bases: soma.aimsalgo.Resampler_HSV

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_POINT3DF(*args)

Bases: soma.aimsalgo.Resampler_POINT3DF

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_RGB(*args)

Bases: soma.aimsalgo.Resampler_RGB

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_RGBA(*args)

Bases: soma.aimsalgo.Resampler_RGBA

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_S16(*args)

Bases: soma.aimsalgo.Resampler_S16

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_S32(*args)

Bases: soma.aimsalgo.Resampler_S32

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_U16(*args)

Bases: soma.aimsalgo.Resampler_U16

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_U32(*args)

Bases: soma.aimsalgo.Resampler_U32

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.NearestNeighborResampler_U8(*args)

Bases: soma.aimsalgo.Resampler_U8

Volume resampler using nearest-neighbour interpolation.

The Resampling API is described in the base Resampler class.

class soma.aimsalgo.Polynomial_FLOAT_3

Bases: soma.aimsalgo.aimsalgo.Samplable_FLOAT_3

contains()
displayEquation()
getCoefficients()
getOrderStep()
resolve()
setCoefficients()
setOrderStep()
class soma.aimsalgo.QuarticResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuarticResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using quartic (order 4) interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.QuinticResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using quintic (order 5) interpolation.

The resampling API is described in the base classes Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.Reader_FfdTransformation

Bases: sip.wrapper

FFD vector field transformation reader. It actually reads a volume of Point3df.

read()
soma.aimsalgo.ResamplerFactory(volume)[source]

Factory function to instantiate a ResamplerFactory_<type> object. It builds from an existing volume to gets its voxel type.

See also

ResamplerFactory_S16, ResamplerFactory_FLOAT etc.

class soma.aimsalgo.Resampler_DOUBLE(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

double

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_DOUBLE) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_DOUBLE

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_DOUBLE

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_DOUBLE) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (double) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_DOUBLE) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_DOUBLE) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (double) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

double

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_DOUBLE) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (double) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_DOUBLE) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_DOUBLE

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: double

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

double

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_DOUBLE) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (double) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_DOUBLE) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_DOUBLE

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: double

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

double

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (double) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_DOUBLE) – volume to be resampled

class soma.aimsalgo.Resampler_FLOAT(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

float

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_FLOAT) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_FLOAT

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_FLOAT

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_FLOAT) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (float) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_FLOAT) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_FLOAT) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (float) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

float

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_FLOAT) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (float) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_FLOAT) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_FLOAT

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: float

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

float

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_FLOAT) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (float) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_FLOAT) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_FLOAT

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: float

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

float

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (float) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_FLOAT) – volume to be resampled

class soma.aimsalgo.Resampler_HSV(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

AimsHSV

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_HSV) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_HSV

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_HSV

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_HSV) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (AimsHSV) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_HSV) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_HSV) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (AimsHSV) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

AimsHSV

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_HSV) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (AimsHSV) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_HSV) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_HSV

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: AimsHSV

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsHSV

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_HSV) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (AimsHSV) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_HSV) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_HSV

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: AimsHSV

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsHSV

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (AimsHSV) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_HSV) – volume to be resampled

class soma.aimsalgo.Resampler_POINT3DF(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

Point3df

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_POINT3DF) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_POINT3DF

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_POINT3DF

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_POINT3DF) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (Point3df) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_POINT3DF) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_POINT3DF) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (Point3df) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

Point3df

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_POINT3DF) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (Point3df) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_POINT3DF) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_POINT3DF

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: Point3df

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

Point3df

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_POINT3DF) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (Point3df) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_POINT3DF) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_POINT3DF

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: Point3df

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

Point3df

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (Point3df) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_POINT3DF) – volume to be resampled

class soma.aimsalgo.Resampler_RGB(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

AimsRGB

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_RGB) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_RGB

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_RGB

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_RGB) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (AimsRGB) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGB) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_RGB) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (AimsRGB) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGB

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_RGB) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (AimsRGB) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGB) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_RGB

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: AimsRGB

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGB

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_RGB) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (AimsRGB) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGB) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_RGB

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: AimsRGB

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGB

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (AimsRGB) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_RGB) – volume to be resampled

class soma.aimsalgo.Resampler_RGBA(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

AimsRGBA

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_RGBA) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_RGBA

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_RGBA

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_RGBA) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (AimsRGBA) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGBA) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_RGBA) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (AimsRGBA) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGBA

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_RGBA) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (AimsRGBA) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGBA) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_RGBA

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: AimsRGBA

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGBA

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_RGBA) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (AimsRGBA) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_RGBA) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_RGBA

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: AimsRGBA

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

AimsRGBA

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (AimsRGBA) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_RGBA) – volume to be resampled

class soma.aimsalgo.Resampler_S16(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

short

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_S16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_S16

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_S16

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_S16) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_S16) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (short) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

short

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_S16) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_S16

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: short

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

short

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_S16) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_S16

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: short

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

short

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (short) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_S16) – volume to be resampled

class soma.aimsalgo.Resampler_S32(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

int

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_S32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_S32

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_S32

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_S32) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (int) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_S32) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (int) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

int

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_S32) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (int) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_S32

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: int

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

int

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_S32) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (int) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_S32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_S32

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: int

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

int

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (int) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_S32) – volume to be resampled

class soma.aimsalgo.Resampler_U16(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

uint16_t

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_U16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_U16

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_U16

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U16) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (uint16_t) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U16) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (uint16_t) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

uint16_t

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U16) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (uint16_t) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U16

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: uint16_t

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

uint16_t

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U16) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (uint16_t) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U16) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U16

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: uint16_t

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

uint16_t

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (uint16_t) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_U16) – volume to be resampled

class soma.aimsalgo.Resampler_U32(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

unsigned

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_U32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_U32

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_U32

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U32) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (unsigned) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U32) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (unsigned) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U32) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (unsigned) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U32

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: unsigned

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U32) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (unsigned) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U32) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U32

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: unsigned

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (unsigned) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_U32) – volume to be resampled

class soma.aimsalgo.Resampler_U8(*args)

Bases: soma.aims.carto.RCObject

Resampling of data from a volume, applying a transformation.

The doit() and resample() methods can be used to apply an affine transformation (aims::AffineTransformation3d). They take a direct transformation, i.e. the transformation goes from the space of the input image (unit: mm) to the space of the output image (unit: mm). The transformation is inverted and normalized internally as needed, because the resamplers “pull” data by transforming output coordinates into input coordinates.

The doit() methods work on input data passed to the setRef() method. setDefaultValue() can also be called to set the background value.

The resample() methods provide stateless alternatives.

You can also use arbitrary non-affine transformations (inheriting soma::Transformation3d) by using the resample_inv() family of methods. In this case, you must pass the backward transformation (from output space to input space), because of the “pulling” mechanism described above.

Beware that contrary to the other methods, the resample_inv_to_vox() overloads take a transformation that maps to voxel coordinates of the input image. These methods can be slightly faster than resample_inv() because they map directly to the API of the actual resamplers are implementing (doResample()). This is especially true of the overload that performs resampling for a single point only.

defaultValue()

Background value used by the doit() methods

Returns

Return type

unsigned short

doit(transform, output_data)

Resample the input volume set with setRef() into an existing volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • output_data (Volume_U8) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

Raises

RuntimeError – if no input volume has been set with setRef.

Resample the input volume set with setRef() in a newly allocated volume.

The background value (to be used for regions that are outside of the input volume) can be set with setDefaultValue().

The level of verbosity is taken from carto::verbose (i.e. the –verbose command-line argument is honoured).

The transformations, referentials, and referential header attributes of the new volume are reset if transform.isIdentity() is false:

  • the referential attribute is removed

  • each transformation in transformations is composed with transform so that the output volume still points to the original space. If that is not possible (e.g. the transformations attribute is missing or invalid), then a new transformation is added that points to the input volume.

Parameters
  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • dimX (int) – dimensions of the newly allocated volume

  • dimY (int) – dimensions of the newly allocated volume

  • dimZ (int) – dimensions of the newly allocated volume

  • voxel_size (Point3df (list of 3 floats)) – voxel size of the newly allocated volume (unit: mm)

Returns

a newly allocated volume containing the resampled data (its size along the t axis is the same as the input volume).

Return type

Volume_U8

Raises

RuntimeError – if no input volume has been set with setRef.:

ref()

Input data to be resampled by the doit() methods

Returns

Return type

Volume_U8

resample(input_data, transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U8) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to coordinates of the output volume (unit: mm) (its inverse is used for resampling)

  • background (unsigned short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U8) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U8) – data to be resampled (its voxel size is taken into account)

  • transform (AffineTransformation3d) – transformation from coordinates of the input volume (unit: mm), to output coordinates (its inverse is used for resampling)

  • background (unsigned short) – value set in output regions that are outside of the transformed input volume

  • output_location (Point3df (list of 3 floats)) – coordinates in output space (destination space of transform)

  • timestep (int) – for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned short

resample_inv(input_data, inverse_transform, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Parameters
  • input_data (Volume_U8) – data to be resampled (its voxel size is taken into account)

  • inverse_transform (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: mm)

  • background (unsigned short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U8) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U8

data to be resampled (its voxel size is taken into account)

inverse_transform: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: mm)

background: unsigned short

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned short

resample_inv_to_vox(input_data, inverse_transform_to_vox, background, output_data, verbose=False)

Resample a volume into an existing output volume.

The transformations, referentials, and referential header attributes of output_data are not touched; it is up to the calling code to update them accordingly.

This method does not use the instance state set by setRef() or setDefaultValue().

Derived classes can override this method to optimize interpolation of a full volume. The base class method simply calls doResample for each point.

Parameters
  • input_data (Volume_U8) – data to be resampled (its voxel size is taken into account)

  • inverse_transform_to_vox (Transformation3d) – transformation from coordinates of the output volume (unit: mm), to coordinates of the input volume (unit: voxel)

  • background (unsigned short) – value set in output regions that are outside of the transformed input volume

  • output_data (Volume_U8) – existing volume to be filled with resampled data (its pre-existing dimensions and voxel size are used)

  • verbose (bool) – print progress to stdout

Resample a volume at a single location.

This method does not use the instance state set by setRef() or setDefaultValue().

input_data: Volume_U8

data to be resampled (its voxel size is taken into account)

inverse_transform_to_vox: Transformation3d

transformation from output coordinates to coordinates of the input volume (unit: voxel)

background: unsigned short

value set in output regions that are outside of the transformed input volume

output_location: Point3df (list of 3 floats)

coordinates in output space (destination space of transform)

timestep: int

for 4D volume, time step to be used

Returns

resampled value

Return type

unsigned short

setDefaultValue(value)

Set the background value to be used by the doit() methods

Parameters

value (unsigned short) – background value

setRef(input_data)

Set the input data to be resampled by the doit() methods

Parameters

input_data (Volume_U8) – volume to be resampled

class soma.aimsalgo.Samplable_FLOAT_3

Bases: sip.wrapper

contains()
class soma.aimsalgo.SeventhOrderResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SeventhOrderResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using seventh-order interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_DOUBLE(*args)

Bases: soma.aimsalgo.SplineResampler_DOUBLE

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_DOUBLE and SplineResampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_FLOAT(*args)

Bases: soma.aimsalgo.SplineResampler_FLOAT

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_FLOAT and SplineResampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_HSV(*args)

Bases: soma.aimsalgo.SplineResampler_HSV

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_HSV and SplineResampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_POINT3DF(*args)

Bases: soma.aimsalgo.SplineResampler_POINT3DF

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_POINT3DF and SplineResampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_RGB(*args)

Bases: soma.aimsalgo.SplineResampler_RGB

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_RGB and SplineResampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_RGBA(*args)

Bases: soma.aimsalgo.SplineResampler_RGBA

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_RGBA and SplineResampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_S16(*args)

Bases: soma.aimsalgo.SplineResampler_S16

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_S16 and SplineResampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_S32(*args)

Bases: soma.aimsalgo.SplineResampler_S32

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_S32 and SplineResampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_U16(*args)

Bases: soma.aimsalgo.SplineResampler_U16

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_U16 and SplineResampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_U32(*args)

Bases: soma.aimsalgo.SplineResampler_U32

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_U32 and SplineResampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SixthOrderResampler_U8(*args)

Bases: soma.aimsalgo.SplineResampler_U8

Volume resampler using sixth-order interpolation.

The resampling API is described in the base classes, Resampler_U8 and SplineResampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

class soma.aimsalgo.SplineResampler_DOUBLE(*args)

Bases: soma.aimsalgo.Resampler_DOUBLE

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_DOUBLE.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_DOUBLE) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_FLOAT(*args)

Bases: soma.aimsalgo.Resampler_FLOAT

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_FLOAT.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_FLOAT) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_HSV(*args)

Bases: soma.aimsalgo.Resampler_HSV

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_HSV.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_HSV) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_POINT3DF(*args)

Bases: soma.aimsalgo.Resampler_POINT3DF

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_POINT3DF.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_POINT3DF) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_RGB(*args)

Bases: soma.aimsalgo.Resampler_RGB

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_RGB.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_RGB) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_RGBA(*args)

Bases: soma.aimsalgo.Resampler_RGBA

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_RGBA.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_RGBA) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_S16(*args)

Bases: soma.aimsalgo.Resampler_S16

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_S16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_S16) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_S32(*args)

Bases: soma.aimsalgo.Resampler_S32

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_S32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_S32) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_U16(*args)

Bases: soma.aimsalgo.Resampler_U16

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_U16.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_U16) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_U32(*args)

Bases: soma.aimsalgo.Resampler_U32

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_U32.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_U32) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.SplineResampler_U8(*args)

Bases: soma.aimsalgo.Resampler_U8

B-Spline-based resampling.

This is the base class for all resamplers based on B-spline interpolation as described by Unser, Aldroubi & Eden in IEEE PAMI (1991). A class computing the actual spline coefficient is derived for each spline order (1 to 7).

SeeLinearResampler, CubicResampler, QuadraticResampler,

QuinticResampler, SixthOrderResampler, SeventhOrderResampler

Coefficients are computed through a recursive scheme from an input reference volume. This recursive algorithm is fast for whole volume resampling, but slower for single points. A cache mechanism has thus been implemented so that coefficients are not recomputed if the input volume did not change.

The Resampling API is described in the base class, Resampler_U8.

getOrder()

order = getOrder()

Spline order (1 to 7)

Returns

order

Return type

int (1 to 7)

getSplineCoef()
reset()

Computes spline coefficients corresponding to an input volume.

Spline coefficients are recomputed only if one of these conditions is satisfied: - inVolume is different from the last volume used for coefficients

computation (in the sense that they share the same adress)

  • t is different from the last t used for coefficients computation

  • A call to reset() has previously been made

This method actually calls updateParameters() and returns the coeff container

Parameters
  • inVolume (Volume_U8) – input image

  • t (int) – volume to use in the T dimension in the case where inVolume is a time series.

  • verbose (bool) – print progress on stdout

Returns

Volume of double containing the coefficients in the image domain. Border coefficient need to be retrieved by mirror.

Return type

Volume_DOUBLE

class soma.aimsalgo.TriangulationMoment

Bases: soma.aimsalgo.MomentBase, soma.aimsalgo.Moment_S16

doit()
setMomentType()
class soma.aimsalgo.Writer_FfdTransformation

Bases: soma.aims.Writer_Volume_POINT3DF

FFD vector field transformation writer. It actually reads a volume of Point3df.

write()
class soma.aimsalgo.aimsalgo

Bases: sip.simplewrapper

class BucketMapSampler_FLOAT_3

Bases: soma.aimsalgo.aimsalgo.GeneralSampler_FLOAT_3

sample()
class GeneralSampler_FLOAT_3

Bases: sip.wrapper

sample()
class Polynomial_FLOAT_3

Bases: soma.aimsalgo.aimsalgo.Samplable_FLOAT_3

contains()
displayEquation()
getCoefficients()
getOrderStep()
resolve()
setCoefficients()
setOrderStep()
class Samplable_FLOAT_3

Bases: sip.wrapper

contains()
soma.aimsalgo.blobsHeights()
soma.aimsalgo.hyp0f1()
soma.aimsalgo.hyp1f1()
soma.aimsalgo.loghyp0f1()
soma.aimsalgo.loghyp1f1()
soma.aimsalgo.meshBlobsBifurcation()
soma.aimsalgo.meshWatershed()
class soma.aimsalgo.rc_ptr_FfdTransformation

Bases: sip.wrapper

isNull()
release()
reset()
class soma.aimsalgo.rc_ptr_GeometricProperties

Bases: sip.wrapper

isNull()
release()
reset()
class soma.aimsalgo.rc_ptr_SplineFfd

Bases: sip.wrapper

isNull()
release()
reset()
class soma.aimsalgo.rc_ptr_TrilinearFfd

Bases: sip.wrapper

isNull()
release()
reset()
soma.aimsalgo.resampleBucket()
resampleBucket(bck, direct_transformation, inverse_transformation,

vs=aims.Point3df(0., 0., 0.), also_pushforward=True)

Apply a spatial transformation to a BucketMap.

The bucket is transformed by resampling, using a pull-back method in the same way as nearest neighbour resampling of a Volume.

Pure pull-back resampling does not behave well when downsampling (it introduces holes), so by default this function returns the union of voxels transformed using the pushforward and pullback methods. Set also_pushforward to false to disable this behaviour and only perform pure pullback.

The voxel size of the output bucket can optionally be specified in vs. By default, the same voxel size as the input bucket is used.

Warning

Alhtough this method is more reliable than transformBucketDirect, it still provides no guarantees of topology preservation.

soma.aimsalgo.simple_delaunay_triangulation()

triangles = simple_delaunay_triangulation(points)

Get a Delaunay triangulation for a polygon. Poins in the polygon should be ordered in a clockwise or counterclockwise order.

Note that it is different from a classical Delaunay algorithm wich meshes a cloud point (and its convex hull), not a polygon as here.

soma.aimsalgo.transformBucketDirect(bck, direct_transformation, vs=aims.Point3df(0., 0., 0.))

Apply a spatial transformation to a BucketMap

Each voxel of the input bucket is transformed with direct_transformation, and the closest voxel of the output bucket is set. The voxel size of the output bucket can optionally be specified in vs. By default, the same voxel size as the input bucket is used.

Warning

This method provides no guarantees of topology preservation; in fact it will create holes in the resulting bucket, particularly when upsampling. When possible, you should use resampleBucket() instead, which performs nearest-neighbour resampling.

soma.aimsalgo.transformGraph()
transformGraph(graph, direct_transformation, inverse_transformation,

vs=aims.Point3df(0., 0., 0.))

Apply a spatial transformation to all objects contained in a Graph.

The graph is modified in-place.

An inverse transformation is necessary for correctly transforming Buckets (see resampleBucket). If inverse_transformation is NULL, buckets will be transformed with the push-forward method only (transformBucketDirect).

Warning

Volumes are not transformed, neither are graph attributes. Please run AimsFoldArgAtt to fix the values of basic attributes, or the CorticalFoldsGraphUpgradeFromOld BrainVisa process, which can be found under Morphologist/Sulci/graphmanipulation, for a complete update.

soma.aimsalgo.transformMesh(mesh, direct_transformation)

Apply a spatial transformation to a segments mesh (AimsTimeSurface).

The mesh is transformed in-place and modified.

Each vertex of the mesh is transformed according to the supplied transformation. Normals are re-calculated from the new vertex positions.

transformMesh(mesh, direct_transformation)

Apply a spatial transformation to a triangles mesh (AimsTimeSurface)

The mesh is transformed in-place and modified.

Each vertex of the mesh is transformed according to the supplied transformation. Normals are re-calculated from the new vertex positions.

transformMesh(mesh, direct_transformation)

Apply a spatial transformation to a quads mesh (AimsTimeSurface)

The mesh is transformed in-place and modified.

Each vertex of the mesh is transformed according to the supplied transformation. Normals are re-calculated from the new vertex positions.