Nifti input data as .nii is not accepted, it only accepts .nii.gz.
Please delete options that are not relevant.
Accept .nii data as input
This issue will need to extend nifti_loader.py, we now have the following code
arr = np.asarray(nib.load(filepath).dataobj, dtype=np.float32)
So we will need a helper function to load the data depending on the suffix of the path.
if file_path.endswith("nii"):
# load nii
elif file_path.endswith("nii.gz"):
# load nii.gz
else:
# raise error and provide the full path for debugging
The test is also required to test all cases including failures, so you might need at least one .nii file in the repo
@YipengHu
nib.load
it should be tested fairly easily, but i thought ni.load() reads both?
see: https://nipy.org/nibabel/reference/nibabel.html
@YipengHu @mathpluscode I suspect the problem is in lines 17-19 of the nifti_loader.py:
self.file_paths = get_sorted_filenames_in_dir(
dir_path=os.path.join(dir_path, name), suffix="nii.gz"
)
Only files with suffix "nii.gz" are being added to self.file_paths
@YipengHu @mathpluscode I suspect the problem is in lines 17-19 of the
nifti_loader.py:self.file_paths = get_sorted_filenames_in_dir( dir_path=os.path.join(dir_path, name), suffix="nii.gz" )Only files with suffix "nii.gz" are being added to self.file_paths
I might be it. Will test this out later. But if you are up for it, fix this I will review.
@YipengHu, I'll try to make the change and if it works I'll create a pull request
reopen this issue as mentioned in #240
@mathpluscode are you assigning yourself to this, or you want @s-sd to add test et al?
no after the discussion with @s-sd he will focus on the demo first, i will do this
Most helpful comment
no after the discussion with @s-sd he will focus on the demo first, i will do this