diff --git a/Applications/SlicerApp/Testing/Python/AtlasTests.py b/Applications/SlicerApp/Testing/Python/AtlasTests.py
index 75e6226c9688733720959abe12edac20365084a9..8e5fcc0f5ee59b5557cce21db24e7bd80b869fcf 100644
--- a/Applications/SlicerApp/Testing/Python/AtlasTests.py
+++ b/Applications/SlicerApp/Testing/Python/AtlasTests.py
@@ -150,30 +150,33 @@ class AtlasTestsTest(ScriptedLoadableModuleTest):
def test_AbdominalAtlasTest(self):
self.delayDisplay('Running Abdominal Atlas Test')
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8301', 'Abdominal_Atlas_2012.mrb', slicer.util.loadScene),
- )
+ downloads = {
+ 'fileNames': 'Abdominal_Atlas_2012.mrb',
+ 'uris': 'http://slicer.kitware.com/midas3/download?items=8301'
+ }
self.perform_AtlasTest(downloads,'I')
def test_BrainAtlasTest(self):
self.delayDisplay('Running Brain Atlas Test')
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=10937', 'BrainAtlas2012.mrb', slicer.util.loadScene),
- )
+ downloads = {
+ 'fileNames': 'BrainAtlas2012.mrb',
+ 'uris': 'http://slicer.kitware.com/midas3/download?items=10937'
+ }
self.perform_AtlasTest(downloads,'A1_grayT1')
def test_KneeAtlasTest(self):
self.delayDisplay('Running Knee Atlas Test')
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=9912', 'KneeAtlas2012.mrb', slicer.util.loadScene),
- )
+ downloads = {
+ 'fileNames': 'KneeAtlas2012.mrb',
+ 'uris': 'http://slicer.kitware.com/midas3/download?items=9912'
+ }
self.perform_AtlasTest(downloads,'I')
- def perform_AtlasTest(self, downloads,testVolumePattern):
+ def perform_AtlasTest(self, downloads, testVolumePattern):
""" Perform the actual atlas test.
This includes: download and load the given data, touch all
model hierarchies, and restore all scene views.
- downloads : list of lists of: url, file save name, load callable
+ downloads : dictionnary of URIs and fileNames
testVolumePattern : volume name/id that is tested for valid load
"""
@@ -181,16 +184,8 @@ class AtlasTestsTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(**downloads)
self.delayDisplay('Finished with download and loading\n')
volumeNode = slicer.util.getNode(pattern=testVolumePattern)
@@ -229,15 +224,15 @@ class AtlasTestsTest(ScriptedLoadableModuleTest):
hierarchyOriginalExpanded = mh.GetExpanded()
# collapse and change the colour on the hierarchy to full red
mh.SetExpanded(0)
- self.delayDisplay("Model hierarchy " + mh.GetName() + ": expanded = false",msec=10)
+ self.delayDisplay("Model hierarchy " + mh.GetName() + ": expanded = false")
mhd.SetColor(1,0,0)
- self.delayDisplay("Model hierarchy " + mh.GetName() + ": color = red",msec=10)
+ self.delayDisplay("Model hierarchy " + mh.GetName() + ": color = red")
# set the collapsed visibility to 0
mhd.SetVisibility(0)
- self.delayDisplay("Model hierarchy " + mh.GetName() + ": visibility = off",msec=10)
+ self.delayDisplay("Model hierarchy " + mh.GetName() + ": visibility = off")
# expand, should see all models in correct colour
mh.SetExpanded(1)
- self.delayDisplay("Model hierarchy " + mh.GetName() + ": expanded = true",msec=10)
+ self.delayDisplay("Model hierarchy " + mh.GetName() + ": expanded = true")
# reset the hierarchy
mhd.SetVisibility(hierarchyOriginalVisibility)
mhd.SetColor(hierarchyOriginalColour)
@@ -251,7 +246,7 @@ class AtlasTestsTest(ScriptedLoadableModuleTest):
numSceneViews = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLSceneViewNode")
for s in range(numSceneViews):
sv = slicer.mrmlScene.GetNthNodeByClass(s, "vtkMRMLSceneViewNode")
- self.delayDisplay("Restoring scene " + sv.GetName() + " (" + str(s+1) + "/" + str(numSceneViews) + ")",msec=500)
+ self.delayDisplay("Restoring scene " + sv.GetName() + " (" + str(s+1) + "/" + str(numSceneViews) + ")")
sv.RestoreScene()
self.delayDisplay('Test passed!')
diff --git a/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py b/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
index a477a9524ba7b5764daa768bcc62111627cb1374..ef92aae57eeda9101710d308f2b8e7215d5d59d5 100644
--- a/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
+++ b/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
@@ -103,12 +103,12 @@ class BRAINSFitRigidRegistrationCrashIssue4139Test(ScriptedLoadableModuleTest):
logic = BRAINSFitRigidRegistrationCrashIssue4139Logic()
- from SampleData import SampleDataLogic
+ import SampleData
- fixed = SampleDataLogic().downloadMRBrainTumor1()
+ fixed = SampleData.downloadSample('MRBrainTumor1')[0]
self.assertIsNotNone(logic.hasImageData(fixed))
- moving = SampleDataLogic().downloadMRBrainTumor2()
+ moving = SampleData.downloadSample('MRBrainTumor2')[0]
self.assertIsNotNone(logic.hasImageData(moving))
self.delayDisplay('Finished with download and loading')
diff --git a/Applications/SlicerApp/Testing/Python/CLIEventTest.py b/Applications/SlicerApp/Testing/Python/CLIEventTest.py
index a7de28161c5d71ce902cfc70a5c9620d5d7546ba..1027ee207b1da3ee2f4063e1f02dc4efb88d4407 100644
--- a/Applications/SlicerApp/Testing/Python/CLIEventTest.py
+++ b/Applications/SlicerApp/Testing/Python/CLIEventTest.py
@@ -219,8 +219,8 @@ class CLIEventTestTest(ScriptedLoadableModuleTest):
self.delayDisplay('Test that output node moved to referenced node location in subject hierarchy')
self.delayDisplay('Load input volume')
- from SampleData import SampleDataLogic
- inputVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ inputVolume = SampleData.downloadSample("MRHead")[0]
self.delayDisplay('Create subject hierarchy of input volume')
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
diff --git a/Applications/SlicerApp/Testing/Python/DICOMReaders.py b/Applications/SlicerApp/Testing/Python/DICOMReaders.py
index b906f9077b864ae19c1eaf620adf1308fcc20d24..a49ffa32ac4823a9cf3f1008c54f4530e5becb45 100644
--- a/Applications/SlicerApp/Testing/Python/DICOMReaders.py
+++ b/Applications/SlicerApp/Testing/Python/DICOMReaders.py
@@ -2,7 +2,6 @@ import logging
import numpy
import os
import unittest
-import urllib
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from DICOMLib import DICOMUtils
@@ -66,24 +65,24 @@ class DICOMReadersTest(ScriptedLoadableModuleTest):
import os, json
self.delayDisplay("Starting the DICOM test")
- referenceData = json.JSONDecoder().decode('''[
- { "url": "http://slicer.kitware.com/midas3/download/item/292839/Mouse-MR-example-where-GDCM_fails.zip",
+ referenceData = [
+ { "url": "http://slicer.kitware.com/midas3/download?items=292839",
"fileName": "Mouse-MR-example-where-GDCM_fails.zip",
"name": "Mouse-MR-example-where-GDCM_fails",
"seriesUID": "1.3.6.1.4.1.9590.100.1.2.366426457713813178933224342280246227461",
"expectedFailures": ["GDCM", "Archetype"],
- "voxelValueQuantity": "(110852, DCM, \\"MR signal intensity\\")",
- "voxelValueUnits": "(1, UCUM, \\"no units\\")"
+ "voxelValueQuantity": "(110852, DCM, \"MR signal intensity\")",
+ "voxelValueUnits": "(1, UCUM, \"no units\")"
},
- { "url": "http://slicer.kitware.com/midas3/download/item/294857/deidentifiedMRHead-dcm-one-series.zip",
+ { "url": "http://slicer.kitware.com/midas3/download?items=294857",
"fileName": "deidentifiedMRHead-dcm-one-series.zip",
"name": "deidentifiedMRHead-dcm-one-series",
"seriesUID": "1.3.6.1.4.1.5962.99.1.3814087073.479799962.1489872804257.270.0",
"expectedFailures": [],
- "voxelValueQuantity": "(110852, DCM, \\"MR signal intensity\\")",
- "voxelValueUnits": "(1, UCUM, \\"no units\\")"
+ "voxelValueQuantity": "(110852, DCM, \"MR signal intensity\")",
+ "voxelValueUnits": "(1, UCUM, \"no units\")"
}
- ]''')
+ ]
# another dataset that could be added in the future - currently fails for all readers
# due to invalid format - see https://issues.slicer.org/view.php?id=3569
@@ -101,16 +100,10 @@ class DICOMReadersTest(ScriptedLoadableModuleTest):
self.delayDisplay("Downloading")
for dataset in referenceData:
try:
- filePath = slicer.app.temporaryPath + '/' + dataset['fileName']
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- self.delayDisplay('Requesting download %s from %s...\n' % (dataset['fileName'], dataset['url']))
- urllib.urlretrieve(dataset['url'], filePath)
- self.delayDisplay('Finished with download\n')
-
- self.delayDisplay("Unzipping")
- dicomFilesDirectory = slicer.app.temporaryPath + dataset['name']
- qt.QDir().mkpath(dicomFilesDirectory)
- slicer.app.applicationLogic().Unzip(filePath, dicomFilesDirectory)
+ import SampleData
+ dicomFilesDirectory = SampleData.downloadFromURL(
+ fileNames=dataset['fileName'], uris=dataset['url'])[0]
+ self.delayDisplay('Finished with download')
#
# insert the data into th database
@@ -211,9 +204,12 @@ reloadScriptedModule('DICOMReaders'); import DICOMReaders; tester = DICOMReaders
import os, json
self.delayDisplay("Starting the DICOM test")
- datasetURL = "http://slicer.kitware.com/midas3/download/item/294857/deidentifiedMRHead-dcm-one-series.zip"
- fileName = "deidentifiedMRHead-dcm-one-series.zip"
- filePath = os.path.join(slicer.app.temporaryPath,fileName)
+ import SampleData
+ dicomFilesDirectory = SampleData.downloadFromURL(
+ fileNames='deidentifiedMRHead-dcm-one-series.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=294857')[0]
+ self.delayDisplay('Finished with download\n')
+
seriesUID = "1.3.6.1.4.1.5962.99.1.3814087073.479799962.1489872804257.270.0"
seriesRASBounds = [-87.29489517211913, 81.70450973510744,
-121.57139587402344, 134.42860412597656,
@@ -241,15 +237,6 @@ reloadScriptedModule('DICOMReaders'); import DICOMReaders; tester = DICOMReaders
]
try:
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- self.delayDisplay('Requesting download %s from %s...\n' % (fileName, datasetURL))
- urllib.urlretrieve(datasetURL, filePath)
- self.delayDisplay('Finished with download\n')
-
- self.delayDisplay("Unzipping")
- dicomFilesDirectory = slicer.app.temporaryPath + 'MRhead'
- qt.QDir().mkpath(dicomFilesDirectory)
- slicer.app.applicationLogic().Unzip(filePath, dicomFilesDirectory)
print('Removing %d files from the middle of the series' % len(filesToRemove))
for file in filesToRemove:
diff --git a/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py b/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
index 5e8cddb0afe5317e2c9338e68ddc9798b026e247..9f5735550c6bc35c29a378087ad1d1e882a50f5f 100644
--- a/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
+++ b/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
@@ -135,8 +135,8 @@ class FiducialLayoutSwitchBug1914Logic(ScriptedLoadableModuleLogic):
self.delayDisplay("Conventional view")
# Download MRHead from sample data
- from SampleData import SampleDataLogic
- mrHeadVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ mrHeadVolume = SampleData.downloadSample("MRHead")[0]
# Place a fiducial on the red slice
markupsLogic = slicer.modules.markups.logic()
diff --git a/Applications/SlicerApp/Testing/Python/JRC2013Vis.py b/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
index b2231eb8c2e312d552131d34fcce243a3ec1c624..09ac46aa0db6ece2181f48778345e0bc319fa670 100644
--- a/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
+++ b/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
@@ -91,22 +91,10 @@ class JRC2013VisWidget(ScriptedLoadableModuleWidget):
configFilePath = dicomFilesDirectory + '/dcmqrscp.cfg'
processCurrentPath = dicomFilesDirectory
else:
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=18822', 'Dcmtk-db.zip'),
- )
- print 'Downloading'
-
- import urllib
- for url,name in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print 'Requesting download %s from %s...\n' % (name, url)
- urllib.urlretrieve(url, filePath)
- print 'Finished with download'
-
- print 'Unzipping'
- qt.QDir().mkpath(dicomFilesDirectory)
- slicer.app.applicationLogic().Unzip(filePath, dicomFilesDirectory)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='Dcmtk-db.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=18822')[0]
import subprocess
dcmqrscpExeOptions = (
@@ -184,23 +172,10 @@ class JRC2013VisTestTest(ScriptedLoadableModuleTest):
#
# first, get the data - a zip file of dicom data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=18822', 'Dcmtk-db.zip'),
- )
-
- self.delayDisplay("Downloading")
- for url,name in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- self.delayDisplay('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- self.delayDisplay('Finished with download\n')
-
- self.delayDisplay("Unzipping")
- dicomFilesDirectory = slicer.app.temporaryPath + '/dicomFiles'
- qt.QDir().mkpath(dicomFilesDirectory)
- slicer.app.applicationLogic().Unzip(filePath, dicomFilesDirectory)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='Dcmtk-db.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=18822')[0]
try:
self.delayDisplay("Switching to temp database directory")
@@ -319,19 +294,10 @@ class JRC2013VisTestTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8609', '3DHeadData.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='3DHeadData.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=8609')
self.delayDisplay('Finished with download and loading\n')
try:
@@ -400,19 +366,10 @@ class JRC2013VisTestTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8611', 'LiverData.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='LiverData.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=8611')
self.delayDisplay('Finished with download and loading\n')
try:
@@ -476,19 +433,10 @@ class JRC2013VisTestTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8612', 'LungData.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='LungData.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=8612')
self.delayDisplay('Finished with download and loading\n')
try:
diff --git a/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py b/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
index b6219731a81ca774d53da7923062efc9ba91d336..d0528bab01fa9a81a68939af9fb5c7d6ec1b77a8 100644
--- a/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
+++ b/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
@@ -64,22 +64,10 @@ class RSNA2012ProstateDemoTest(ScriptedLoadableModuleTest):
print("Running RSNA2012ProstateDemo Test case:")
- import urllib
-
- # perform the downloads if needed, then load
- filePath = slicer.app.temporaryPath + '/RSNA2012ProstateDemo.mrb'
- urlPath = 'http://slicer.kitware.com/midas3/download?items=10697'
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- self.delayDisplay('Downloading MRB from %s to %s...\n' % (urlPath, filePath))
- urllib.urlretrieve(urlPath, filePath)
- else:
- self.delayDisplay('Using existing %s...\n' % filePath)
- slicer.mrmlScene.Clear(0)
- appLogic = slicer.app.applicationLogic()
- self.delayDisplay('Done loading data! Will now open the bundle')
- mrbExtractPath = self.tempDirectory('__prostate_mrb_extract__')
- mrbLoaded = appLogic.OpenSlicerDataBundle(filePath, mrbExtractPath)
- slicer.app.processEvents()
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='RSNA2012ProstateDemo.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=10697')
# get all scene view nodes and test switching
svns = slicer.util.getNodes('vtkMRMLSceneViewNode*')
@@ -93,18 +81,3 @@ class RSNA2012ProstateDemoTest(ScriptedLoadableModuleTest):
self.delayDisplay('Done testing scene views, will clear the scene')
slicer.mrmlScene.Clear(0)
self.delayDisplay('Test passed')
-
- def tempDirectory(self,key='__SlicerTestTemp__',tempDir=None,includeDateTime=False):
- """Come up with a unique directory name in the temp dir and make it and return it
- # TODO: switch to QTemporaryDir in Qt5.
- Note: this directory is not automatically cleaned up
- """
- if not tempDir:
- tempDir = qt.QDir(slicer.app.temporaryPath)
- tempDirName = key
- if includeDateTime:
- key += qt.QDateTime().currentDateTime().toString("yyyy-MM-dd_hh+mm+ss.zzz")
- fileInfo = qt.QFileInfo(qt.QDir(tempDir), tempDirName)
- dirPath = fileInfo.absoluteFilePath()
- qt.QDir().mkpath(dirPath)
- return dirPath
diff --git a/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py b/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
index ee90c5334f6257be3c9c613b1f22602f8b2a1549..c09997bee25ad98c84bb1a800b987601f86980ac 100644
--- a/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
+++ b/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
@@ -158,8 +158,8 @@ class RSNAQuantTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- from SampleData import SampleDataLogic
- tumor = SampleDataLogic().downloadMRBrainTumor1()
+ import SampleData
+ tumor = SampleData.downloadSample('MRBrainTumor1')[0]
try:
# four up view
@@ -217,27 +217,10 @@ class RSNAQuantTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124185', 'dataset3_PETCT.zip'),
- )
-
- self.delayDisplay("Downloading")
-
- for url,name in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- self.delayDisplay('Finished with download\n')
-
- self.delayDisplay("Unzipping to %s" % (slicer.app.temporaryPath))
- zipFilePath = slicer.app.temporaryPath + '/' + 'dataset3_PETCT.zip'
- extractPath = slicer.app.temporaryPath + '/' + 'dataset3_PETCT'
- qt.QDir().mkpath(extractPath)
- self.delayDisplay("Using extract path %s" % (extractPath))
- applicationLogic = slicer.app.applicationLogic()
- applicationLogic.Unzip(zipFilePath, extractPath)
+ import SampleData
+ extractPath = SampleData.downloadFromURL(
+ fileNames='dataset3_PETCT.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=124185')[0]
self.delayDisplay("Loading PET_CT_pre-treatment.mrb")
preTreatmentPath = extractPath + '/PET_CT_pre-treatment.mrb'
@@ -340,19 +323,10 @@ class RSNAQuantTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124184', 'ChangeTrackerScene.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='ChangeTrackerScene.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=124184')
logic.takeScreenshot('ChangeTracker-Loaded','Finished with download and loading',-1)
try:
diff --git a/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py b/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
index 0af91fe3b4121ba2db90945dcc10537f6ab6d9be..490534fc73ec83f9430173b24f87d5e11c0499ca 100644
--- a/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
+++ b/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
@@ -183,23 +183,10 @@ class RSNAVisTutorialTest(ScriptedLoadableModuleTest):
#
# first, get the data - a zip file of dicom data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124183', 'dataset1_Thorax_Abdomen.zip'),
- )
-
- self.delayDisplay("Downloading")
- for url,name in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- self.delayDisplay('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- self.delayDisplay('Finished with download\n')
-
- self.delayDisplay("Unzipping")
- dicomFilesDirectory = slicer.app.temporaryPath + '/dicomFiles'
- qt.QDir().mkpath(dicomFilesDirectory)
- slicer.app.applicationLogic().Unzip(filePath, dicomFilesDirectory)
+ import SampleData
+ dicomFilesDirectory = SampleData.downloadFromURL(
+ fileNames='dataset1_Thorax_Abdomen.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=124183')[0]
try:
self.delayDisplay("Switching to temp database directory")
@@ -319,19 +306,11 @@ class RSNAVisTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124180', 'Head_Scene.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='Head_Scene.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=124180')
+
logic.takeScreenshot('Head-Downloaded','Finished with download and loading',-1)
try:
@@ -426,19 +405,10 @@ class RSNAVisTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124181', 'LiverSegments_Scene.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='LiverSegments_Scene.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=124181')
logic.takeScreenshot('Liver-Loaded','Loaded Liver scene',-1)
@@ -507,19 +477,11 @@ class RSNAVisTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=124182', 'LungSegments_Scene.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='LungSegments_Scene.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=124182')
+
logic.takeScreenshot('Lung-Loaded','Finished with download and loading',-1)
try:
diff --git a/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py b/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
index ced46ad04a181f45a12726c0398a80bf59bad3c6..35f9258afaf527e9d89417e774117b376b4be52c 100644
--- a/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
+++ b/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
@@ -122,19 +122,10 @@ class SliceLinkLogicTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=5767', 'FA.nrrd', slicer.util.loadVolume),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='FA.nrrd',
+ uris='http://slicer.kitware.com/midas3/download?items=5767')
self.delayDisplay('Finished with download and loading')
print('')
diff --git a/Applications/SlicerApp/Testing/Python/Slicer4Minute.py b/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
index ea78943ec581f218b7fcd0355a55c471b9970e7b..0a8edce888ae27c0931686950fe1e9c8ec7f3293 100644
--- a/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
+++ b/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
@@ -119,19 +119,10 @@ class Slicer4MinuteTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8466', 'slicer4minute.mrb', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='slicer4minute.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=8466')
self.delayDisplay('Finished with download and loading')
# Testing "Part 2" of Tutorial
diff --git a/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py b/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
index 4a5a1f2606b67f0850813d6c198294f84fdfcda1..463b8b1e9c5c8884a9dd524ea63967b9f443716d 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
@@ -71,8 +71,8 @@ class SlicerBoundsTestTest(ScriptedLoadableModuleTest):
""" Test the GetRASBounds & GetBounds method on a volume.
"""
#self.delayDisplay("Starting test_Volume")
- from SampleData import SampleDataLogic
- volumeNode = SampleDataLogic().downloadAbdominalCTVolume()
+ import SampleData
+ volumeNode = SampleData.downloadSample('CTA abdomen\n(Panoramix)')[0]
bounds = range(6)
volumeNode.GetRASBounds(bounds)
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
index 5ca879b994cd2dc88ec6ddf0979f970641a63412..31d6afa287942aac9f5bfc6ddcbc8465b38129ef 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
@@ -89,8 +89,8 @@ class SlicerMRBMultipleSaveRestoreLoop(ScriptedLoadableModuleTest):
# first, get the data
#
print("Getting MR Head Volume")
- from SampleData import SampleDataLogic
- mrHeadVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ mrHeadVolume = SampleData.downloadSample("MRHead")[0]
# Place a fiducial
markupsLogic = slicer.modules.markups.logic()
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
index 7cdb318277aef05a6df6f8b774bf7059a85b66c8..47e3c6a6e878a7b6faac5dcd1af795d4bf8bb72c 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
@@ -86,8 +86,8 @@ class SlicerMRBMultipleSaveRestore(ScriptedLoadableModuleTest):
# first, get the data
#
print("Getting MR Head Volume")
- from SampleData import SampleDataLogic
- mrHeadVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ mrHeadVolume = SampleData.downloadSample("MRHead")[0]
# Place a fiducial
markupsLogic = slicer.modules.markups.logic()
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
index 8eae0afb9bbcb127ed13539b523c8f76abaa29d4..fe30276882a7e973aec50afb19a9976bf528f0d7 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
@@ -154,8 +154,8 @@ class SlicerMRBSaveRestoreCheckPaths(ScriptedLoadableModuleTest):
# first, get the volume data
#
print("Getting MR Head Volume")
- from SampleData import SampleDataLogic
- mrHeadVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ mrHeadVolume = SampleData.downloadSample("MRHead")[0]
slicer.util.delayDisplay('Finished with download of volume')
diff --git a/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py b/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
index bde74195212d5a28b62d9ef6b0bdc290c43fcde4..c28ef5f8f368ac16ea5a5262080f4c79cce8c4b0 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
@@ -100,8 +100,8 @@ class SlicerOrientationSelectorTestTest(ScriptedLoadableModuleTest):
logic = SlicerOrientationSelectorTestLogic()
self.delayDisplay("Starting the test")
- from SampleData import SampleDataLogic
- mrHeadVolume = SampleDataLogic().downloadMRHead()
+ import SampleData
+ mrHeadVolume = SampleData.downloadSample("MRHead")[0]
slicer.util.selectModule('Reformat')
diff --git a/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py b/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
index 6f7b5dd7283be3469898ea8c65fef2b24a384fc4..bc591025cca241f5cf4313198222ca6c12ef262e 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
@@ -93,28 +93,15 @@ class SlicerRestoreSceneViewCrashIssue3445Test(ScriptedLoadableModuleTest):
#
# first, get some data
#
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=10937', 'BrainAtlas2012.mrb', None),
- )
-
- filePaths = []
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- logging.info('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- filePaths.append(filePath)
- if loader:
- logging.info('Loading %s...' % (name,))
- loader(filePath)
- self.delayDisplay('Finished with download')
+ import SampleData
+ filePath = SampleData.downloadFromURL(
+ fileNames='BrainAtlas2012.mrb',
+ uris='http://slicer.kitware.com/midas3/download?items=10937')[0]
- filePath = filePaths[0]
+ self.delayDisplay('Finished with download')
ioManager = slicer.app.ioManager()
- ioManager.loadFile(filePath)
ioManager.loadFile(filePath)
slicer.mrmlScene.Clear(0)
diff --git a/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py b/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
index c68cae57552474f64da6012ff2757a811e729960..af6642469cac5919df5cff5691f009beafc76573 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
@@ -135,8 +135,8 @@ class SlicerTransformInteractionTest1Test(ScriptedLoadableModuleTest):
"""
logic = SlicerTransformInteractionTest1Logic()
- from SampleData import SampleDataLogic
- volume = SampleDataLogic().downloadAbdominalCTVolume()
+ import SampleData
+ volume = SampleData.downloadSample('CTA abdomen\n(Panoramix)')[0]
#self.delayDisplay("Starting test_3D_interactionVolume")
logic = SlicerTransformInteractionTest1Logic()
diff --git a/Applications/SlicerApp/Testing/Python/UtilTest.py b/Applications/SlicerApp/Testing/Python/UtilTest.py
index 1987501b66608294f66e2282796d8fbd8d7af6cb..7735829a6ec9496e9f116e6df638930126ad302d 100644
--- a/Applications/SlicerApp/Testing/Python/UtilTest.py
+++ b/Applications/SlicerApp/Testing/Python/UtilTest.py
@@ -96,11 +96,11 @@ class UtilTestTest(ScriptedLoadableModuleTest):
self.assertIsNone(redSliceCompositeNode.GetForegroundVolumeID())
self.assertIsNone(redSliceCompositeNode.GetLabelVolumeID())
- from SampleData import SampleDataLogic
+ import SampleData
- backgroundNode = SampleDataLogic().downloadMRHead()
+ backgroundNode = SampleData.downloadSample("MRHead")[0]
backgroundNode.SetName('Background')
- foregroundNode = SampleDataLogic().downloadMRHead()
+ foregroundNode = SampleData.downloadSample("MRHead")[0]
foregroundNode.SetName('Foreground')
volumesLogic = slicer.modules.volumes.logic()
@@ -133,9 +133,9 @@ class UtilTestTest(ScriptedLoadableModuleTest):
self.assertEqual(redSliceCompositeNode.GetLabelOpacity(), 0.1)
# Try to reset
- otherBackgroundNode = SampleDataLogic().downloadMRHead()
+ otherBackgroundNode = SampleData.downloadSample("MRHead")[0]
otherBackgroundNode.SetName('OtherBackground')
- otherForegroundNode = SampleDataLogic().downloadMRHead()
+ otherForegroundNode = SampleData.downloadSample("MRHead")[0]
otherForegroundNode.SetName('OtherForeground')
otherLabelmapNode = volumesLogic.CreateAndAddLabelVolume( slicer.mrmlScene, backgroundNode, 'OtherLabelmap' )
@@ -199,8 +199,8 @@ class UtilTestTest(ScriptedLoadableModuleTest):
# Test if retrieving voxels as a numpy array works
self.delayDisplay('Download sample data')
- from SampleData import SampleDataLogic
- volumeNode = SampleDataLogic().downloadMRHead()
+ import SampleData
+ volumeNode = SampleData.downloadSample("MRHead")[0]
self.delayDisplay('Test voxel value read')
voxelPos = [120,135,89]
@@ -221,8 +221,8 @@ class UtilTestTest(ScriptedLoadableModuleTest):
# Test if updating voxels from a numpy array works
self.delayDisplay('Download sample data')
- from SampleData import SampleDataLogic
- volumeNode = SampleDataLogic().downloadMRHead()
+ import SampleData
+ volumeNode = SampleData.downloadSample("MRHead")[0]
import numpy as np
import math
@@ -254,8 +254,8 @@ class UtilTestTest(ScriptedLoadableModuleTest):
self.assertEqual(tableNode1.GetNumberOfRows(), 3)
self.delayDisplay('Download sample data')
- from SampleData import SampleDataLogic
- volumeNode = SampleDataLogic().downloadMRHead()
+ import SampleData
+ volumeNode = SampleData.downloadSample("MRHead")[0]
self.delayDisplay('Compute histogram')
histogram = np.histogram(slicer.util.arrayFromVolume(volumeNode))
@@ -290,8 +290,8 @@ class UtilTestTest(ScriptedLoadableModuleTest):
# Test if convenience function of getting numpy array from various nodes works
self.delayDisplay('Test array with scalar image')
- from SampleData import SampleDataLogic
- volumeNode = SampleDataLogic().downloadMRHead()
+ import SampleData
+ volumeNode = SampleData.downloadSample("MRHead")[0]
voxelPos = [120,135,89]
voxelValueVtk = volumeNode.GetImageData().GetScalarComponentAsDouble(voxelPos[0], voxelPos[1], voxelPos[2], 0)
narray = slicer.util.arrayFromVolume(volumeNode)
@@ -299,7 +299,7 @@ class UtilTestTest(ScriptedLoadableModuleTest):
self.assertEqual(voxelValueVtk, voxelValueNumpy)
self.delayDisplay('Test array with tensor image')
- tensorVolumeNode = SampleDataLogic().downloadDTIBrain()
+ tensorVolumeNode = SampleData.downloadSample('DTIBrain')[0]
narray = slicer.util.array(tensorVolumeNode.GetName())
self.assertEqual(narray.shape, (85, 144, 144, 3, 3))
diff --git a/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py b/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
index 52aa77fdfa250df4182156381e1ab5baf34eeece..e0a63a968d84e346926d14351d41e4955bce0765 100644
--- a/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
+++ b/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
@@ -96,9 +96,9 @@ class ViewControllersSliceInterpolationBug1926Test(ScriptedLoadableModuleTest):
# first, get some data
#
self.delayDisplay("Getting Data")
- from SampleData import SampleDataLogic
- head = SampleDataLogic().downloadMRHead()
- tumor = SampleDataLogic().downloadMRBrainTumor1()
+ import SampleData
+ head = SampleData.downloadSample("MRHead")[0]
+ tumor = SampleData.downloadSample('MRBrainTumor1')[0]
# Change to a CompareView
ln = slicer.util.getNode(pattern='vtkMRMLLayoutNode*')
diff --git a/Applications/SlicerApp/Testing/Python/sceneImport2428.py b/Applications/SlicerApp/Testing/Python/sceneImport2428.py
index aca2f1d25cad8ec5e334467e33baa855d228865f..c7c5ba940b06700fc268f5bd8a832b0e37aa0e94 100644
--- a/Applications/SlicerApp/Testing/Python/sceneImport2428.py
+++ b/Applications/SlicerApp/Testing/Python/sceneImport2428.py
@@ -97,8 +97,8 @@ class sceneImport2428Test(ScriptedLoadableModuleTest):
# first, get some data
#
self.delayDisplay("Getting Data")
- from SampleData import SampleDataLogic
- head = SampleDataLogic().downloadMRHead()
+ import SampleData
+ head = SampleData.downloadSample("MRHead")[0]
#
# create a label map and set it for editing
diff --git a/Applications/SlicerApp/Testing/Python/slicerCloseCrashBug2590.py b/Applications/SlicerApp/Testing/Python/slicerCloseCrashBug2590.py
index 6b547787e64bfc47edfad636d485ba9556e269cc..87715a28c75b0e072bd1f3a48dfcedde82b6d345 100644
--- a/Applications/SlicerApp/Testing/Python/slicerCloseCrashBug2590.py
+++ b/Applications/SlicerApp/Testing/Python/slicerCloseCrashBug2590.py
@@ -88,20 +88,10 @@ class slicerCloseCrashBug2590Test(ScriptedLoadableModuleTest):
#
self.delayDisplay("Starting the test")
- import urllib
- downloads = (
- ('http://slicer.kitware.com/midas3/download?items=8986', 'RSNA2011_ChangeTracker_data.zip', slicer.util.loadScene),
- )
-
- for url,name,loader in downloads:
- filePath = slicer.app.temporaryPath + '/' + name
- if not os.path.exists(filePath) or os.stat(filePath).st_size == 0:
- print('Requesting download %s from %s...\n' % (name, url))
- urllib.urlretrieve(url, filePath)
- if loader:
- print('Loading %s...\n' % (name,))
- loader(filePath)
- self.delayDisplay('Finished with download and loading\n')
+ import SampleData
+ SampleData.downloadFromURL(
+ fileNames='RSNA2011_ChangeTracker_data.zip',
+ uris='http://slicer.kitware.com/midas3/download?items=8986')
try:
mainWindow = slicer.util.mainWindow()
diff --git a/Base/Python/slicer/util.py b/Base/Python/slicer/util.py
index ff5a35412a332b96faf67aae50a510117aa49b55..83db6917c77fa56fa81297cc9e94f82c38899ef7 100644
--- a/Base/Python/slicer/util.py
+++ b/Base/Python/slicer/util.py
@@ -1030,6 +1030,9 @@ def delayDisplay(message,autoCloseMsec=1000):
import qt, slicer
import logging
logging.info(message)
+ if autoCloseMsec < 400:
+ slicer.app.processEvents()
+ return
messagePopup = qt.QDialog()
layout = qt.QVBoxLayout()
messagePopup.setLayout(layout)
@@ -1363,7 +1366,7 @@ def plot(narray, xColumnIndex = -1, columnNames = None, title = None, show = Tru
# Get sample data
import numpy as np
import SampleData
- volumeNode = SampleData.SampleDataLogic().downloadMRHead()
+ volumeNode = SampleData.downloadSample("MRHead")[0]
# Create new plot
histogram = np.histogram(arrayFromVolume(volumeNode), bins=50)
@@ -1380,7 +1383,7 @@ def plot(narray, xColumnIndex = -1, columnNames = None, title = None, show = Tru
# Get sample data
import numpy as np
import SampleData
- volumeNode = SampleData.SampleDataLogic().downloadMRHead()
+ volumeNode = SampleData.downloadSample("MRHead")[0]
# Create variable that will store plot nodes (chart, table, series)
plotNodes = {}
diff --git a/Base/Python/tests/test_sitkUtils.py b/Base/Python/tests/test_sitkUtils.py
index c6ebe1ef23734ce4463432514362eb200b9211e8..cef301e3b12e8484b82c0c508ecc7232b2619cda 100644
--- a/Base/Python/tests/test_sitkUtils.py
+++ b/Base/Python/tests/test_sitkUtils.py
@@ -13,8 +13,8 @@ class SitkUtilsTests(unittest.TestCase):
""" Download the MRHead node
"""
- from SampleData import SampleDataLogic
- SampleDataLogic().downloadMRHead()
+ import SampleData
+ SampleData.downloadSample("MRHead")[0]
volumeNode1 = slicer.util.getNode('MRHead')
self.assertEqual(volumeNode1.GetName(), "MRHead")
@@ -86,8 +86,8 @@ class SitkUtilsTests(unittest.TestCase):
""" Download the MRHead node
"""
- from SampleData import SampleDataLogic
- SampleDataLogic().downloadMRHead()
+ import SampleData
+ SampleData.downloadSample("MRHead")[0]
volumeNode1 = slicer.util.getNode('MRHead')
self.assertEqual(volumeNode1.GetName(), "MRHead")
diff --git a/CMake/DeployQt5.cmake b/CMake/DeployQt5.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..d92109e8a5f10ba3bbf762deabe108b9f1c0ca16
--- /dev/null
+++ b/CMake/DeployQt5.cmake
@@ -0,0 +1,353 @@
+#.rst:
+# DeployQt5
+# ---------
+#
+# Functions to help assemble a standalone Qt5 executable.
+#
+# A collection of CMake utility functions useful for deploying Qt5
+# executables.
+#
+# The following functions are provided by this module:
+#
+# ::
+#
+# write_qt5_conf
+# resolve_qt5_paths
+# fixup_qt5_executable
+# install_qt5_plugin_path
+# install_qt5_plugin
+# install_qt5_executable
+#
+# Requires CMake 2.8.9 or greater because Qt 5 does.
+# Also depends on BundleUtilities.cmake.
+#
+# ::
+#
+# WRITE_QT5_CONF(