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 | |
# Load master volume | |
sampleDataLogic = SampleData.SampleDataLogic() | |
masterVolumeNode = sampleDataLogic.downloadMRBrainTumor1() | |
# Create segmentation |
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
# This example script demonstrates how a grow-cut | |
# operation can be performed without graphical user interface. | |
# The first half of the script downloads input data and creates seed segments. | |
# The second half of the script converts segments to merged labelmap (that's the required | |
# input format for grow-cut filter), computes the complete segmentation, and writes | |
# results into new segments. | |
# Generate input data | |
################################################ |
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
# | |
# | |
# | |
# | |
# | |
# This example has been completely reworked and converted to a module, now available at: | |
# | |
# | |
# https://github.com/lassoan/SlicerLineProfile/blob/master/LineProfile/LineProfile.py | |
# |
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
import SampleData | |
sampleDataLogic = SampleData.SampleDataLogic() | |
masterVolumeNode = sampleDataLogic.downloadMRHead() | |
# Create segmentation | |
segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode") | |
segmentationNode.CreateDefaultDisplayNodes() # only needed for display | |
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(masterVolumeNode) | |
addedSegmentID = segmentationNode.GetSegmentation().AddEmptySegment("skin") |
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
# There are several variants of the metric. If you need to compute the metric slice by slice then | |
# you can use Mask volume effect to create a volume where all voxels are blanked out (set to -1000) | |
# except the calcifications in the selected vessel and compute the total score using this script. | |
# (based on Agatston (1990) - https://www.sciencedirect.com/science/article/pii/073510979090282T) | |
# | |
# Sample data set is available at: | |
# https://github.com/lassoan/PublicTestingData/releases/download/data/CardiacAgatstonScore.mrb | |
def computeAgatstonScore(volumeNode, minimumIntensityThreshold=130, minimumIslandSizeInMm2=1.0, verbose=False): | |
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
# 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
# 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()) |
OlderNewer