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
################## | |
## Written by: Kyle Sunderland | |
## | |
## Downloads all files from an assembla project | |
## Need to change repo_name, api_key, and api_secret for the script to work | |
################## | |
$repo_name = "REPO_NAME" # Name of the repo | |
# personal keys found at: https://app.assembla.com/user/edit/manage_clients |
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
# Important: the input volume must have isotropic spacing. | |
# If surface is thick, use Extract skeleton module with Skeleton type = 2D, Do not prune branches = enabled. | |
# Increase radius parameter to fill more holes. | |
# Increase dimension to preserve more details. | |
inputLabelmap = getNode('Input labelmap') | |
ici = vtk.vtkImageChangeInformation() | |
ici.SetInputData(inputLabelmap.GetImageData()) | |
ici.SetOutputSpacing(inputLabelmap.GetSpacing()) |
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 __main__ import qt, slicer | |
# | |
# MarkupsInfo module | |
# | |
class MarkupsInfo: | |
def __init__(self, parent): | |
import string | |
parent.title = "Markups info" |
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
def showSimpleUserInterface(simpleView): | |
# Do not store these display settings permanently | |
settings = qt.QSettings() | |
settings.setValue('MainWindow/RestoreGeometry', not simpleView) | |
for toolbar in slicer.util.mainWindow().findChildren('QToolBar'): | |
toolbar.setVisible(not simpleView) | |
modulePanelDockWidget = slicer.util.mainWindow().findChildren('QDockWidget','PanelDockWidget')[0] |
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
volumesDir = r"c:\Users\andra\OneDrive\Projects\SlicerTesting4\20190523-AutoWWWL\volumes" | |
screenshotsDir = r"c:\Users\andra\OneDrive\Projects\SlicerTesting4\20190523-AutoWWWL\screenshots" | |
methods = [ | |
["baseline", autoContrastSlicerDefault], | |
["hist-0.1-99.9", lambda fn: autoContrastVtkImageHistogramStatisticsDefault(fn, 0.1, 99.9, 0.00, 0.0)], # = itksnap | |
["hist-1.0-99.9", lambda fn: autoContrastVtkImageHistogramStatisticsDefault(fn, 1.0, 99.9, 0.10, 0.0)], | |
["hist-1.0-99.0-x0.10", lambda fn: autoContrastVtkImageHistogramStatisticsDefault(fn, 1.0, 99.0, 0.10, 0.10)], | |
["hist-1.0-99.0-x0.20", lambda fn: autoContrastVtkImageHistogramStatisticsDefault(fn, 1.0, 99.0, 0.10, 0.20)], | |
] |
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
# | |
# Installation: | |
# - Save this file as AngleMeasurement.py to a directory on your computer | |
# - Add the directory to the additional module paths in the Slicer application settings: | |
# - Choose in the menu: Edit / Application settings | |
# - Click Modules, click >> next to Additional module paths | |
# - Click Add, and choose the .py file's location | |
# - After you restart Slicer, "Angle Measurment" module should show up in Quantification category | |
# |
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
# Generate input data | |
################################################ | |
import SampleData | |
import numpy as np | |
# Load master volume | |
sampleDataLogic = SampleData.SampleDataLogic() | |
masterVolumeNode = sampleDataLogic.downloadMRBrainTumor1() |
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
import os | |
import unittest | |
import vtk, qt, ctk, slicer | |
from slicer.ScriptedLoadableModule import * | |
from array import array | |
import logging | |
import vtk.util.numpy_support | |
import numpy as np | |
# |
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
# Download a sample data set (chest CT) | |
import SampleData | |
masterVolumeNode = SampleData.SampleDataLogic().downloadCTChest() | |
# Create segmentation | |
segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode") | |
segmentationNode.CreateDefaultDisplayNodes() # only needed for display | |
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(masterVolumeNode) | |
# Create temporary segment editor to get access to effects |
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
# Source data can be obtained from http://lifesciencedb.jp/bp3d/ (tested with partof_BP3D_4.0_obj_99) | |
# These input file must be loaded into the scene: | |
# - partof_inclusion_relation_list.txt and partof_element_parts.txt (loaded as Table nodes) | |
# - OBJ files | |
shNode = slicer.mrmlScene.GetSubjectHierarchyNode() | |
sceneItemID = shNode.GetSceneItemID() | |
def getItemParentsFmaIds(shNode, itemShItemId): | |
existingParentShItemId = shNode.GetItemParent(itemShItemId) |
OlderNewer