=[1,1,1], reorder=True)
MedBase.item_preprocessing(resample= MedImage.create('images/IXI002-Guys-0828-T1.nii.gz')
im type(im), MedImage) test_eq(
Vision core
Load images
med_img_reader
med_img_reader (file_path:(<class'str'>,<class'pathlib.Path'>,<class'fast core.foundation.L'>,<class'list'>), dtype=<class 'torch.Tensor'>, reorder:bool=False, resample:list=None, only_tensor:bool=True)
*Loads and preprocesses a medical image.
Args: file_path: Path to the image. Can be a string, Path object or a list. dtype: Datatype for the return value. Defaults to torch.Tensor. reorder: Whether to reorder the data to be closest to canonical (RAS+) orientation. Defaults to False. resample: Whether to resample image to different voxel sizes and image dimensions. Defaults to None. only_tensor: Whether to return only image tensor. Defaults to True.
Returns: The preprocessed image. Returns only the image tensor if only_tensor is True, otherwise returns original image, preprocessed image, and original size.*
MetaResolver
MetaResolver (*args, **kwargs)
*A class to bypass metaclass conflict: https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/data/batch.html*
MedBase
MedBase (*args, **kwargs)
A class that represents an image object. Metaclass casts x
to this class if it is of type cls._bypass_type
.
MedImage
MedImage (*args, **kwargs)
Subclass of MedBase that represents an image object.
MedMask
MedMask (*args, **kwargs)
Subclass of MedBase that represents an mask object.
= im.show(anatomical_plane=0) ax