Skip to content

Instantly share code, notes, and snippets.

View zacbaum's full-sized avatar
🧙‍♂️
Working from home

Zachary Baum zacbaum

🧙‍♂️
Working from home
View GitHub Profile
@zacbaum
zacbaum / LivePredictions.py
Created June 29, 2021 09:33
3D Slicer Process for Tensorflow Predictions
from Processes import Process, ProcessesLogic
import pickle
class LivePredictionProcess(Process):
def __init__(self, scriptPath, volume, model_path, active=True):
Process.__init__(self, scriptPath)
self.volume = volume # Numpy array, to use as input for the model.
self.model_path = model_path # Path to the TF model you'd like to load, as TF Models are not picklable.
self.active = bytes([1]) if active else bytes([0]) # Used to stop the process by enabling/disabling the script.