Skip to content

Update of features/LoadImage #383

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

Open
wants to merge 204 commits into
base: develop
Choose a base branch
from
Open

Conversation

mirjagranfors
Copy link
Collaborator

Made LoadImage compatible with torch, and updated the documetation and unittesting.

When I tried loading a list, I got an error from the line
while ndim and image.ndim < ndim:,

so I changed it to
if not isinstance(image, list) and ndim:
while image.ndim < ndim:

giovannivolpe and others added 24 commits July 9, 2025 22:06
* documented channel2d func

* unit tests: channelfirst2d

* type hints

* Update features.py

* NDArray type hint

* included Image type hint and xp usage

* unit test checks for torch_available

* Update features.py

* u

* docs

* linebreak

* docs

* Update test_features.py

* Update test_features.py

* deprecation warning & tests

* Added support for Image objects

* Tests for image objects

* docs

* tests and axis compatibility

* fix for repeated calls

* revert changes to upscale

* Implemented feedback

---------

Co-authored-by: Giovanni Volpe <giovanni.volpe@physics.gu.se>
@mirjagranfors mirjagranfors requested review from JChonpca and Pwhsky July 11, 2025 12:19
Base automatically changed from gv/final/features to develop July 11, 2025 15:54
@@ -397,7 +397,7 @@ def get(
n: int | list[int],
m: int | list[int],
coefficient: float | list[float],
**kwargs: dict[str, Any],
**kwargs: Any,
) -> np.ndarray:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hint should be NDArray if we are swapping from np.ndarray

as_list: bool,
get_one_random: bool,
**kwargs: Any
) -> np.ndarray | torch.tensor | list`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ) -> NDArray | torch.Tensor | list.
As torch.Tensor and torch.tensor are not the same we should do a revisal at some point and homogenize this across features.

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

Successfully merging this pull request may close these issues.

4 participants