httomo.method_wrappers.images.ImagesWrapper

httomo.method_wrappers.images.ImagesWrapper#

class httomo.method_wrappers.images.ImagesWrapper(method_repository: MethodRepository, module_path: str, method_name: str, comm: mpi4py.MPI.Comm, save_result: bool | None = None, output_mapping: Dict[str, str] = {}, out_dir: PathLike | None = None, **kwargs)[source]#

Wraps image writer methods, which accept numpy (CPU) arrays as input, but don’t actually modify the dataset. They write the information to files

Methods

__init__(method_repository, module_path, ...)

Constructs a MethodWrapper for a method located in module_path with the name method_name.

execute(block)

Execute functions for external packages.

should_select_this_class(module_path, ...)

Method to dermine if this class should be used for wrapper instantiation, given the module path and method name.

Attributes

task_id

pattern

execute(block: T) T[source]#

Execute functions for external packages.

Developer note: Derived classes may override this function or any of the methods it uses to modify behaviour.

Parameters:

block (T (implements Block)) – A numpy or cupy dataset, mutable (method might work in-place).

Returns:

A CPU or GPU-based dataset object with the output

Return type:

T (implements Block)

classmethod should_select_this_class(module_path: str, method_name: str) bool[source]#

Method to dermine if this class should be used for wrapper instantiation, given the module path and method name.

The make_method_wrapper function will iterate through all subclasses and evaluate this condition in the order of declaration, falling back to GenericMethodWrapper if all evaluate to False.

Therefore, deriving classes should override this method to indicate the criteria when they should be instantiated.