Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

magnum.trade.AbstractImporter class

Interface for importer plugins

Contents

Similarly to C++, importer plugins are loaded through ImporterManager:

>>> manager = trade.ImporterManager()
>>> importer = manager.load_and_instantiate('PngImporter')

Unlike C++, errors in both API usage and file parsing are reported by raising an exception. See particular function documentation for detailed behavior.

Methods

def close(self, /) -> None
Close currently opened file
def image1d(self, id: int, level: int = 0) -> ImageData1D
One-dimensional image
def image1d_for_name(self, arg0: str, /) -> int
One-dimensional image ID for given name
def image1d_level_count(self, id: int) -> int
One-dimensional image level count
def image1d_name(self, id: int) -> str
One-dimensional image name
def image2d(self, id: int, level: int = 0) -> ImageData2D
Two-dimensional image
def image2d_for_name(self, arg0: str, /) -> int
Two-dimensional image ID for given name
def image2d_level_count(self, id: int) -> int
Two-dimensional image level count
def image2d_name(self, id: int) -> str
Two-dimensional image name
def image3d(self, id: int, level: int = 0) -> ImageData3D
Three-dimensional image
def image3d_for_name(self, arg0: str, /) -> int
Three-dimensional image ID for given name
def image3d_level_count(self, id: int) -> int
Three-dimensional image level count
def image3d_name(self, id: int) -> str
Three-dimensional image name
def mesh(self, id: int, level: int = 0) -> MeshData
Mesh
def mesh_for_name(self, arg0: str, /) -> int
Mesh ID for given name
def mesh_level_count(self, id: int) -> int
Mesh level count
def mesh_name(self, id: int) -> str
Mesh name
def open_data(self, data: corrade.containers.ArrayView) -> None
Open raw data
def open_file(self, filename: str) -> None
Open a file

Properties

image1d_count: int get
One-dimensional image count
image2d_count: int get
Two-dimensional image count
image3d_count: int get
Three-dimensional image count
is_opened: bool get
Whether any file is opened
manager: object get
Manager owning this plugin instance
mesh_count: int get
Mesh count

Method documentation

def magnum.trade.AbstractImporter.image1d(self, id: int, level: int = 0) -> ImageData1D

One-dimensional image

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image1d_count

def magnum.trade.AbstractImporter.image1d_for_name(self, arg0: str, /) -> int

One-dimensional image ID for given name

Exceptions
RuntimeError If no file is opened

def magnum.trade.AbstractImporter.image1d_level_count(self, id: int) -> int

One-dimensional image level count

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image1d_count

def magnum.trade.AbstractImporter.image1d_name(self, id: int) -> str

One-dimensional image name

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image1d_count

def magnum.trade.AbstractImporter.image2d(self, id: int, level: int = 0) -> ImageData2D

Two-dimensional image

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image2d_count

def magnum.trade.AbstractImporter.image2d_for_name(self, arg0: str, /) -> int

Two-dimensional image ID for given name

Exceptions
RuntimeError If no file is opened

def magnum.trade.AbstractImporter.image2d_level_count(self, id: int) -> int

Two-dimensional image level count

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image2d_count

def magnum.trade.AbstractImporter.image2d_name(self, id: int) -> str

Two-dimensional image name

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image2d_count

def magnum.trade.AbstractImporter.image3d(self, id: int, level: int = 0) -> ImageData3D

Three-dimensional image

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image3d_count

def magnum.trade.AbstractImporter.image3d_for_name(self, arg0: str, /) -> int

Three-dimensional image ID for given name

Exceptions
RuntimeError If no file is opened

def magnum.trade.AbstractImporter.image3d_level_count(self, id: int) -> int

Three-dimensional image level count

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image3d_count

def magnum.trade.AbstractImporter.image3d_name(self, id: int) -> str

Three-dimensional image name

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than image3d_count

def magnum.trade.AbstractImporter.mesh(self, id: int, level: int = 0) -> MeshData

Mesh

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than mesh_count

def magnum.trade.AbstractImporter.mesh_for_name(self, arg0: str, /) -> int

Mesh ID for given name

Exceptions
RuntimeError If no file is opened

def magnum.trade.AbstractImporter.mesh_level_count(self, id: int) -> int

Mesh level count

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than mesh_count

def magnum.trade.AbstractImporter.mesh_name(self, id: int) -> str

Mesh name

Exceptions
RuntimeError If no file is opened
ValueError If id is negative or not less than mesh_count

def magnum.trade.AbstractImporter.open_data(self, data: corrade.containers.ArrayView) -> None

Open raw data

Exceptions
RuntimeError If file opening fails

def magnum.trade.AbstractImporter.open_file(self, filename: str) -> None

Open a file

Exceptions
RuntimeError If file opening fails

Property documentation

magnum.trade.AbstractImporter.image1d_count: int get

One-dimensional image count

Exceptions
RuntimeError If no file is opened

magnum.trade.AbstractImporter.image2d_count: int get

Two-dimensional image count

Exceptions
RuntimeError If no file is opened

magnum.trade.AbstractImporter.image3d_count: int get

Three-dimensional image count

Exceptions
RuntimeError If no file is opened

magnum.trade.AbstractImporter.mesh_count: int get

Mesh count

Exceptions
RuntimeError If no file is opened