What is the best way to load niftii images (.nii) using pytorch dataloader?

What is the best way to load niftii images (.nii) using pytorch dataloader?

1 Like

This question has nothing to do with pytorch. You can use nibabel to load .nii file.

if someone using pytorch than it would a problem for beginner that how they load the nii format image into their memory and further processed using pytorch method. Nibable is library which load all kind of 3D and 4D scans but how this will load using pytroch syntax and further more how the whole directory can be read using pytorch

where is the code for loading all the images 3D from the directory>>??

Nibabel will give numpy. It can be converted to torch. Same procedure followed for classification can be adapted.

yeah bro nibabel proving this but I want to load all the nii files into my memory in an iterative way but how?
what procedure i should follow?

Save the nib file to h5 file. Create a list with [(h5_file_name,slice_no),(h5_file_name,slice_no)]. Iterate this using dataloader, during runtime read the h5 file again and take out the slice. Let me know if you understand this, else i will share the pseudocode.