USD support is the fundamental prerequisite for having a direct connection between 3d Slicer and Omniverse.
The code here is a rough proof of concept for DataHack Hackathon by lablab.me
-
Copy utils folder to your project folder (next to
.mrml
file) -
Install dependencies inside 3d slicer, by the following code.
this is done once..
import sys; import subprocess; subprocess.run([sys.executable, '-m', 'pip', 'install', 'usd-core']); subprocess.run([sys.executable, '-m', 'pip', 'install', 'unicodedata'])
-
Export and convert model, by Running the following code in 3d slicer's python shell.
USD file name is the same as the project folder name.
import sys; sys.path.append("{}/utils".format(slicer.mrmlScene.GetRootDirectory().strip("/"))) from export_usd import export_usd export_usd()
Here, it's Lungs
Here's me running the code
Code credits gltf2usd by kcoley, I only made it work in 3d slicer.