Skip to content

Unsafe Image getter #313

@GermanHydrogen

Description

@GermanHydrogen

A log of image processors got duplicate code similar to

if image.catalog is None:
    log.warning("No catalog in image.")
    return image

This could be fixed if image had unsafe getter for the main properties like

class Image:
    [...]
    def get_data_unsafe(self) -> np.ndarray:
        if self.data is None:
            raise exc.ImageError("Image has not data.")
        return image.data

Another possibilities would be to change the default getter to the unsafe option and introducing a safe getter which return optionals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions