Created
October 1, 2020 18:36
-
-
Save fepegar/69b11c0004a4f8848dcb43ae61146d63 to your computer and use it in GitHub Desktop.
Run a brain parcellation deep learning model within 3D Slicer
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
# Paste this code into the Slicer Python console | |
pip_install('highresnet') | |
import SampleData | |
from highresnet.inference import infer | |
from highresnet.cli.download_oasis import download_oasis | |
input_path = download_oasis() | |
loadVolume(input_path) | |
output_path = input_path.replace('.nii', '_seg.nii') | |
colors_path = 'Colors.ctbl' | |
downloadFile('https://raw.githubusercontent.com/fepegar/highresnet/master/GIFNiftyNet.ctbl', colors_path) | |
infer( | |
input_path, | |
output_path, | |
batch_size=1, | |
window_cropping=2, | |
volume_padding=10, | |
window_size=128, | |
cuda_device=0, | |
use_niftynet_hist_std=True, | |
) | |
labelNode = loadLabelVolume(output_path) | |
colorNode = loadColorTable(colors_path) | |
displayNode = labelNode.GetDisplayNode() | |
displayNode.SetAndObserveColorNodeID(colorNode.GetID()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment