PyAims low-level classes and functions

You will look at this part only when needed, dont’t look at it at the beginning. The useful part is accessed via the PyAims high-level functions and classes.

IO system

class soma.aims.Reader(typemap=None, allocmode=None, options=None)[source]

Generic reader that can theorerically load any SIP-mapped AIMS or Cartograph object. A translation table can be provided to correctly map readers and objects. For quick and simple operations, you can also use the gloabl soma.aims.read() and soma.aims.write() functions, which use a Reader object internally.

typemap can be provided to specify which reader may be used to load objects whose type has been read. A default internal map is present but can be replaced.

The map has 2 modes:

  • object_type : object_type (ex: {'Volume' : 'Volume'} )

  • object_type : dict( data_type : full_type ) (ex: 'Mesh' : { 'VOID' : 'AimsSurfaceTriangle' } )

    A default object_type can be specified if the data_type is not found:

    'Mesh' : { 'VOID' : 'AimsSurfaceTriangle',
                'default_object_type' : 'AimsTimeSurface_3_VOID' }
    

    (and this example corresponds to the default internal map if none is specified)

Parameters:
mapType(iotype, aimstype)[source]

Get the translated type correspondance between identified data type (from IO system) and the data type that will actually be read. This is generally the identity, but a few IO/types allow some variations.

read(filename, border=0, frame=-1, dtype=None, object=None)[source]

Reads the object contained in the file <filename>, whatever the type of the contents of the file. All objects types supported by Aims IO system can be read. A border width and a frame number may be specified and will be only used by formats that support them. If <dtype> is specified, the corresponding object/data type is forced. It may be useful to force reading a volume with float voxels for instance. It is only supported by a few formats. <dtype> may contain a string or a type object, as accepted by soma.aims.typeCode(). The read function may follow other object/data types rules, allocators and options, as specified in the Reader constructor.

Parameters:
  • filename (str)

  • border (int)

  • frame (int)

  • dtype

  • object (existing object to be read/filled) – If not specified the function will return a new object. If specified, this is considered the existing object to be read and filled by the reader.

class soma.aims.Writer[source]
writtenObjectType()[source]
writtenObjectDataType()[source]
writtenObjectFullType()[source]
write(obj, filename, format=None, options={})[source]

Writes the object <obj> in a file named <filename>, whatever the type of <obj>, as format <format>. All objects types and formats supported by the Aims IO system can be used. <obj> may be a reference-counter to an object type supported by the IO system. Additional specific options may be passed to the underlying IO system in an optional <options> dictionary.

writtenObjectDataType()[source]

Data content type (voxel or texture type…) written (available after writing)

writtenObjectFullType()[source]

Data full type written (available after writing)

writtenObjectType()[source]

Data object type (Volume, Mesh…) written (available after writing)

class soma.aims.Finder
class soma.aims.Finder(a0: aims.Finder)

See the Finder C++ class

check(filename)
header()
objectType()
dataType()
format()
check(self, a0: object) bool
dataType(self) object
extensions(a0: object) List
finderFormat(format: object) aims.FinderFormat | None
format(self) object
header(self) carto.Object
objectType(self) object
possibleDataTypes(self) vector_STRING
registerFormat(fmtid: object, format: aims.FinderFormat | None, extensions: vector_STRING, before: object = '')
setDataType(self, dat: object)
setFormat(self, format: object)
setHeader(self, hdr: carto.Object)
setObjectType(self, obj: object)
setPossibleDataTypes(self, dt: vector_STRING)
unregisterFormat(format: object)
soma.aims.typeCode(data)[source]

returns the AIMS type code for the given input data. data may be a string code, a python/numpy numeric type, an AIMS type, or an instance of such a type.

soma.aims.voxelTypeCode(data)[source]

returns the AIMS type code for the given input data voxel type. For instance, for a volume of 16 bit ints, it will be ‘S16’, whereas typeCode() would return ‘Volume_S16’.

Input data may be a type or an instance of a container type.

soma.aims.somaio_typeCode(data)[source]

returns the Soma-IO type code (as in soma.carto.IOObjectTypesDictionary.readTypes() dict keys) for the given input type.

Parameters:

data (string or type or instance, or 2-tuple) – If type or instance, get the type code for the given object. If string, try to translate AIMS IO to soma-IO codes. If 2-tuple, translate AIMS object type / data type couple

Neuroimaging data structures

Volumes

class soma.aims.Volume_U8
class soma.aims.Volume_S16
class soma.aims.Volume_U16
class soma.aims.Volume_S32
class soma.aims.Volume_U32
class soma.aims.Volume_RGB
class soma.aims.Volume_RGBA
class soma.aims.Volume_DOUBLE
class soma.aims.Volume_CDOUBLE
class soma.aims.Volume_CFLOAT
class soma.aims.Volume_FLOAT(*args)

Generalities

The various Volume_<type> classes are bindings to the C++ template classes carto::Volume. It represents a 4D volume (1D to 4D, actually) storing a specific type of data: for instance S16 is signed 16 bit short ints, FLOAT is 32 bit floats, etc.

Volumes are read and written using the Reader and Writer classes, which are in turn used by the simple read() and write() functions.

A volume of a given type can be built either using its specialized class constructor, or the general Volume() function which can take a voxel type in its arguments: the following are equivalent:

>>> v = aims.Volume_S16(100, 100, 10)
>>> v = aims.Volume('S16', 100, 100, 10)
>>> v = aims.Volume(100, 100, 10, dtype='S16')
>>> v = aims.Volume([100, 100, 10], dtype='S16')
>>> import numpy
>>> v = aims.Volume(numpy.int16, 100, 100, 10)

Numpy arrays and volumes

A volume is an array of voxels, which can be accessed via the at() method. For standard numeric types, it is also possible to get the voxels array as a numpy array, using the __array__() method, or more conveniently, numpy.asarray(volume) or numpy.array(volume, copy=False). In aims >= 5.0.2, a more concise shortcut is also available: volume.np (this is available on all types providing numpy bindings actually).

The array returned is a reference to the actual data block, so any modification to its contents also affects the Volume contents, so it is generally an easy way of manipulating volume voxels because all the power of the numpy module can be used on Volumes. The obsoloete arraydata() method used to return a numpy array just like it is in memory, that is a 4D (or more) array generally indexed by [t][z][y][x] (but it depands how it has been built), which is generally not what you like and is not consistent with AIMS indexing. Contrarily, using volume.np sets strides in the returned numpy array, so that indexing is in the “normal” order [x][y][z][t], while still sharing the same memory block. The Volume object now also wraps the numpy accessors to the volume object itself, so that volume[x, y, z, t] is the same as nupmy.asarray(volume)[x, y, z, t].

new in PyAims 4.7

Since PyAims 4.7 the numpy arrays bindings have notably improved, and are now able to bind arrays to voxels types which are not scalar numeric types. Volumes of RGB, RGBA, HSV, or Point3df now have numpy bindings. The bound object have generally a “numpy struct” binding, that is not the usual C++/python object binding, but instead a structure managed by numpy which also supports indexing. For most objects we are using, they also have an array stucture (a RGB is an array with 3 int8 items), and are bound under a sturcture with a unique field, named “v” (for “vector”):

>>> v = aims.Volume('RGB', 100, 100, 10)
>>> v[0, 0, 0, 0]
([0, 0, 0],)

Such an array may be indexed by the field name, which returns another array with scalar values and additional dimensions:

>>> v['v'].dtype
dtype('uint8')
>>> v['v'].shape
(100, 100, 10, 1, 3)

Both arrays share their memory with the aims volume.

Header

Volumes also store a header which can contain various information (including sizes and voxel sizes). The header is a dictionary-like generic object (Object) which can be accessed by the header() method. This header object also has a read-write access with some restrictions inherent to the Object mechanism. It will be saved with the volume contents when the volume is saved on disk.

Volumes support a number of arithmetic operators like +, - etc. when the operands types and sizes match: for instance:

>>> # V1 and V2 are two volumes
>>> V3 = V1 + V2  # adds two volumes
>>> V2 -= V1
>>> V3 = V1 + 3   # adds 3 to aceh voxel
>>> V3 = V1 * V2  # itemwise multiplication

Some type conversions can be performed on volumes, for istance to convert a Volume_S16 to a Volume_FLOAT. The simplest, to convert to another data type, is to use the astype() method.

To convert a volume into diffent structure types, such as Buckets, use the converter classes Converter_<type1>_<type2> and ShallowConverter_<type1>_<type2> with <type1> and <type2> being volume or other object types: for instance Converter_Volume_S16_Volume_FLOAT. The converter can also be called using type arguments:

>>> vol1 = aims.AimsData('S16', 100, 100, 10)
>>> c = aims.Converter(intype=vol1, outtype='BucketMap_VOID')
>>> vol2 = c(vol1)

Volume from a numpy array

It is also possible to build a Volume from a numpy array:

>>> v = aims.Volume(numpy.zeros((100, 100, 10)))

Note that passing a 1D numpy array of ints will build a volume mapping the array contents, whereas passing a python list or tuple of ints will interpret the list as a shape for the volume:

>>> v = aims.Volume(numpy.array([100, 100, 10]).astype('int32'))
>>> print(v.getSize())
[ 3, 1, 1, 1 ]
>>> print(v.np)
[100 100  10]
>>> v = aims.Volume([100, 100, 10])
>>> print(v.getSize())
[ 100, 100, 10, 1 ]

Array ordering:

In pyaims <= 5.0.x the Volume classes were only working with the X axis (the first) being contiguous, and, for numpy, should be interpreted as “Fortran-contiguous”. So to convert a numpy array into a Volume and keep the same axes ordering, you had to convert it to Fortran order first:

>>> v = aims.Volume(numpy.zeros((2, 3, 4, dtype='int32')))
# v.getSize() used to return [4, 3, 2, 1]
>>> v = aims.Volume(np.asfortranarray(numpy.zeros((2, 3, 4), dtype='int32')))
>>> print(v.getSize())
[2, 3, 4, 1]

In pyaims 5.1 this limitation is gone, you can omit the fortran order conversion. Strides are taken into account in the C++ volume. But you have to be careful with such volumes as many C++ programs assume internally that the X axis is contiguous in memory, which is not true in this situation. These programs and functions may not work, crash, or produce incorrect results when used with non-contiguous X axis volumes.

clone()
dimT()

equivalent to soma.aims.Volume_FLOAT.getSizeT()

dimX()

equivalent to soma.aims.Volume_FLOAT.getSizeX()

dimY()

equivalent to soma.aims.Volume_FLOAT.getSizeY()

dimZ()

equivalent to soma.aims.Volume_FLOAT.getSizeZ()

fill(value)
fillBorder(value)
header()
maxIndex()
maximum()
minIndex()
minimum()
setSizeT(sizet)

This is the voxel size, not the volume size as in :py:class::soma.aims.Volume_FLOAT.

setSizeX(sizex)
setSizeXYZT(size)
setSizeY(sizey)
setSizeZ(sizez)
setValue(value, posx, posy=0, posz=0, post=0)
sizeT()

This is the voxel size, not the volume size as in :py:class::soma.aims.Volume_FLOAT.

sizeX()
sizeY()
sizeZ()
value(posx, posy=0, posz=0, post=0)
volume()

Returns the underlying :py:class::soma.aims.Volume_FLOAT object.

class Position4Di

4 ints for position or size, used for Volume views.

all(self) bool
allocateBorders(self, bsx: int, bsy: int = -1, bsz: int = -1)

reallocate the volume with given borders, keep (copy) the contents.

allocateBorders(self, border: vector_S32) reallocate the volume with given borders, keep (copy) the contents. only 1 value is mandatory.

allocatorContext(self) carto.AllocatorContext
any(self) bool
arraydata(self) Any

arraydata() returns a numpy array to the internal memory block, with “inverted” shape and strides.

WARNING: this is an obsolete method, which behaviour has changed. Most of the time you need numpy.asarray(volume), or more simply: volume.np, which actually provides an array with the same indices ordering. Here it is a transposed one.

Given the internal ordering of Aims Volumes, the resulting numpy array is indexed as [t][z][y][x]. This order corresponds to the numpy “fortran” order: order='F' If you need the inverse, more natural, [x][y][z][t] ordering, use the following:

>>> volarray = volume.np

or:

>>> volarray = numpy.array(volume, copy=False)

or:

>>> volarray = numpy.asarray(volume)

Using arraydata(), as the indices are reversed, if you do something like:

vol2 = aims.Volume(vol.arraydata())

You will build a transposed volume.

astype(dtype, copy=False)

Easy conversion method for volumes. Works in a similar was as numpy arrays astype() methods, except that the “copy” parameter defaults to False.

Parameters:
  • dtype (string or type object) – may be a volume or voxel type, specified either as a type oject (int, aims.Volume_S32, numpy.int16), or as a string (“S16”…).

  • copy (bool) – if False, a ShallowConverter will be used: if dtype matches the current volume type, a shared reference to self will be returned. Otherwise a new copy will be returned.

Return type:

A volume of the converted type

at(self, a0: int, a1: int = 0, a2: int = 0, a3: int = 0) float
at(posx, posy=0, posz=0, post=0) None

Returns the volume value for the selected voxel.

at(self, a0: int, a1: int, a2: int, a3: int, a4: int, a5: int = 0, a6: int = 0, a7: int = 0) -> float at(posx1, posx2, posx3, posx4, posx5, posx6=0, posx7=0, posx8=0)

Returns the volume value for the selected voxel.

at(self, a0: vector_S32) -> float at(vector_int)

Returns the volume value for the selected voxel.

checkResize(self)
copyHeaderFrom(self, other: carto.PropertySet, stopOnError: bool = True)
copyHeaderFrom(self, other: carto.Object, stopOnError: bool = True) None
fill(self, value: float)
fill(value) None

Fill Volume_FLOAT using the given value.

fillBorder(self, value: float)
fillBorder(value) None

Fill the surrounding of the volume view in the reference volume (if any) using the given value.

flipToOrientation(self, orient: object)

flipToOrientation(self, orient: object, force_memory_layout: object) volume.flipToOrientation(orient, force_memory_layout=””)

Flip the volume to a given orientation

The volume voxels will be reordered to match the given orientation.

If force_memory_layout is not given, then only the strides will be changed, and the data block will remain preserverd.

Orientation is given as a 3 char string: “LPI” (the default orientation in AIMS), “RAS”, and combinations of these 6 letters. See https://brainvisa.info/aimsdata/user_doc/coordinates_systems.html and http://www.grahamwideman.com/gw/brain/orientation/orientterms.htm.

If force_memory_layout is used, on the contrary, the voxels data block will be reallocated and flipped to match the given orientation. It is also given as a 3 char string, thus it may specify a different memory layout from the one used for indices.

fromObject(a0: carto.GenericObject) rc_ptr_Volume_FLOAT
getBorders(self) vector_S32
getSize(self) vector_S32

Number of voxels in each dimension (list of 4 ints)

getSizeT(self) int
getSizeX(self) int
getSizeY(self) int
getSizeZ(self) int
getStrides(self) vector_S64
getVoxelSize(self) vector_FLOAT

Voxel sizes in mm (list of 4 floats)

header(self) Any

The header contains all meta-data.

max(self) float
memoryLayoutOrientation(self) vector_S32

determine the memory layout orientation from strides and current indices orientation.

Use volume.referential().orientationStr(volume.memoryLayoutOrientation()) to get a more readable string description.

min(self) float
property np

The np property is a shortcut to the __array__ method. Thus:

something.np

is a handier equivalent to:

numpy.asarray(something)
posInRefVolume(self) vector_S32

If the volume is a view into another (larger) one, this returns the position in “parent” one.

refVolume(self) rc_ptr_Volume_FLOAT

If the volume is a view into another (larger) one, this returns the “parent” one.

referential(self) carto.Referential
reorientedHeader(self, orient: object) carto.Object
setPosInRefVolume(self, pos: vector_S32)

Set position in parent volume

setValue(self, a0: float, a1: int, a2: int = 0, a3: int = 0, a4: int = 0)
setValue(value, x, y=0, z=0, t=0) None

Set the voxel value at the given position.

setValue(self, a0: float, a1: vector_S32) setValue(value, [x1, x2, x3, x4, x5, x6…])

Set the voxel value at the given position.

setVoxelSize(self, a0: vector_FLOAT)
setVoxelSize(vs_list) None
setVoxelSize(vx, vy=1., vz=1., vt=1.) None

Set voxel sizes in mm (list of at least 4 floats)

setVoxelSize(self, vx: float, vy: float = 1, vz: float = 1, vt: float = 1)

storageLayoutOrientation(self) vector_S32

determine the storage (disk) layout orientation.

The storage orientation is optionnally stored int the header “storage_to_memory” matrix. If not, the storage orientation is undefined.

Use volume.referential().orientationStr(volume.storageLayoutOrientation()) to get a more readable string description.

value(self, a0: int, a1: int = 0, a2: int = 0, a3: int = 0) float
value(posx, posy=0, posz=0, post=0) None

value is an alias to at(): returns the volume value for the selected voxel.

Graphs and trees

class soma.aims.Graph(a0: object = '')

See the Graph C++ documentation

addDirectedEdge(self, vertex1: Vertex | None, vertex2: Vertex | None, s: object = '') Edge | None
addEdge(self, vertex1: Vertex | None, vertex2: Vertex | None, s: object = '') Edge | None
addVertex(self, a0: object = '') Vertex | None
clear(self)
cloneVertex(self, a0: Vertex | None) Vertex | None
edges(self) set_EdgePtr
edgesSize(self) int
extract(self, a0: Graph, a1: Any)
hasVertex(self, a0: Vertex | None) bool
isDirected(self) bool
isUndirected(self) bool
loadAllMissingElements(self)
order(self) int
randomVertex(self) Vertex | None
removeEdge(self, edge: Edge | None)
removeVertex(self, a0: Vertex | None)
size(self) int
vertices(self) set_VertexPtr
class soma.aims.Tree(a0: bool = True, a1: object = '')
class soma.aims.Tree(a0: Tree)

See the Tree C++ documentation

children(self) Tuple
childrenSize(self) int
clone(self) carto.Object
currentValue(self) carto.Object
getScalar(self) float
getString(self) object
has_key(self, a0: object) bool
insert(self, child: Tree | None, index: int = -1)
intKey(self) int
isArray(self) bool
isDictionary(self) bool
isDictionaryIterator(self) bool
isDynArray(self) bool
isIterable(self) bool
isIterator(self) bool
isNone(self) bool
isScalar(self) bool
isString(self) bool
isValid(self) bool
key(self) object
objectIterator(self) carto.Object
remove(self, index: int)
remove(self, node: Tree | None) None
size(self) int
type(self) object

Meshes and textures

class soma.aims.AimsTimeSurface_3_VOID
class soma.aims.AimsTimeSurface_3_VOID(a0: AimsTimeSurface_3_VOID)

See the AimsTimeSurface C++ documentation

Note

Before PyAIMS 4.5, compared to the C++ classes, the texture type template argument had beed dropped from the Python bindings, because textures are handled via separate objects (see soma.aims.TimeTexture()) and the builtin texture was actually never used. However textured meshes have shown useful to be read/written as an exchange format to other software and formats (typically the Wavefront .obj format), so the support for textured meshes has been added in Pyaims 4.5. As a consequence, mesh classes have changed name. To maintain compatibility with older code, the AimsTimeSurface_D_VOID classes (D being 2, 3 or 4) can still be found under their older names: AimsTimeSurface_D.

erase(self)
fromObject(a0: carto.GenericObject) rc_ptr_AimsTimeSurface_3_VOID
header(self) Any

The header contains all meta-data.

keys(self) List
normal(self, a0: int = 0) vector_POINT3DF | None
polygon(self, a0: int = 0) vector_AimsVector_U32_3 | None
size(self) int
texture(self, a0: int = 0) vector_VOID | None
updateNormals(self)
vertex(self, a0: int = 0) vector_POINT3DF | None
class soma.aims.AimsTimeSurface_2_VOID
class soma.aims.AimsTimeSurface_4_VOID
class soma.aims.AimsTimeSurface_2_FLOAT
class soma.aims.AimsTimeSurface_3_FLOAT
class soma.aims.AimsTimeSurface_4_FLOAT
class soma.aims.AimsTimeSurface_2_POINT2DF
class soma.aims.AimsTimeSurface_3_POINT2DF
class soma.aims.AimsTimeSurface_4_POINT2DF
class soma.aims.TimeTexture_FLOAT
class soma.aims.TimeTexture_FLOAT(a0: int, a1: int)
class soma.aims.TimeTexture_FLOAT(a0: TimeTexture_FLOAT)

See the TimeTexture C++ documentation

erase(self)
fromObject(a0: carto.GenericObject) rc_ptr_TimeTexture_FLOAT
has_key(self, a0: int) bool
header(self) carto.GenericObject
keys(self) List
nItem(self) int
push_back(self, a0: float)
reserve(self, a0: int)
size(self) int
class soma.aims.Texture_FLOAT
class soma.aims.Texture_FLOAT(a0: int)
class soma.aims.Texture_FLOAT(a0: Any)
class soma.aims.Texture_FLOAT(a0: Texture_FLOAT)

See the Texture C++ documentation

append(self, a0: float)
array_struct(self) Any
arraydata(self) Any
assign(self, a0: Any)
checkResize(self)
data(self) vector_FLOAT
erase(self)
item(self, a0: int) float
list(self) List
nItem(self) int
property np

The np property is a shortcut to the __array__ method. Thus:

something.np

is a handier equivalent to:

numpy.asarray(something)
push_back(self, a0: float)
push_back(self, a0: int, a1: float) None
reserve(self, a0: int)
resize(self, a0: int)
resize(self, a0: int, a1: float) None
size(self) int

“Buckets”

class soma.aims.BucketMap_VOID
class soma.aims.BucketMap_VOID(a0: BucketMap_VOID)

See the BucketMap C++ documentation

General purpose C++ containers

Generic object

class soma.aims.carto

This class represents the carto C++ namespace. It is rather used like a module, not as a class.

class GenericObject(*args, **kwargs)

Generic dynamic polymorphic object.

GenericObject should not be used directly, but rather through the soma.aims.Object proxy.

See soma.aims.Object for a complete documentation.

See the GenericObject C++ documentation

GenericObject.append(self, a0: carto.Object)
GenericObject.clone(self) carto.Object
GenericObject.currentValue(self) carto.Object
GenericObject.get(self, a0: object, a1: Any = Py_None) Any
GenericObject.get(self, a0: int, a1: Any = Py_None) Any
GenericObject.getScalar(self) float
GenericObject.getString(self) object
GenericObject.getSyntax(self) object
GenericObject.hasSyntax(self) bool
GenericObject.has_key(self, a0: object) bool
GenericObject.index(self, a0: carto.Object) int
GenericObject.intKey(self) int
GenericObject.isArray(self) bool
GenericObject.isDictionary(self) bool
GenericObject.isDictionaryIterator(self) bool
GenericObject.isDynArray(self) bool
GenericObject.isIntKeyIterator(self) bool
GenericObject.isIterable(self) bool
GenericObject.isIterator(self) bool
GenericObject.isKeyIterator(self) bool
GenericObject.isNone(self) bool
GenericObject.isScalar(self) bool
GenericObject.isString(self) bool
GenericObject.isValid(self) bool
GenericObject.key(self) object
GenericObject.keyObject(self) carto.Object
GenericObject.keys(self) Tuple
GenericObject.objectIterator(self) carto.Object
GenericObject.setSyntax(self, a0: object)
GenericObject.size(self) int
GenericObject.type(self) object
GenericObject.values(self) Tuple
class AllocatorStrategy

Memory management strategy helper. Contains mainly constants and a memory query function.

class AllocatorStrategy.DataAccess

Data access mode

InternalModif:

random access in memory, disk data (memmapped) should not be overwritten.

ReadOnly:

read only in memory. Accessing data in write mode may cause a crash.

ReadWrite:

read/write both in memory and on disk, if memmapped.

NotOwner:

data is unallocated, or its ownership belongs to a proxy object.

class AllocatorStrategy.MappingMode

Memory mapping modes

Memory, (MEM):

in-memory allocation

CopyMap, (MAP, MAP_COPY):

data is copied into a memmaped file (accessed read/write)

ReadOnlyMap, (MAP_RO):

read-only memory mapping

ReadWriteMap, (MAP_RW):

read/write memory mapping: modifying the memory also modifies the file on disk.

Unallocated:

not allocated.

AllocatorStrategy.allocator(a0: carto.AllocatorStrategy.MappingMode) carto.AllocatorContext

Create an AllocatorContext object with the required mapping mode

AllocatorStrategy.memSizes()

Check the current system memory and return the amount of RAM, free RAM, and swap.

class AllocatorContext

Allocation context specifications. This object is used when memory must be allocated for large objects (volumes, arrays…), especially for data which will be read from disk. It allows to specify how the memory will be used (read-only, read-write, how much…) to allow to decide whether any memory mapping techniques should be used or not.

AllocatorContext.accessMode(self) carto.AllocatorStrategy.DataAccess
AllocatorContext.allocatorType(self) carto.AllocatorStrategy.MappingMode
AllocatorContext.allowsMemoryMapping(self) bool
AllocatorContext.dataSource(self) rc_ptr_DataSource
AllocatorContext.dataSourceInfo(self) rc_ptr_DataSourceInfo
AllocatorContext.isAllocated(self) bool
AllocatorContext.setAccessMode(self, mode: carto.AllocatorStrategy.DataAccess)
AllocatorContext.setAllowsMemoryMapping(self, x: bool)
AllocatorContext.setDataSource(self, datasource: rc_ptr_DataSource)
AllocatorContext.setDataSourceInfo(self, dsi: rc_ptr_DataSourceInfo)
AllocatorContext.setUseFactor(self, x: float)
AllocatorContext.useFactor(self) float
class AllocatorContext

Allocation context specifications. This object is used when memory must be allocated for large objects (volumes, arrays…), especially for data which will be read from disk. It allows to specify how the memory will be used (read-only, read-write, how much…) to allow to decide whether any memory mapping techniques should be used or not.

accessMode(self) carto.AllocatorStrategy.DataAccess
allocatorType(self) carto.AllocatorStrategy.MappingMode
allowsMemoryMapping(self) bool
dataSource(self) rc_ptr_DataSource
dataSourceInfo(self) rc_ptr_DataSourceInfo
isAllocated(self) bool
setAccessMode(self, mode: carto.AllocatorStrategy.DataAccess)
setAllowsMemoryMapping(self, x: bool)
setDataSource(self, datasource: rc_ptr_DataSource)
setDataSourceInfo(self, dsi: rc_ptr_DataSourceInfo)
setUseFactor(self, x: float)
useFactor(self) float
class AllocatorStrategy

Memory management strategy helper. Contains mainly constants and a memory query function.

class DataAccess

Data access mode

InternalModif:

random access in memory, disk data (memmapped) should not be overwritten.

ReadOnly:

read only in memory. Accessing data in write mode may cause a crash.

ReadWrite:

read/write both in memory and on disk, if memmapped.

NotOwner:

data is unallocated, or its ownership belongs to a proxy object.

class MappingMode

Memory mapping modes

Memory, (MEM):

in-memory allocation

CopyMap, (MAP, MAP_COPY):

data is copied into a memmaped file (accessed read/write)

ReadOnlyMap, (MAP_RO):

read-only memory mapping

ReadWriteMap, (MAP_RW):

read/write memory mapping: modifying the memory also modifies the file on disk.

Unallocated:

not allocated.

allocator(a0: carto.AllocatorStrategy.MappingMode) carto.AllocatorContext

Create an AllocatorContext object with the required mapping mode

memSizes()

Check the current system memory and return the amount of RAM, free RAM, and swap.

class GenericObject(*args, **kwargs)

Generic dynamic polymorphic object.

GenericObject should not be used directly, but rather through the soma.aims.Object proxy.

See soma.aims.Object for a complete documentation.

append(self, a0: carto.Object)
clone(self) carto.Object
currentValue(self) carto.Object
get(self, a0: object, a1: Any = Py_None) Any
get(self, a0: int, a1: Any = Py_None) Any
getScalar(self) float
getString(self) object
getSyntax(self) object
hasSyntax(self) bool
has_key(self, a0: object) bool
index(self, a0: carto.Object) int
intKey(self) int
isArray(self) bool
isDictionary(self) bool
isDictionaryIterator(self) bool
isDynArray(self) bool
isIntKeyIterator(self) bool
isIterable(self) bool
isIterator(self) bool
isKeyIterator(self) bool
isNone(self) bool
isScalar(self) bool
isString(self) bool
isValid(self) bool
key(self) object
keyObject(self) carto.Object
keys(self) Tuple
objectIterator(self) carto.Object
setSyntax(self, a0: object)
size(self) int
type(self) object
values(self) Tuple
class soma.aims.rc_ptr_GenericObject
class soma.aims.rc_ptr_GenericObject(a0: carto.GenericObject | None)
class soma.aims.rc_ptr_GenericObject(a0: rc_ptr_GenericObject)
get(*args, **kwargs)

get() is ambiguous: rc_ptr / Object has the get() method, providing access to the underlying object. GenericObject has the method get(key, default=None) as a dictionary-like object. This proxy calls the right one depending on arguments.

isNull(self) bool
release(self)
reset(self, a0: carto.GenericObject | None)

Vectors and points

soma.aims.Point3df

alias of AimsVector_FLOAT_3

class soma.aims.AimsVector_FLOAT_3

This class wraps an aims Point3df aka AimsVector<3, float> use the method items() to get a tuple out of it use setItems(Point3df) to affect new values

See the AimsVector C++ documentation

arraydata(self) Any
assign(self, a0: AimsVector_FLOAT_3 | None)
crossed(self, a0: AimsVector_FLOAT_3) AimsVector_FLOAT_3 | None
dnorm(self) float
dnorm2(self) float
dot(self, a0: AimsVector_FLOAT_3) float
fromObject(a0: carto.GenericObject) AimsVector_FLOAT_3 | None
isNull(self) bool
item(self, a0: int) float
items(self, a0: int = 3) Any
list(self) List
norm(self) float
norm2(self) float
normalize(self) AimsVector_FLOAT_3
property np

The np property is a shortcut to the __array__ method. Thus:

something.np

is a handier equivalent to:

numpy.asarray(something)
setItems(self, a0: AimsVector_FLOAT_3)
soma.aims.Point2df

alias of AimsVector_FLOAT_2

soma.aims.Point3d

alias of AimsVector_S16_3

RGB

class soma.aims.AimsRGB(a0: AimsRGB)
class soma.aims.AimsRGB(a0: AimsRGBA)
class soma.aims.AimsRGB(a0: int = 0, a1: int = 0, a2: int = 0)
blue(self) int
green(self) int
red(self) int
class soma.aims.AimsRGBA(a0: AimsRGBA)
class soma.aims.AimsRGBA(a0: AimsRGB)
class soma.aims.AimsRGBA(a0: int = 0, a1: int = 0, a2: int = 0, a3: int = 0)
alpha(self) int
blue(self) int
green(self) int
red(self) int

Fibers and Bundles handling

class soma.aims.BundleListener

Serial processing of bundles.

BundleListener listens events from a BundleProducer object, typically emitted when a new bundle starts or ends, a fiber starts or ends etc.

To use it, BundleListener has to be subclassed and some of the following methods overloaded: * bundleStarted * bundleTerminated * fiberStarted * fiberTerminated * newFiberPoint * noMoreBundle

To connect the listener to a producer, use BundleProducer::addBundleListener().

Inherited classes may inherit both BundleListener and BundleProducer, if they are part of a processing chain.

bundleStarted(self, a0: aims.BundleProducer, a1: aims.BundleInfo)
bundleStarted(producer, bundle_info) None
bundleTerminated(self, a0: aims.BundleProducer, a1: aims.BundleInfo)
bundleTerminated(producer, bundle_info) None
fiberStarted(self, a0: aims.BundleProducer, a1: aims.BundleInfo, a2: aims.FiberInfo)
fiberStarted(producer, bundle_info, fiber_info) None
fiberTerminated(self, a0: aims.BundleProducer, a1: aims.BundleInfo, a2: aims.FiberInfo)
fiberTerminated(producer, bundle_info, fiber_info) None
newFiberPoint(self, a0: aims.BundleProducer, a1: aims.BundleInfo, a2: aims.FiberInfo, a3: AimsVector_FLOAT_3)
newFiberPoint(producer, bundle_info, fiber_info, point) None
noMoreBundle(self, a0: aims.BundleProducer)
noMoreBundle(producer) None
class soma.aims.BundleProducer

Serial processing of bundles.

BundleProducer emits events to a BundleListener object while walking through a bundles set structure (or a bundles file), typically when a new bundle starts or ends, a fiber starts or ends etc.

To connect the listener to a producer, use BundleProducer::addBundleListener().

Inherited classes may inherit both BundleListener and BundleProducer, if they are part of a processing chain.

addBundleListener(self, a0: aims.BundleListener)
addBundleListener(listener) None

Connects a BundleProducer to a BunsdleListener.

addFiberPoint(self, a0: aims.BundleInfo, a1: aims.FiberInfo, a2: AimsVector_FLOAT_3)
noMoreBundle(self)
startBundle(self, a0: aims.BundleInfo)
startFiber(self, a0: aims.BundleInfo, a1: aims.FiberInfo)
terminateBundle(self, a0: aims.BundleInfo)
terminateFiber(self, a0: aims.BundleInfo, a1: aims.FiberInfo)
class soma.aims.BundleReader

Reads a bundles file, and emits events while walking through its data.

BundleReader is a BundleProducer, so can be listened by any BundleListener. It may read several bundles/fibers formats, using a lower-level BundleProducer dedicated to a specific format.

Currently .bundles (AIMS/Connectomist) and .trk (Trackvis) formats are supported.

formatExtensions(format: object = 'ALL') set_STRING
formatExtensions(format='ALL') None

return a set of file extensions associated with the given format. If the format is “ALL” (default) then all extensions of all supported formats are returned. If the format does not exist, an empty set is returned, and no error is issued.

read(self)
read() None

read() is the entry point to fibers processing, and triggers the producer machinery.

supportedFormats() set_STRING
supportedFormats() None

return a set of fiber tracts formats names supported by the BundlesReader.

class soma.aims.BundleWriter

Writes bundles information to a bundles file.

BundleWriter is a BundleListener, thus must be connected to a BundleProducer, and is fed by it.

It will write the .bundles format.

setFileString(self, a0: object)
setFileString(filename) None

Set the output file name.

class soma.aims.BundleToGraph

Bundles structure building as a Graph

The Graph structure is used to represent bundles and fibers when we need to keep their complete structure in memory. This structure is especially used for 3D rendering in Anatomist.

BundleToGraph is a BundleListener, thus has to be connected to a BundleProducer to work (typically, a BundleReader).

Note that the BundleProducer / BundleListener system work as processing chains, and allows to keep only a small set of data in memory at one time. The Graph structure, on the contrary, keeps all information in memory, so may need a large amount of memory.

Conversion classes and functions

soma.aims.convertersObjectToPython = {'POINT2DF': <built-in function fromObject>, 'POINT3DF': <built-in function fromObject>, 'POINT3DI': <built-in function fromObject>, 'POINT3DL': <built-in function fromObject>, 'POINT4DF': <built-in function fromObject>, 'PyObject': <built-in function PyObjectfromObject>, 'S16': <built-in function asInt>, 'S32': <built-in function asInt>, 'U16': <built-in function asInt>, 'U32': <built-in function asInt>, 'boolean': <built-in function asBool>, 'rc_ptr of Mesh of FLOAT': <built-in function fromObject>, 'rc_ptr of Mesh of POINT2DF': <built-in function fromObject>, 'rc_ptr of Mesh of VOID': <built-in function fromObject>, 'rc_ptr of Mesh4 of FLOAT': <built-in function fromObject>, 'rc_ptr of Mesh4 of POINT2DF': <built-in function fromObject>, 'rc_ptr of Mesh4 of VOID': <built-in function fromObject>, 'rc_ptr of Segments of FLOAT': <built-in function fromObject>, 'rc_ptr of Segments of POINT2DF': <built-in function fromObject>, 'rc_ptr of Segments of VOID': <built-in function fromObject>, 'rc_ptr of Transformation3d': <built-in function fromObject>, 'rc_ptr of bucket of DOUBLE': <built-in function fromObject>, 'rc_ptr of bucket of FLOAT': <built-in function fromObject>, 'rc_ptr of bucket of S16': <built-in function fromObject>, 'rc_ptr of bucket of S32': <built-in function fromObject>, 'rc_ptr of bucket of U16': <built-in function fromObject>, 'rc_ptr of bucket of U32': <built-in function fromObject>, 'rc_ptr of bucket of VOID': <built-in function fromObject>, 'rc_ptr of mesh of VOID': <built-in function fromObject>, 'rc_ptr of texture of FLOAT': <built-in function fromObject>, 'rc_ptr of texture of POINT2DF': <built-in function fromObject>, 'rc_ptr of texture of S16': <built-in function fromObject>, 'rc_ptr of texture of S32': <built-in function fromObject>, 'rc_ptr of texture of U32': <built-in function fromObject>, 'string': <function <lambda>>}

Conversion function map. These converters are used to convert between a C++ object inside a generic object to their Python equivalent. They are typically used when accessing a sub-object:

>>> from soma import aims
>>> v = aims.Object(aims.vector_STRING())
>>> v.append('toto')
>>> v.append('bubu')
>>> type(v)
soma.aims.Object
>>> v.type()
'vector of string'
>>> v[0]
'toto'
>>> type(v[0])
str

In this example, v contains a C++ object of type std::vector<std::string>. Its elements are accessed via a wrapping which is using a C++ generic object (carto::Object). But in python we obtain a str (pyton string): the string has been taken out of the generic object using this conversion map (and then converted automatically to str by the SIP tool).

class soma.aims.Converter_Volume_S16_Volume_FLOAT

Converter classes can be used using the convert() method, or as a callable object:

result = converter(input_data)

Parameters:

input_data (Volume_S16) – data to be converted

Returns:

output data – converted data

Return type:

Volume_FLOAT

convert(self, a0: Volume_S16, a1: Volume_FLOAT)
convert(input_data, output_data) None

In-place converson inside existing allocated data

Parameters:
  • input_data (Volume_S16) – data to be converted

  • output_data (Volume_FLOAT) – conversion output will be done into this data

Return type:

None

class soma.aims.ShallowConverter_Volume_S16_Volume_FLOAT(a0: bool = False)
class soma.aims.ShallowConverter_Volume_S16_Volume_FLOAT(a0: ShallowConverter_Volume_S16_Volume_FLOAT)
convert(self, a0: Volume_S16, a1: Volume_FLOAT)

Soma-IO

In this module, the newer IO system Soma-IO and supporting library is made available in Python, in the module soma.aims.soma.

class soma.aims.soma

This class represents the soma C++ namespace. It is rather used like a module, not as a class.

class AffineTransformation3dBase
class AffineTransformation3dBase(other: soma.AffineTransformation3dBase)
class AffineTransformation3dBase(mat: vector_FLOAT)
class AffineTransformation3dBase(mat: carto.Object)
extendOrder(self, n: int)
getInverse(self) rc_ptr_Transformation
invertible(self) bool
isDirect(self) bool
isIdentity(self) bool
scale(self, sizeFrom: AimsVector_FLOAT_3, sizeTo: AimsVector_FLOAT_3)
setToIdentity(self)
setTranslation(self, trans: AimsVector_FLOAT_3)
transform(self, p: AimsVector_S16_3) AimsVector_S16_3
transform(self, dir: AimsVector_FLOAT_3) AimsVector_FLOAT_3
transform(self, pos: AimsVector_DOUBLE_3) AimsVector_DOUBLE_3
transform(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transform(self, pos: vector_S32) vector_S32
transform(self, pos: vector_FLOAT) vector_FLOAT
transform(self, pos: vector_DOUBLE) vector_DOUBLE
transformDouble(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformNormal(self, dir: AimsVector_FLOAT_3) AimsVector_FLOAT_3
transformNormal(self, dir: AimsVector_DOUBLE_3) AimsVector_DOUBLE_3
transformNormal(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformUnitNormal(self, dir: AimsVector_FLOAT_3) AimsVector_FLOAT_3
transformUnitNormal(self, dir: AimsVector_DOUBLE_3) AimsVector_DOUBLE_3
transformUnitNormal(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformVector(self, dir: AimsVector_FLOAT_3) AimsVector_FLOAT_3
transformVector(self, vec: AimsVector_DOUBLE_3) AimsVector_DOUBLE_3
transformVector(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformVector(self, pos: vector_S32) vector_S32
transformVector(self, pos: vector_FLOAT) vector_FLOAT
transformVector(self, pos: vector_DOUBLE) vector_DOUBLE
class AffineTransformationBase(order: int = 3)
class AffineTransformationBase(other: soma.AffineTransformationBase)
class AffineTransformationBase(mat: vector_FLOAT)
class AffineTransformationBase(mat: carto.Object)
extendOrder(self, n: int)
fromColumnVector(self, vec: vector_FLOAT)
getInverse(self) rc_ptr_Transformation
invertible(self) bool
isDirect(self) bool
isIdentity(self) bool
property np

The np property is a shortcut to the __array__ method. Thus:

something.np

is a handier equivalent to:

numpy.asarray(something)
order(self) int
setToIdentity(self)
squeezeOrder(self, n: int, check: bool = True, notify_fail: bool = True)
toColumnVector(self) vector_FLOAT
toMatrix()

This function return a copy of the transformation matrix

toVector(self) vector_FLOAT
transform(self, pos: vector_S32) vector_S32
transform(self, pos: vector_FLOAT) vector_FLOAT
transform(self, pos: vector_DOUBLE) vector_DOUBLE
class DataSource(*args)

Abstraction layer for various data sources (file, buffer, socket…).

It can be seen as a stream, and is inspired by the QIODevice of Qt library.

Abstract class.

class IterateMode
class Mode
allowsMemoryMapping(self) bool

returns True if memory mapping is allowed on this kind of stream

at(self) int

offset = at()

returns the current position in the stream

at(self, pos: int) -> bool bool at(pos)

Sets the current position in the stream (when supported). Returns True if successful.

atEnd(self) bool

True if the current position is at the end of the stream

clone(self) soma.DataSource | None

duplicate the DataSource object

close(self)

Close the stream

eof(self) bool

when the end of stream is reached

flush(self)

flush the stream for buffered output

getch(self) int

read one char and returns it

isOpen(self) bool

tells if the stream is open / ok.

iterateMode(self) int

bitwise combination of possible access: direct (1) or sequential (2) access

mode(self) int

access mode(s) (read/write): bitwise OR of Mode values

none() rc_ptr_DataSource

An empty ref-counter that is more convenient than calling a constructor of rc_ptr_DataSource (useful when calling functions)

open(self, mode: int) bool
open(mode) None

Opens the stream (when supported) in the specified Mode

Parameters:

mode (int) – access Mode: Read (1), Write (2) or ReadWrite (3)

Returns:

ok – if the operation was successful

Return type:

bool

putch(self, ch: int) int
putch(ch) None

write one char, and returns it

Parameters:

ch (int) – char to write

readBlock(self, data: bytes | None, maxlen: int) int
readBlock(data, maxlen) None
Parameters:
  • data (char*) – read buffer (C++)

  • maxlen (unsigned long int) – number of bytes to read

Returns:

num – number of bytes actually read

Return type:

long int

reset(self) bool

reset the stream and get to the start

size(self) int

size (or len) of the data inn stream, in bytes

ungetch(self, ch: int) bool
ungetch(ch) None

un-read one char: put it back in the read buffer, and rewind one char

url(self) object

URL of filename for the stream, when available

writeBlock(self, data: bytes | None, len: int) int
writeBlock(data, len) None
Parameters:
  • data (const char * (C++)) – buffer to be written

  • len (unsigned long int) – size of the buffer to be written

Returns:

num – number of bytes actually written

Return type:

long int

class DataSourceCapabilities

Reading/Writing Capabilities of a FormatReader

This object is constructed by the FormatChecker after reading the header. It allows one to give information about the possible ways to read a volume ( partial reading … ).

see DataSourceInfo

allowsMemoryMapping(self) bool
canHandleStrides(self) bool
canSeekLine(self) bool
canSeekSlice(self) bool
canSeekVolume(self) bool
canSeekVoxel(self) bool
isInit(self) bool

Did we initialize the capabilities ? default : False Since a DataSourceInfo can be either fully initialized because of a previous call to DataSourceInfoLoader or be only partially initialized because we just know the header, it is important to know if the value of this object matters or not. each time one of the mutators is called, setInit( true ) is also called.

isOrdered(self) bool
isRandomAccessEfficient(self) bool
isThreadSafe(self) bool
mappableDataSource(self) rc_ptr_DataSource
reset(self)

Sets the whole capabilities to its default value (including isInit() to false )

setDataSource(self, ds: rc_ptr_DataSource)
setHandleStrides(self, boo: bool = True)
setInit(self, boo: bool = True)
setMemoryMapping(self, boo: bool = True)
setOrdered(self, boo: bool = True)
setRandomAccessEfficient(self, boo: bool = True)
setSeekLine(self, boo: bool = True)
setSeekSlice(self, boo: bool = True)
setSeekVolume(self, boo: bool = True)
setSeekVoxel(self, boo: bool = True)
setThreadSafe(self, boo: bool = True)
class DataSourceInfo(ds: rc_ptr_DataSource, dim: vector_S32 = vector_S32())
DataSourceInfo(ds, dim=[]):

Build a DataSourceInfo from a DataSource, and dimensions

DSList is set as containing only ds pointed by “default” key. Capabilities are set uninitialized. If dim is given, a header is built with keys size[X,Y,Z,T]. Else the header is none().

soma.DataSourceInfo(ds: rc_ptr_DataSource, header: carto.Object) DataSourceInfo(ds, header):

Build a DataSourceInfo from a DataSource and an existing header

soma.DataSourceInfo(fname: object) DataSourceInfo(fname):

Builds a DataSourceInfo from a filename

Parameters:
  • ds (rc_ptr_DataSource)

  • dim (vector_S32) – dimensions (for a volume), up to 4 dimensions

  • header (Object)

  • fname (string)

  • soma.DataSourceInfo(a0 (soma.DataSourceInfo))

  • system (Informative object used by IO)

  • FormatChecker (This object is used by)

  • to (FormatReader or FormatWriter)

  • contains (describe a DataSource. It contains a DataSourceList which)

  • DataSource (at first a single default)

  • a (a Object header and)

  • DataSourceCapabilities.

  • files (* The list is built by a FormatChecker and contains all the) – involved in the reading/writing process (header, data, …)

  • information. (* The header is built by a FormatChecker and contains meta)

  • format (* The DSC contains properties dependant of the) – the specific file, the reading process (partial reading), etc.

:param : the specific file, the reading process (partial reading), etc. :param It is possible to fix some or all of these three objects so that: :param they are not recomputed by the FormatChecker.: :param see DataSourceInfoLoader DataSourceList DataSourceCapabilities:

capabilities(self) soma.DataSourceCapabilities
header(self) carto.Object

get the header dict of the underlying data

identifiedFormat(self) object

file format name

list(self) soma.DataSourceList

get the DataSourceList of the underlying data

setIdentifiedFormat(self, format: object)
setIdentifiedFormat(format) None

force the identified format name

url(self) object

main filename or URL

class DataSourceInfoLoader

Generic information retreiver / checker for all data sources and file formats

It replaces aims.Finder.

DataSourceInfoLoader provides a plug-in system for new formats and data types. Formats are hidden in the plugins and should never be accessed directly.

Usage: check() the DataSourceInfo and then process according to the object type (“Volume of S16”, “Mesh”, “Texture”, “Bucket”, …).

Use the generic Reader once the data type is known, the right format will be selected automatically.

Avoiding manually switching on objects and data types is possible using the ReaderAlgorithm interface and presumably, template functions.

Here is an example of how to use the DataSourceInfoLoader class:

from soma import aims
from soma.aims import soma

f = soma.DataSourceInfoLoader()
info = f.check("toto.nii")
if not info.header():
    print "could not load", info.url()
else:
  object_type = info.header()["object_type"]
  if object_type == aims.typeCode(aims.Volume_S16):
      vr = soma.Reader_Volume_S16(info)
      try:
          vol = vr.read()
          print "volume read"
      except:
          print "Error loading", info.url()
  elif object_type == aims.typeCode(aims.Object):
      # do your thing
      print "Object"
  else:
      print info.url(), "is of type", object_type, \
          "which is not handled"

see DataSourceInfo, Reader, ReaderAlgorithm

class State
check(self, dsi: soma.DataSourceInfo, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 3) soma.DataSourceInfo
check(dsi, options=aims.carto.none(), passbegin=1, passend=3) None

Finds the right format checker

It is possible to specify wich passes to process through passbegin and passend. * pass 1: extension * pass 2: empty extension * pass 3: all writers see DataSourceInfo DataSourceList DataSourceCapabilities

Parameters:
  • dsi (DataSourceInfo containing header, DSlist and .) – capabilities. It allows us to have none, some or all information already computed. It is for the DSIloader to deal with the all case, and for the FormatCheckers to deal with some and none cases.

  • options (A dictionary containing options. They may not be of) – any use to the checker, but soma are (resolution_level).

Returns:

  • A DataSourceInfo object containing a header, a list of

  • DataSource and a list of Capabilities.

  • check(self, filename (object, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 3) -> soma.DataSourceInfo)

errorMessage(self) object

error message from the last check

extensions(format: object) set_STRING
extensions(format) None

Query supported file extensions for a format

Parameters:

format (string) – format to query

Returns:

exts – set of extensions names

Return type:

set_STRING

launchException(self)

raise the read exception which was most probably the cause of a check() failure

readMinf(ds: soma.DataSource, base: carto.Object = carto.none(), options: carto.Object = carto.none()) carto.Object
readMinf(ds, base=aims.none(), options=aims.none()) None

read a .minf file dictionary

Parameters:
  • ds (DataSource) – minf file DataSource

  • base (Object) – base dict to be completed by .minf information

  • options (Object) – options dict

Returns:

minf – the minf file contents as a dictionary

Return type:

Object

state(self) soma.DataSourceInfoLoader.State

state of the DataSourceInfoLoader reading trial

class DataSourceList
DataSourceList():

Builds a map containing only (“default”, empty pointer)

soma.DataSourceList(ds: rc_ptr_DataSource, type: object = “default”) DataSourceList(ds, type=”default”):

Builds a 1-element map This allows to construct easily a 1 element list, useful when declaring a Reader which creator takes a source as parameter.

Parameters:
  • ds (rc_ptr_DataSource) – Element to insert

  • type (string) – Category of the source. default key is “default”: used at Reader construction

  • soma.DataSourceList(a0 (soma.DataSourceList))

  • DataSource. (This class allows to manipulate "lists" of pointers to)

  • by (It has the design of a dictionary in order to sort sources)

  • (header (content)

  • minf

  • data

  • on (...). Since those contents depend)

  • format (the)

  • checkers (the keywords used are defined by specific)

  • readers. (and)

  • FormatReader (see FormatChecker)

  • the (The only global keyword is "default" which is used to store)

  • reader. (DataSource defining (at construction) a)

  • Reader (see)

  • note:: (..) – The “default” keyword always contains at least one entry, which may be empty. I haven’t for now found any use to several “default” entries.

  • methods. (Access to a source is done using dataSource(...))

  • numbering (Sources are ordered by increasing order of insertion and)

  • 0. (starts at)

addDataSource(self, a0: object, a1: rc_ptr_DataSource)
addDataSource(key, ds) None

Adds an element to the dictionary If new keyword, creates it.

Parameters:
dataSource(self, key: object = 'default', i: int = 0) rc_ptr_DataSource

datasource(key=”default”, i=0)

Accessing an element of the list If keyword doesn’t exist, or is empty, or coordinate is undefined, launches exception.

Parameters:
  • key (string (optional)) – keyword

  • i (int (optional)) – number of the element in list. Numbering starts at 0

empty(self) bool

Returns true only if no keyword inserted.

Warning

May return false while no DataSource present

empty(self, a0: object) -> bool True if there is no key in the dictionary

exists(self, a0: object) bool
exists(key) None

True if the key exists in the dictionary

reset(self)

clear the dictionary: all keys and contents are removed.

size(self, a0: object) int
size(key) None

number of elements with the key key

typecount(self) int

number of keys in the types dictionary

types(self) set_STRING

Returns existing keywords.

Warning

There may be existing keywords with no DataSource

class FDDataSource(*args)

DataSource specialization for file descriptor stream

allowsMemoryMapping(self) bool
at(self) int
at(self, pos: int) bool
clone(self) soma.DataSource | None
close(self)
descriptor(self) int

get the file descriptor

getch(self) int
isFile(self) bool

True if the DataSource is a file

isOpen(self) bool
iterateMode(self) int
open(self, mode: int) bool
putch(self, ch: int) int
readBlock(self, data: bytes | None, maxlen: int) int
setDescriptor(self, fd: int)
setDescriptor(fd) None

Set the file descriptor fd (int)

size(self) int
ungetch(self, ch: int) bool
writeBlock(self, data: bytes | None, len: int) int
class FileDataSource(filename: object, offset: int = 0, mode: int = soma.DataSource.Read)
class FileDataSource(filename, offset=0, mode=aims.soma.DataSource.Read)
Parameters:
  • filename (string) – file name on the filesystem

  • offset (soma.offset_t (optional)) – offset to start reading in the file

  • mode (aims.soma.DataSource.Mode (optional)) – read / write mode

  • soma.FileDataSource(a0 (soma.FileDataSource))

  • file. (DataSource specialization for a)

allowsMemoryMapping(self) bool
at(self) int
at(self, pos: int) bool
clone(self) soma.DataSource | None
close(self)
getch(self) int
initialOffset(self) int

initial offset in the input file to start reading

isOpen(self) bool
iterateMode(self) int
open(self, mode: int) bool
putch(self, ch: int) int
readBlock(self, data: bytes | None, maxlen: int) int
size(self) int
ungetch(self, ch: int) bool
url(self) object

file name or URL of the file

writeBlock(self, data: bytes | None, len: int) int
class Reader_Object

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: carto.Object, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: carto::Object, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[carto.Object])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_CDOUBLE

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_CDOUBLE, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_CDOUBLE, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_CDOUBLE])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_CFLOAT

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_CFLOAT, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_CFLOAT, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_CFLOAT])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_DOUBLE

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_DOUBLE, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_DOUBLE, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_DOUBLE])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_FLOAT

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_FLOAT, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_FLOAT, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_FLOAT])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_HSV

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_HSV, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_HSV, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_HSV])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_POINT3DF

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_POINT3DF, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_POINT3DF, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_POINT3DF])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_RGB

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_RGB, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_RGB, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_RGB])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_RGBA

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_RGBA, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_RGBA, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_RGBA])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_S16

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_S16, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_S16, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_S16])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_S32

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_S32, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_S32, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_S32])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_U16

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_U16, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_U16, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_U16])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_U32

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_U32, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_U32, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_U32])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Reader_Volume_U8

Soma-IO Reader class. This is a C++ template class, which can read a specific type of data. All supported formats can be read.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

  • rc_ptr_DataSourceInfo: DataSource with info (more optimal when the data source has been identified and the header loaded)

allocatorContext(self) carto.AllocatorContext

Get the allocation context

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a DataSource to read from (rc_ptr_DataSource)

attach(self, filename: object, offset: int = 0) attach(filename, offset=0)

Attach a new filename + offset for reading

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

dataSourceInfo(self) rc_ptr_DataSourceInfo

Get the dataSourceInfo, providing information on the read data

flush(self)

Flush the read buffer

options(self) carto.Object

Get reading options (Object dictionary)

read(self, obj: Volume_U8, header: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Read an object from source. Two main modes exist:

  • full: read a full new object and return it

  • in-place: read an existing object, in-place

A multi-pass procedure is used to identify and read the data from the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all readers

Parameters:
  • header (Object (optional)) – in-place mode: Volume_U8, object to be read. OR: full mode: header (Object), optional

  • header

  • passbegin (int (optional)) – begin at given step of the multi-pass identification/read procedure

  • passend (int (optional)) – end at given step of the multi-pass identification/read procedure

Returns:

  • in-place mode – True upon success False upon failure (but readers will more likely throw an exception)

  • full mode – the read object

  • read(self, header (carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) -> Optional[Volume_U8])

setAllocatorContext(self, ac: carto.AllocatorContext)
setAllocatorContext(context) None

Set allocation context for reading

setOptions(self, options: carto.Object)
setOptions(options) None

set reading options (Object dictionary)

class Transformation(*args)

Base class for spatial transformations.

getInverse(self) rc_ptr_Transformation
invertible(self) bool
isDirect(self) bool
isIdentity(self) bool

Test if the transformation can safely be omitted

This method must only return true if the transformation behaves exactly like an identity transformation (notably, the transform methods will always return the input coordinates unchanged).

NOTE: Implementors of derived classes may choose to always return false if a test would be difficult to implement or expensive to run.

setHeader(self, ph: carto.Object)
transform(self, pos: vector_S32) vector_S32
transform(self, pos: vector_FLOAT) vector_FLOAT
transform(self, pos: vector_DOUBLE) vector_DOUBLE
transformVector(self, pos: vector_S32) vector_S32
transformVector(self, pos: vector_FLOAT) vector_FLOAT
transformVector(self, pos: vector_DOUBLE) vector_DOUBLE
vadd(v1: vector_S32, v2: vector_S32) vector_S32

vadd(v1: vector_FLOAT, v2: vector_FLOAT) -> vector_FLOAT

vadd(v1: vector_DOUBLE, v2: vector_DOUBLE) -> vector_DOUBLE vector arithmetics, as convenience static functions

vadd(v1: vector_S32, v2: int) -> vector_S32

vadd(v1: vector_FLOAT, v2: float) -> vector_FLOAT

vadd(v1: vector_DOUBLE, v2: float) -> vector_DOUBLE vector arithmetics, as convenience static functions

vadd(v1: int, v2: vector_S32) -> vector_S32

vadd(v1: float, v2: vector_FLOAT) -> vector_FLOAT

vadd(v1: float, v2: vector_DOUBLE) -> vector_DOUBLE vector arithmetics, as convenience static functions

vsub(v1: vector_S32, v2: vector_S32) vector_S32

vsub(v1: vector_FLOAT, v2: vector_FLOAT) -> vector_FLOAT

vsub(v1: vector_DOUBLE, v2: vector_DOUBLE) -> vector_DOUBLE vector arithmetics, as convenience static functions

vsub(v1: vector_S32, v2: int) -> vector_S32

vsub(v1: vector_FLOAT, v2: float) -> vector_FLOAT

vsub(v1: vector_DOUBLE, v2: float) -> vector_DOUBLE vector arithmetics, as convenience static functions

vsub(v1: int, v2: vector_S32) -> vector_S32

vsub(v1: float, v2: vector_FLOAT) -> vector_FLOAT

vsub(v1: float, v2: vector_DOUBLE) -> vector_DOUBLE vector arithmetics, as convenience static functions

class Transformation3d(*args)

Base class for spatial transformations in 3D.

fromObject(a0: carto.GenericObject) rc_ptr_Transformation3d
toObject(self) carto.Object
transform(self, p: AimsVector_S16_3) AimsVector_S16_3
transform(self, dir: AimsVector_FLOAT_3) AimsVector_FLOAT_3
transform(self, pos: AimsVector_DOUBLE_3) AimsVector_DOUBLE_3
transform(self, pos: vector_S32) vector_S32
transform(self, pos: vector_FLOAT) vector_FLOAT
transform(self, pos: vector_DOUBLE) vector_DOUBLE
transform(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformDouble(self, x: float, y: float, z: float) AimsVector_DOUBLE_3
transformPoints(self, a0: Any) Any
transformVector(self, pos: vector_S32) vector_S32
transformVector(self, pos: vector_FLOAT) vector_FLOAT
transformVector(self, pos: vector_DOUBLE) vector_DOUBLE
class Writer_Object

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: carto.Object, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (carto::Object) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_CDOUBLE

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_CDOUBLE, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_CDOUBLE) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_CFLOAT

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_CFLOAT, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_CFLOAT) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_DOUBLE

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_DOUBLE, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_DOUBLE) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_FLOAT

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_FLOAT, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_FLOAT) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_HSV

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_HSV, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_HSV) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_POINT3DF

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_POINT3DF, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_POINT3DF) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_RGB

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_RGB, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_RGB) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_RGBA

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_RGBA, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_RGBA) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_S16

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_S16, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_S16) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_S32

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_S32, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_S32) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_U16

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_U16, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_U16) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_U32

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_U32, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_U32) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data

class Writer_Volume_U8

Soma-IO Writer class. This is a C++ template class, which can write a specific type of data. All supported formats can be written.

Constructor parameters may be:

  • string: filename

  • rc_ptr_DataSource: generic DataSource

attach(self, ds: rc_ptr_DataSource)
attach(ds) None

Attach a new data source (rc_ptr_DataSource) to write into

attach(self, filename: object) attach(filename)

Attach a new output file name to write into

close(self)

Close the data source stream

dataSource(self) rc_ptr_DataSource

Get the data source (rc_ptr_DataSource)

flush(self)

flush the write buffer

write(self, obj: Volume_U8, options: carto.Object = carto.none(), passbegin: int = 1, passend: int = 4) bool

Write the given object to the data source (generally files)

A multi-pass procedure is used to identify and write the data to the data source:

  • pass 1: format hint

  • pass 2: extension

  • pass 3: empty extension

  • pass 4: all writes

Parameters:
  • obj (Volume_U8) – object to write

  • options (Object (optional)) – Options can be passed to specify some writing parameters. The most important is the format (“format” property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

  • passbegin (int (optional))

  • passend (int (optional))

Return type:

True upon success, False upon failure, but an exception is more likely thrown in such case

writtenObjectType(self) object

After writing, get the object type code (string) of the data