Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe Image getter #313

Open
GermanHydrogen opened this issue Dec 12, 2023 · 0 comments
Open

Unsafe Image getter #313

GermanHydrogen opened this issue Dec 12, 2023 · 0 comments

Comments

@GermanHydrogen
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant