sfftkrw.schema Adapters

The version-specific APIs which are dynamically imported.

adapter_v0_8_0_dev1

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFBiologicalAnnotation(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Biological annotation

as_hff(parent_group, name='biological_annotation', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
description

a brief description for this segment

external_references

the set of external references

classmethod from_hff(parent_group, name='biological_annotation', args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

name

the name of this segment

number_of_instances

the number of instances of this segment

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFBoundingBox(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Dimensions of bounding box

as_hff(parent_group, name='bounding_box', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='bounding_box', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

xmax

maximum x co-ordinate value

xmin

minimum x co-ordinate value

ymax

maximum y co-ordinate value

ymin

minimum y co-ordinate value

zmax

maximum z co-ordinate value

zmin

minimum z co-ordinate value

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFCone(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape

Cone shape class

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
bottom_radius

cone bottom radius

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

height

cone height

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFCuboid(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape

Cuboid shape class

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.cuboid

x

length in x

y

length in y

z

length in z

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFCylinder(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape

Cylinder shape class

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
diameter

cylinder diameter

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

height

cylinder height

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFEllipsoid(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape

Ellipsoid shape class

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.ellipsoid

x

length in x

y

length in y

z

length in z

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFEncodedSequence(**kwargs)

Bases: sfftkrw.schema.base.SFFType

Abstract base class for SFFVertices, SFFNormals and SFFTriangles

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
data_array

The data as a numpy.ndarray

classmethod from_array(data, mode=None, endianness=None)

Create a SFFVertices object from a numpy array inferring size and assuming certain defaults

Parameters:
  • data (numpy.ndarray) – the data as a numpy.ndarray object
  • mode (bytes or str or unicode) – the size of each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64``float32, float64
  • endianness (bytes or str or unicode) – byte ordering: little (default) or big
Returns:

a SFFVertices object

Return type:

SFFVertices

classmethod from_bytes(byte_seq, num_items, mode=None, endianness=None)

Create a SFFVertices object using a bytes object

Parameters:
  • byte_seq (bytes or unicode) – the data as a base64-encoded sequence; can be bytes or unicode
  • num_vertices (int) – the number of vertices contained (for validation)
  • mode (bytes or str or unicode) – the size of each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64``float32, float64
  • endianness (bytes or str or unicode) – byte ordering: little (default) or big
Returns:

a SFFVertices object

Return type:

SFFVertices

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

num_items_kwarg = None

the name of the attribute with the size

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFExternalReference(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

accession

the accession for this external reference

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
description

a long description of this external reference

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

id

this external reference’s ID

label

a short description of this external reference

resource

the ontology/archive name

url

a URL/IRI where data for this external reference may be obtained

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFExternalReferenceList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for external references

as_hff(parent_group, name='external_references', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='external_references', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFGlobalExternalReferenceList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for global external references

as_hff(parent_group, name='global_external_references', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='global_external_references', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFLattice(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class representing 3D

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
data

data provided by a numpy.ndarray, byte-sequence or unicode string; the dimensions should correspond with those specified in the ‘size’ attribute

data_array

The data as a numpy.ndarray

endianness

endianness; either ‘little’ (default) or ‘big’

classmethod from_array(data, size=None, mode='uint32', endianness='little', start=SFFVolumeIndex(rows=0, cols=0, sections=0))

Create a SFFLattice object from a numpy array inferring size and assuming certain defaults

Parameters:
Returns:

a SFFLattice object

Return type:

SFFLattice

classmethod from_bytes(byte_seq, size, mode='uint32', endianness='little', start=SFFVolumeIndex(rows=0, cols=0, sections=0))

Create a SFFLattice object using a bytes object

Parameters:
  • byte_seq (bytes or unicode) – the data as a base64-encoded, zipped sequence; can be bytes or unicode
  • size (SFFVolumeStructure) – the size of the lattice as a SFFVolumeStructure object
  • start (SFFVolumeIndex) – the values of the corner voxel
  • mode (bytes or str or unicode) – the size of each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64``float32, float64
  • endianness (bytes or str or unicode) – byte ordering: little (default) or big
Returns:

a SFFLattice object

Return type:

SFFLattice

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

id

the ID for this lattice (referenced by 3D volumes)

mode

type of data for each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64

size

size of the lattice described using a sfftkrw.schema.adapter.SFFVolumeStructure object

start

starting index of the lattices described using a:py:class:sfftkrw.schema.adapter.SFFVolumeIndex object

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFLatticeList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

A container for lattice objects

as_hff(parent_group, name='lattice_list', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='lattice_list', args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFMesh(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Single mesh

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

id

the mesh ID

normals

a list of normals which correspond to vertices

transform_id

a transform applied to the mesh

triangles

a list of triangles; each triangle is represented by a trio of vertex indices

vertices

a list of vertices

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFMeshList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Mesh list representation

as_hff(parent_group, name='mesh_list', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='mesh_list', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFNormals(**kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFEncodedSequence

Normals

as_hff(parent_group, name='normals', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

data

base64-encoded packed binary data

endianness

binary packing endianness [default: ‘little’]

classmethod from_hff(parent_group, name='normals', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.normals_type

mode

data type; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64 [default: ‘float32’]

num_normals

the number of normals contained

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFRGBA(random_colour=False, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Colours

alpha

alpha (opacity) channel

as_hff(parent_group, name='colour', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

Export as JSON

blue

blue channel

classmethod from_hff(parent_group, name='colour', args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

green

green channel

red

red channel

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSegment(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class that encapsulates segment data

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

Format this segment as JSON

biological_annotation

the biological annotation for this segment; described using a sfftkrw.schema.adapter.SFFBiologicalAnnotation object

colour

this segments colour; described using a sfftkrw.schema.adapter.SFFRGBA object

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.segment_type

id

the ID for this segment; segment IDs begin at 1 with the value of 0 implying the segmentation i.e. all segments are children of the root segment (the segmentation)

mesh_list

the list of mesh_list (if any) that describe this segment; a sfftkrw.schema.adapter.SFFMeshList object

parent_id

the ID for the segment that contains this segment; defaults to 0 (the whole segmentation)

shape_primitive_list

the list of shape primitives that describe this segment; a sfftkrw.schema.adapter.SFFShapePrimitiveList object

three_d_volume

the 3D volume (if any) that describes this segment; a sfftkrw.schema.adapter.SFFThreeDVolume object

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSegmentList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for segments

as_hff(parent_group, name='segment_list', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='segment_list', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSegmentation(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Adapter class to make using the output of generateDS easier to use

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
bounding_box

the bounding box in which the segmentation sits; a sfftkrw.schema.adapter.SFFBoundingBox object

clear_annotation(from_id)

Clear all annotations from the segment with ID specified

Parameters:from_id – segment ID
Returns:
copy_annotation(from_id, to_id)

Copy annotation across segments

Parameters:
  • from_id (int/list) – segment ID to get notes from; use -1 for for global notes
  • to_id (int/list) – segment ID to copy notes to; use -1 for global notes
details

any other details about this segmentation (free text)

classmethod from_file(fn, args=None)

Instantiate an SFFSegmentations object from a file name

The file suffix determines how the data is extracted.

Parameters:fn (str) – name of a file hosting an EMDB-SFF-structured segmentation
Return seg:the corresponding SFFSegmentation object
Rtype seg:SFFSegmentation
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.segmentation

global_external_references

a list of external references that apply to the whole segmentation (global); a sfftkrw.schema.adapter.SFFGlobalexternal_references object

lattice_list

the list of lattices (if any) containing 3D volumes referred to; a sfftkrw.schema.adapter.SFFLatticeList object

merge_annotation(other_seg, include_colour=False)

Merge the annotation from another sff_seg to this one

Parameters:
  • other_seg (sfftkrw.SFFSegmentation) – segmentation to get annotations from
  • include_colour (bool) – copy the colours from the source (useful if you want control over the colours)
name

the name of this segmentation

primary_descriptor

the main type of representation used for this segmentation; can be one of ‘mesh_list’, ‘shape_primitive_list’ or ‘threeDVolume’

segment_list

the list of annotated segments; a sfftkrw.schema.adapter.SFFSegmentList object

software_list

the list of software tools used to crate this segmentation a sfftkrw.schema.adapter.SFFSoftwareList object

to_file(*args, **kwargs)

Alias for export() method. Passes all args and kwargs onto SFFSegmentation.export()

transform_list

a list of transforms; a sfftkrw.schema.adapter.SFFTransformList object

version

EMDB-SFF version

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Base shape class

attribute

extra attribute information e.g. ‘FOM’

id

the ID of this shape

transform_id

the transform applied to this shape to position it in the space

classmethod update_counter(value)

Update the index for all subclasses sequentially for sibling classes

This method works alongside the index_in_super class attribute.

The superclass must specify this method to ensure correct sequencing of shared indices.

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFShapePrimitiveList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for shapes

as_hff(parent_group, name='shape_primitive_list', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='shape_primitive_list', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

num_cones

The number of cones in this container

num_cuboids

The number of cuboids in this container

num_cylinders

The number of cylinders in this container

num_ellipsoids

The number of ellipsoids in this container

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSoftware(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class definition for specifying software used to create this segmentation

name

The name of the software used

version

The version string

processing_details

Details of how the segmentation was produced

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

id

the software ID

name

the software/programmeu’s name

processing_details

a description of how the data was processed to produce the segmentation

version

the version used

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSoftwareList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

List of SFFSoftware objects

as_hff(parent_group, name='software_list', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='software_list', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFSubtomogramAverage(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFShape

Subtomogram average class

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

lattice_id

the ID of the lattice holding the subtomogram average

transform_id

the transform applied to this shape to position it in the space

value

the value at which the contour is defined

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFThreeDVolume(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Class representing segments described using a 3D volume

as_hff(parent_group, name='three_d_volume', args=None)

Return an SFFType object given an HDF5 object

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='three_d_volume', args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

lattice_id

the ID of the lattice that has the data for this 3D volume

transform_id

a transform applied to this 3D volume [optional]

value

the voxel values associated with this 3D volume

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFTransformList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for transforms

as_hff(parent_group, name='transform_list', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(parent_group, name='transform_list', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.transform_listType

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFTransformationMatrix(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Transformation matrix transform

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
cols

the number of columns in this matrix

data

a string sequence by row of the data in this matrix

classmethod from_array(ndarray, **kwargs)

Construct an SFFTransformationMatrix object from a numpy numpy.ndarray array

Parameters:ndarray (numpy.ndarray) – a numpy array
Returns:a SFFTransformationMatrix object
classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.transformation_matrix_type

id

an ID for this transform

rows

the number of rows in this matrix

static stringify(array)

Convert a numpy.ndarray to a space-separated list of numbers

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFTriangles(**kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFEncodedSequence

Triangles

as_hff(parent_group, name='triangles', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

data

base64-encoded packed binary data

endianness

binary packing endianness [default: ‘little’]

classmethod from_hff(parent_group, name='triangles', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.triangles_type

mode

data type; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64 [default: ‘float32’]

num_triangles

the number of triangles contained

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFVertices(**kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFEncodedSequence

Vertices: neither a list nor an index type but is encoded

Suggests the need for an SFFCodedType which has encoded data with _encode and _decode services/methods.

as_hff(parent_group, name='vertices', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

data

base64-encoded packed binary data

endianness

binary packing endianness [default: ‘little’]

classmethod from_hff(parent_group, name='vertices', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_8_0_dev1.vertices_type

mode

data type; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64 [default: ‘float32’]

num_vertices

the number of vertices contained

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFVolume(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Class for represention 3-space dimension

as_hff(parent_group, name=None, args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
cols

number of columns

classmethod from_hff(parent_group, name=None, args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

rows

number of rows

sections

number of sections (sets of congruent row-column collections)

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFVolumeIndex(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFVolume

Class representing volume indices

as_hff(parent_group, name='start', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

classmethod from_hff(parent_group, name='start', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_8_0_dev1.SFFVolumeStructure(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_8_0_dev1.SFFVolume

as_hff(parent_group, name='size', args=None)

Returns the current object as a group in an HDF5 file with the given name

For instances which are subclasses of base.SFFIndexType name will be a string version of the index (id). If id is None then we will generate a unique one so as to write the object to file. Therefore, the process of writing to HDF5 could end up looking slightly different from the original if the original had missing indexes for some objects.

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the populated parent group

Return type:

Group

classmethod from_hff(parent_group, name='size', args=None)

Convert HDF5 objects into EMDB-SFF objects It should either return a valid object or raise an SFFValueError due to failed validation

Parameters:
  • parent_group (Group) – an HDF5 Group that will contain the objects in this object
  • args (argparse.Namespace) – command line arguments
  • name (str or None) – the name to be given to this object in the object hierarchy (default: None)
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

voxel_count

The number of voxels in this volume

adapter_v0_7_0_dev0

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFBiologicalAnnotation(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Biological annotation

as_hff(parent_group, name='biologicalAnnotation', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
description

a brief description for this segment

external_references

the set of external references

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

name

the name of this segment

number_of_instances

the number of instances of this segment

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFBoundingBox(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Dimensions of bounding box

as_hff(parent_group, name='boundingBox', args=None)

Bounding box as HDF5 group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(hff_data, name=None, args=None)

Bounding box from HDF5 group

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

xmax

maximum x co-ordinate value

xmin

minimum x co-ordinate value

ymax

maximum y co-ordinate value

ymin

minimum y co-ordinate value

zmax

maximum z co-ordinate value

zmin

minimum z co-ordinate value

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFComplexList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Class that encapsulates complex

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

ids

the list of complex ids

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFComplexesAndMacromolecules(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Complexes and macromolecules

as_hff(parent_group, name='complexesAndMacromolecules', args=None)

Return the data of this object as an HDF5 group in the given parent group

complexes

a list of complex accessions

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

gds_type

alias of sfftkrw.schema.v0_7_0_dev0.macromoleculesAndComplexesType

macromolecules

a list of macromolecule accessions

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFCone(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFShape

Cone shape class

bottom_radius

cone bottom radius

height

cone height

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFCuboid(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFShape

Cuboid shape class

gds_type

alias of sfftkrw.schema.v0_7_0_dev0.cuboid

x

length in x

y

length in y

z

length in z

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFCylinder(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFShape

Cylinder shape class

diameter

cylinder diameter

height

cylinder height

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFEllipsoid(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFShape

Ellipsoid shape class

gds_type

alias of sfftkrw.schema.v0_7_0_dev0.ellipsoid

x

length in x

y

length in y

z

length in z

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFExternalReference(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class that encapsulates an external reference

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
description

a long description of this external reference

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

id

this external reference’s ID

label

a short description of this external reference

other_type

a URL/IRI where data for this external reference may be obtained

type

the ontology/archive name

value

the accession for this external reference

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFExternalReferenceList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for external references

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFGlobalExternalReferenceList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for global external references

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFLattice(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class representing 3D

as_hff(parent_group, name='{}', args=None)

Return the data of this object as an HDF5 group in the given parent group

data

data provided by a numpy.ndarray, byte-sequence or unicode string; the dimensions should correspond with those specified in the ‘size’ attribute

endianness

endianness; either ‘little’ (default) or ‘big’

classmethod from_array(data, size=None, mode='uint32', endianness='little', start=SFFVolumeIndex(cols=0, rows=0, sections=0))

Create a SFFLattice object from a numpy array inferring size and assuming certain defaults

Parameters:
Returns:

a SFFLattice object

Return type:

SFFLattice

classmethod from_bytes(byte_seq, size, mode='uint32', endianness='little', start=SFFVolumeIndex(cols=0, rows=0, sections=0))

Create a SFFLattice object using a bytes object

Parameters:
  • byte_seq (bytes or unicode) – the data as a base64-encoded, zipped sequence; can be bytes or unicode
  • size (SFFVolumeStructure) – the size of the lattice as a SFFVolumeStructure object
  • start (SFFVolumeIndex) – the values of the corner voxel
  • mode (bytes or str or unicode) – the size of each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64``float32, float64
  • endianness (bytes or str or unicode) – byte ordering: little (default) or big
Returns:

a SFFLattice object

Return type:

SFFLattice

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

id

the ID for this lattice (referenced by 3D volumes)

mode

type of data for each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64

size

size of the lattice described using a sfftkrw.schema.adapter.SFFVolumeStructure object

start

starting index of the lattices described using a:py:class:sfftkrw.schema.adapter.SFFVolumeIndex object

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFLatticeList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

A container for lattice objects

as_hff(parent_group, name='lattices', args=None)

Return the data of this object as an HDF5 group in the given parent group

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFMacromoleculeList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Class that encapsulates macromolecule

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

ids

the list of macromolecule ids

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFMesh(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Single mesh

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

num_polygons

The number of polygons in this mesh

num_vertices

The number of vertices in this mesh

polygons

a list of derived polygons (object of class sfftkrw.schema.adapter.SFFPolygonList)

transform_id

a transform applied to the mesh

vertices

a list of vertices (object of class sfftkrw.schema.adapter.SFFVertexList)

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFMeshList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Mesh list representation

as_hff(parent_group, name='meshes', args=None)

Return the data of this object as an HDF5 group in the given parent group

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFPolygon(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType, sfftkrw.schema.base.SFFIndexType

Single polygon

id

the ID for this polygon

vertices

the list of vertices

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFPolygonList(**kwargs)

Bases: sfftkrw.schema.base.SFFListType

List of polygons

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

num_polygons

The number of polygons in this list of polygons

polygon_ids

An iterable over the polygon IDs of the contained polygons

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFRGBA(random_colour=False, **kwargs)

Bases: sfftkrw.schema.base.SFFType

RGBA colour

alpha

alpha (opacity) channel

as_hff(parent_group, name='colour', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

Export as JSON

blue

blue channel

classmethod from_hff(hff_data, name='colour', args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

green

green channel

red

red channel

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFSegment(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Class that encapsulates segment data

as_hff(parent_group, name='{}', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

Format this segment as JSON

biological_annotation

the biological annotation for this segment; described using a sfftkrw.schema.adapter.SFFBiologicalAnnotation object

colour

this segments colour; described using a sfftkrw.schema.adapter.SFFRGBA object

complexes_and_macromolecules

the complexes and macromolecules associated with this segment; described using a sfftkrw.schema.adapter.SFFComplexesAndMacromolecules object

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

classmethod from_json(data, args=None)

Deserialise the given json object into an EMDB-SFF object

Parameters:
  • data (dict) – the data to be converted into SFF* objects
  • args (argparse.Namespace) – command line arguments
Returns:

the corresponding SFF* object

Return type:

base.SFFType subclass

gds_type

alias of sfftkrw.schema.v0_7_0_dev0.segmentType

id

the ID for this segment; segment IDs begin at 1 with the value of 0 implying the segmentation i.e. all segments are children of the root segment (the segmentation)

meshes

the list of meshes (if any) that describe this segment; a sfftkrw.schema.adapter.SFFMeshList object

parent_id

the ID for the segment that contains this segment; defaults to 0 (the whole segmentation)

shapes

the list of shape primitives that describe this segment; a sfftkrw.schema.adapter.SFFShapePrimitiveList object

volume

the 3D volume (if any) that describes this segment; a sfftkrw.schema.adapter.SFFThreeDVolume object

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFSegmentList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for segments

as_hff(parent_group, name='segments', args=None)

Return the data of this object as an HDF5 group in the given parent group

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFSegmentation(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Adapter class to make using the output of generateDS easier to use

as_hff(parent_group, name=None, args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(f, args=None)

Render an EMDB-SFF to JSON

Parameters:
  • f (file) – open file handle
  • annotation_only (bool) – only extract annotation information and do not render geometric data
  • sort_keys (bool) – whether (default) or not to sort keys in the dictionaries
  • indent_width (int) – indent width (default: 2)
bounding_box

the bounding box in which the segmentation sits; a sfftkrw.schema.adapter.SFFBoundingBox object

clear_annotation(from_id)

Clear all annotations from the segment with ID specified

Parameters:from_id – segment ID
Returns:
copy_annotation(from_id, to_id)

Copy annotation across segments

Parameters:
  • from_id (int/list) – segment ID to get notes from; use -1 for for global notes
  • to_id (int/list) – segment ID to copy notes to; use -1 for global notes
details

any other details about this segmentation (free text)

classmethod from_file(fn, args=None)

Instantiate an SFFSegmentations object from a file name

The file suffix determines how the data is extracted.

Parameters:fn (str) – name of a file hosting an EMDB-SFF-structured segmentation
Return seg:the corresponding SFFSegmentation object
Rtype seg:SFFSegmentation
classmethod from_hff(hff_data, name=None, args=None)

Create an sfftkrw.schema.adapter.SFFSegmentation object from HDF5 formatted data

Parameters:hff_data (h5py.File) – an HDF5 File object
Return sff_seg:an EMDB-SFF segmentation
Rtype sff_seg:sfftkrw.schema.adapter.SFFSegmentation
classmethod from_json(json_file, args=None)

Create an sfftkrw.schema.adapter.SFFSegmentation object from JSON formatted data

Parameters:json_file (str) – name of a JSON-formatted file
Return sff_seg:an EMDB-SFF segmentation
Rtype sff_seg:sfftkrw.schema.adapter.SFFSegmentation
gds_type

alias of sfftkrw.schema.v0_7_0_dev0.segmentation

global_external_references

a list of external references that apply to the whole segmentation (global); a sfftkrw.schema.adapter.SFFGlobalExternalReferences object

lattices

the list of lattices (if any) containing 3D volumes referred to; a sfftkrw.schema.adapter.SFFLatticeList object

merge_annotation(other_seg)

Merge the annotation from another sff_seg to this one

Parameters:other_seg (sfftk.schema.SFFSegmentation) – segmentation to get annotations from
name

the name of this segmentation

num_global_external_references

The number of global external references

primary_descriptor

the main type of representation used for this segmentation; can be one of ‘meshList’, ‘shapePrimitiveList’ or ‘threeDVolume’

segments

the list of annotated segments; a sfftkrw.schema.adapter.SFFSegmentList object

software

the software details used to generate this segmentation a sfftkrw.schema.adapter.SFFSoftware object

transforms

a list of transforms; a sfftkrw.schema.adapter.SFFTransformList object

version

EMDB-SFF version

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFShape(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Base shape class

attribute

extra attribute information e.g. ‘FOM’

id

the ID of this shape

transform_id

the transform applied to this shape to position it in the space

classmethod update_counter(value)

Update the index for all subclasses sequentially for sibling classes

This method works alongside the index_in_super class attribute.

The superclass must specify this method to ensure correct sequencing of shared indices.

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFShapePrimitiveList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for shapes

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

num_cones

The number of cones in this container

num_cuboids

The number of cuboids in this container

num_cylinders

The number of cylinders in this container

num_ellipsoids

The number of ellipsoids in this container

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFSoftware(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Class definition for specifying software used to create this segmentation

name

The name of the software used

version

The version string

processing_details

Details of how the segmentation was produced

as_hff(parent_group, name='software', args=None)

Return the data of this object as an HDF5 group in the given parent group

as_json(args=None)

For all contained classes this method returns a dictionary which will be serialised into JSON. Only at the top level (SFFSegmentation) will the final serialisation be done.

Parameters:args (argparse.Namespace) – command line arguments
Returns:a set of nested dictionaries
Return type:dict
classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

name

the software/programmeu’s name

processing_details

a description of how the data was processed to produce the segmentation

version

the version used

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFThreeDVolume(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Class representing segments described using a 3D volume

as_hff(parent_group, name='volume', args=None)

Return the data of this object as an HDF5 group in the given parent group

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

lattice_id

the ID of the lattice that has the data for this 3D volume

transform_id

a transform applied to this 3D volume [optional]

value

the voxel values associated with this 3D volume

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFTransformList(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFListType

Container for transforms

as_hff(parent_group, name='transforms', args=None)

Return the data of this object as an HDF5 group in the given parent group

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

num_tranformation_matrices

The number of SFFTransformationMatrix objects in this transform container

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFTransformationMatrix(**kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Transformation matrix transform

cols

the number of columns in this matrix

data

a string sequence by row of the data in this matrix

classmethod from_array(ndarray, **kwargs)

Construct an SFFTransformationMatrix object from a numpy numpy.ndarray array

Parameters:ndarray (numpy.ndarray) – a numpy array
Returns:a SFFTransformationMatrix object
gds_type

alias of sfftkrw.schema.v0_7_0_dev0.transformationMatrixType

id

an ID for this transform

rows

the number of rows in this matrix

static stringify(array)

Convert a numpy.ndarray to a space-separated list of numbers

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFVertex(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFIndexType

Single vertex

designation

type of vertex (‘surface’ (default) or ‘normal’)

id

vertex ID; referenced by polygons

point

The co-ordinates for this vertex

x

x co-ordinate

y

y co-ordinate

z

z co-ordinate

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFVertexList(**kwargs)

Bases: sfftkrw.schema.base.SFFListType

List of vertices

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

num_vertices

The number of vertices in this vertex container

vertex_ids

Iterable of vertex IDs contained in this vertex container

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFVolume(*args, **kwargs)

Bases: sfftkrw.schema.base.SFFType

Class for represention 3-space dimension

cols

number of columns

classmethod from_hff(hff_data, name=None, args=None)

Return an SFFType object given an HDF5 object

rows

number of rows

sections

number of sections (sets of congruent row-column collections)

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFVolumeIndex(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFVolume

Class representing volume indices

class sfftkrw.schema.adapter_v0_7_0_dev0.SFFVolumeStructure(*args, **kwargs)

Bases: sfftkrw.schema.adapter_v0_7_0_dev0.SFFVolume

voxel_count

The number of voxels in this volume