Skip to content

Instantly share code, notes, and snippets.

View jmargeta's full-sized avatar

Jan Margeta jmargeta

View GitHub Profile
@jmargeta
jmargeta / surface_nets_3d_demo.py
Last active November 2, 2023 18:42
A quick conversion of label maps to colored meshes with latest vtk.
"""A quick conversion of label maps to colored meshes.
This requires vtk > 9.3.
pip install --pre vtk colorcet pyvista colorcet
"""
from typing import Optional, Union
import pooch
import pyvista as pv
import vtk
@jmargeta
jmargeta / lasc-viz.py
Last active November 13, 2022 21:29
Left atrial segmentation dataset visualization
from pathlib import Path
import pyvista as pv
from tqdm import tqdm
# Load the data
labels_paths = list(Path('./labelsTr').glob('*.nii'))
images_paths = [Path('./imagesTr') / p.name for p in labels_paths]
images = pv.read(images_paths)
labels = pv.read(labels_paths)