voxel.read
- voxel.read(path: Union[str, Path, PathLike], data_format: Optional[ImageDataFormat] = None, device: Union[Device, str, int] = 'cpu', **kwargs) Union[MedicalVolume, List[MedicalVolume]][source]
Read MedicalVolume(s) from file.
- Parameters:
path (str) – File/directory path.
data_format (ImageDataFormat, optional) – Data format (e.g.
'dicom','nifti', etc.). Use this is disambiguate between different data formats. If this function is not working, try using this argument. If not provided, voxel will try to infer data format from file extension.**kwargs – Additional keyword arguments passed to the data format reader.
- Returns:
Volume(s) loaded.
- Return type:
MedicalVolume | List[MedicalVolume]
Examples
>>> vx.load("/path/to/multi-echo/dicom/folder", group_by="EchoNumbers") >>> vx.load("/path/to/ct/dicom/folder") >>> vx.load("/path/to/ct/nifti/file.nii.gz", mmap=True)