Nifti visualization support by CloseChoice · Pull Request #7874 · huggingface/datasets

closes #7870

leverage Papaya to visualize nifti images. For this I created a Wrapper class for nibabel.nifti1.Nifti1Image that provides the same interface but exposes an additional _repr_html_ method, which is needed to visualize the image in jupyter (didn't test in colab, but that should work equivalently).

Code to test (execute in a notebook):

from datasets import load_dataset

ds = load_dataset("TobiasPitters/nifti-nitest-extracted",
              split="train")
image = ds[1]

image

Here a small video, not the most exciting scan though:
https://github.com/user-attachments/assets/1cca5f01-6fd2-48ef-a4d7-a92c1259c224

Am open to good ways to test this.

EDIT: papaya also supports dicom, didn't test it yet though