Vision core

Load images


source

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.*


source

MetaResolver

 MetaResolver (*args, **kwargs)

*A class to bypass metaclass conflict: https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/data/batch.html*


source

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.


source

MedImage

 MedImage (*args, **kwargs)

Subclass of MedBase that represents an image object.


source

MedMask

 MedMask (*args, **kwargs)

Subclass of MedBase that represents an mask object.

MedBase.item_preprocessing(resample=[1,1,1], reorder=True)
im = MedImage.create('images/IXI002-Guys-0828-T1.nii.gz')
test_eq(type(im), MedImage)
ax = im.show(anatomical_plane=0)