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
"""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 |
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
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) |