-
-
Save clementpoiret/b9e00327931af9e6d9b30938b57a334c to your computer and use it in GitHub Desktop.
Quick toy example for segmentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torchio as tio | |
# Loading the data and the expected labels | |
subject = tio.Subject( | |
mri=tio.ScalarImage("./T2w_hires_right_hippocampus.nii.gz"), | |
label=tio.LabelMap("./T2w_hires_right_hippocampus_seg_crop.nii.gz")) | |
# Quick preprocessing to get the data in the right format for inference | |
preprocess = tio.Compose([ | |
tio.ZNormalization(), | |
tio.EnsureShapeMultiple(8), | |
]) | |
subject = preprocess(subject) | |
# Plot if needed | |
subject.plot() | |
model = dummy_model() | |
segmentation = model(subject.mri.data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment