Skip to content

Conversation

@CloseChoice
Copy link
Contributor

@CloseChoice CloseChoice commented Nov 19, 2025

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

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@lhoestq lhoestq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG this is simply amazing

@lhoestq
Copy link
Member

lhoestq commented Nov 21, 2025

I tested in Colab and it works perfectly :) now I want to add _repr_html_ everywhere xD

Re: testing, I think it's fine to test manually such features

@lhoestq lhoestq merged commit c97e757 into huggingface:main Nov 21, 2025
12 of 14 checks passed
@CloseChoice CloseChoice deleted the nifti-visualization-support branch November 21, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visualization for Medical Imaging Datasets

3 participants