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

enable gpu load nifti #8188

Open
wants to merge 21 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2024
commit a987a943f4d12ef61ffc3573bfa588ea321444f4
4 changes: 2 additions & 2 deletions monai/data/image_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def read(self, data: Sequence[PathLike] | PathLike, **kwargs):
img_.append(img) # type: ignore
return img_ if len(filenames) > 1 else img_[0]

def get_data(self, img) -> tuple[np.ndarray | "cp.ndarray", dict]:
def get_data(self, img) -> tuple[np.ndarray | cp.ndarray, dict]:
Copy link
Member

Choose a reason for hiding this comment

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

Does the typing work if CuPy isn't installed? I don't know if our CICD tests are going to catch when it's not.

"""
Extract data array and metadata from loaded image and return them.
This function returns two objects, first is numpy array of image data, second is dict of metadata.
Expand All @@ -961,7 +961,7 @@ def get_data(self, img) -> tuple[np.ndarray | "cp.ndarray", dict]:
img: a Nibabel image object loaded from an image file or a list of Nibabel image objects.

"""
img_array: list[np.ndarray | "cp.ndarray"] = []
img_array: list[np.ndarray | cp.ndarray] = []
compatible_meta: dict = {}

for i, filename in zip(ensure_tuple(img), self.filenames):
Expand Down
Loading