IOHandler

scalismo.statisticalmodel.asm.IOHandler

Trait specifying that the implementing object can load and save objects of a given type from/to files. In addition, the object specifies which IO Identifier it can handle.

Currently, we require that the HDF5 file format be supported.

Attributes

T

the type of objects which can be constructed from the information present in files, and saved into files.

See also:

IOCollection

Graph
Supertypes
trait Hdf5IOHandler[T]
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Value members

Inherited methods

def identifier: String

An identifier uniquely identifying the kind of object. Note: the prefix "builtin::" is reserved for identifiers of objects that are shipped with the scalismo framework. For the purpose of compatibility with other implementations (e.g., the statismo C++ implementation), it is recommended to restrict the characters used to the ASCII range.

An identifier uniquely identifying the kind of object. Note: the prefix "builtin::" is reserved for identifiers of objects that are shipped with the scalismo framework. For the purpose of compatibility with other implementations (e.g., the statismo C++ implementation), it is recommended to restrict the characters used to the ASCII range.

Attributes

Returns:

the unique serialization identifier for this kind of object.

Inherited from:
HasIOIdentifier
def load(meta: IOMetadata, h5File: StatisticalModelReader, path: HDFPath): Try[T]

Load (instantiate) an object of type T from the information in an HDF5 file. The IO metadata present in the file, as well as the file and group with the file, are provided as arguments, so that implementations can read additional data that might be required for correct object instantiation.

Load (instantiate) an object of type T from the information in an HDF5 file. The IO metadata present in the file, as well as the file and group with the file, are provided as arguments, so that implementations can read additional data that might be required for correct object instantiation.

Attributes

h5File

the HDF5 file containing the information about the object to be constructed.

meta

IO Metadata about the concrete implementation, as present in the HDF5 file.

path

the path to the HDF5 group containing the information about the object to be constructed.

Returns:

an object of type T corresponding to the provided IO metadata and initialized according to the information present in the file (wrapped in a Success]), or a Failure indicating the cause of the failure

Inherited from:
Hdf5IOHandler
def save(t: T, h5File: HDF5Writer, path: HDFPath): Try[Unit]

Save all required information about an object to an HDF5 file, so that the object can later be reconstructed using the Hdf5IOHandler.load method. Note that implementations do not need to care about saving the object's IO metadata, as this is taken care of by the framework. Thus, if the object to be stored does not require any further parameterization, this method does not need to be overridden (there is a default no-op implementation). Otherwise, it is strongly advised to follow these rules in the implementation:

Save all required information about an object to an HDF5 file, so that the object can later be reconstructed using the Hdf5IOHandler.load method. Note that implementations do not need to care about saving the object's IO metadata, as this is taken care of by the framework. Thus, if the object to be stored does not require any further parameterization, this method does not need to be overridden (there is a default no-op implementation). Otherwise, it is strongly advised to follow these rules in the implementation:

  • Do not write data anywhere except in the provided group (or subgroups thereof). In other words, do not store data in parent of sibling groups of h5Group.
  • Do not store attributes directly attached to h5Group, as they might clash with the attributes used internally by the framework.
  • There are no further limitations, i.e., you are free to create values and subgroups, or anything else, in h5Group</code, and attach attributes to anything except h5Group itself.

Attributes

h5File

the HDF5 file to save the information to.

path

the path under which to save the information in the HDF5 file.

t

the object about which information is to be stored.

Returns:

Success or Failure

Inherited from:
Hdf5IOHandler