An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit 2315de82 authored by jcfr's avatar jcfr
Browse files

STYLE: Add SampleData.downloadSample

git-svn-id: http://svn.slicer.org/Slicer4/trunk@27648 3bd1e089-480b-0410-8dfb-8563597acbee
parent 6b436c1a
......@@ -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')
......
......@@ -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)
......
......@@ -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()
......
......@@ -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
......
......@@ -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)
......
......@@ -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()
......
......@@ -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()
......
......@@ -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')
......
......@@ -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')
......
......@@ -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()
......
......@@ -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))
......
......@@ -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*')
......
......@@ -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
......
......@@ -1366,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)
......@@ -1383,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 = {}
......
......@@ -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")
......
......@@ -66,8 +66,8 @@ class SegmentEditorScriptedSegmentEditorEffectModuleTemplateTest(ScriptedLoadabl
##################################
self.delayDisplay("Load master volume")
from SampleData import SampleDataLogic
masterVolumeNode = SampleDataLogic().downloadMRBrainTumor1()
import SampleData
masterVolumeNode = SampleData.downloadSample('MRBrainTumor1')[0]
##################################
self.delayDisplay("Create segmentation containing a few spheres")
......
......@@ -58,9 +58,9 @@ class CropVolumeSelfTestTest(ScriptedLoadableModuleTest):
print("Running CropVolumeSelfTest Test case:")
from SampleData import SampleDataLogic
import SampleData
vol = SampleDataLogic().downloadMRHead()
vol = SampleData.downloadSample("MRHead")[0]
roi = slicer.vtkMRMLAnnotationROINode()
roi.Initialize(slicer.mrmlScene)
......@@ -87,7 +87,7 @@ class CropVolumeSelfTestTest(ScriptedLoadableModuleTest):
mainWindow.moduleSelector().selectModule('Transforms')
mainWindow.moduleSelector().selectModule('CropVolume')
cropVolumeNode = slicer.mrmlScene.GetNodeByID('vtkMRMLCropVolumeParametersNode1')
vol = SampleDataLogic().downloadMRHead()
vol = SampleData.downloadSample("MRHead")[0]
roi = slicer.vtkMRMLAnnotationROINode()
roi.Initialize(slicer.mrmlScene)
cropVolumeNode.SetInputVolumeNodeID(vol.GetID())
......
......@@ -80,8 +80,8 @@ class MarkupsInCompareViewersSelfTestLogic(ScriptedLoadableModuleLogic):
# first load the data
#
print("Getting MR Head Volume")
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
import SampleData
mrHeadVolume = SampleData.downloadSample("MRHead")[0]
#
# link the viewers
......
......@@ -135,8 +135,8 @@ class MarkupsInViewsSelfTestLogic(ScriptedLoadableModuleLogic):
# first load the data
#
print("Getting MR Head Volume")
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
import SampleData
mrHeadVolume = SampleData.downloadSample("MRHead")[0]
#
# link the viewers
......
......@@ -143,8 +143,8 @@ class NeurosurgicalPlanningTutorialMarkupsSelfTestLogic(ScriptedLoadableModuleLo
# use the sample data module logic to load data for the self test
self.delayDisplay("Getting Baseline volume")
from SampleData import SampleDataLogic
baselineVolume = SampleDataLogic().downloadWhiteMatterExplorationBaselineVolume()
import SampleData
baselineVolume = SampleData.downloadSample('BaselineVolume')[0]
self.takeScreenshot('NeurosurgicalPlanning-Loaded','Data loaded')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment