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 c485816f authored by jcfr's avatar jcfr
Browse files

STYLE: Simplify usage of SampleDataLogic functions

git-svn-id: http://svn.slicer.org/Slicer4/trunk@27620 3bd1e089-480b-0410-8dfb-8563597acbee
parent e6b96c94
......@@ -103,14 +103,12 @@ class BRAINSFitRigidRegistrationCrashIssue4139Test(ScriptedLoadableModuleTest):
logic = BRAINSFitRigidRegistrationCrashIssue4139Logic()
import SampleData
from SampleData import SampleDataLogic
sampleDatalogic = SampleDataLogic()
fixed = sampleDatalogic.downloadMRBrainTumor1()
fixed = SampleDataLogic().downloadMRBrainTumor1()
self.assertIsNotNone(logic.hasImageData(fixed))
moving = sampleDatalogic.downloadMRBrainTumor2()
moving = SampleDataLogic().downloadMRBrainTumor2()
self.assertIsNotNone(logic.hasImageData(moving))
self.delayDisplay('Finished with download and loading')
......
......@@ -135,10 +135,8 @@ class FiducialLayoutSwitchBug1914Logic(ScriptedLoadableModuleLogic):
self.delayDisplay("Conventional view")
# Download MRHead from sample data
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
# Place a fiducial on the red slice
markupsLogic = slicer.modules.markups.logic()
......
......@@ -158,9 +158,8 @@ class RSNAQuantTutorialTest(ScriptedLoadableModuleTest):
#
# first, get some data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
tumor = sampleDataLogic.downloadMRBrainTumor1()
from SampleData import SampleDataLogic
tumor = SampleDataLogic().downloadMRBrainTumor1()
try:
# four up view
......
......@@ -71,9 +71,8 @@ class SlicerBoundsTestTest(ScriptedLoadableModuleTest):
""" Test the GetRASBounds & GetBounds method on a volume.
"""
#self.delayDisplay("Starting test_Volume")
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
volumeNode = sampleDataLogic.downloadAbdominalCTVolume()
from SampleData import SampleDataLogic
volumeNode = SampleDataLogic().downloadAbdominalCTVolume()
bounds = range(6)
volumeNode.GetRASBounds(bounds)
......
......@@ -67,10 +67,9 @@ execfile('/Users/pieper/slicer4/latest/Slicer/Applications/SlicerApp/Testing/Pyt
#
# first, get the data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
# Place a fiducial
markupsLogic = slicer.modules.markups.logic()
......
......@@ -62,10 +62,9 @@ execfile('/Users/pieper/slicer4/latest/Slicer/Applications/SlicerApp/Testing/Pyt
#
# first, get the data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
# Place a fiducial
markupsLogic = slicer.modules.markups.logic()
......
......@@ -134,10 +134,9 @@ execfile('/Users/pieper/slicer4/latest/Slicer/Applications/SlicerApp/Testing/Pyt
#
# first, get the volume data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
slicer.util.delayDisplay('Finished with download of volume')
......
......@@ -100,9 +100,8 @@ class SlicerOrientationSelectorTestTest(ScriptedLoadableModuleTest):
logic = SlicerOrientationSelectorTestLogic()
self.delayDisplay("Starting the test")
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
slicer.util.selectModule('Reformat')
......
......@@ -135,9 +135,8 @@ class SlicerTransformInteractionTest1Test(ScriptedLoadableModuleTest):
"""
logic = SlicerTransformInteractionTest1Logic()
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
volume = sampleDataLogic.downloadAbdominalCTVolume()
from SampleData import SampleDataLogic
volume = SampleDataLogic().downloadAbdominalCTVolume()
#self.delayDisplay("Starting test_3D_interactionVolume")
logic = SlicerTransformInteractionTest1Logic()
......
......@@ -96,12 +96,11 @@ class UtilTestTest(ScriptedLoadableModuleTest):
self.assertIsNone(redSliceCompositeNode.GetForegroundVolumeID())
self.assertIsNone(redSliceCompositeNode.GetLabelVolumeID())
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
from SampleData import SampleDataLogic
backgroundNode = sampleDataLogic.downloadMRHead()
backgroundNode = SampleDataLogic().downloadMRHead()
backgroundNode.SetName('Background')
foregroundNode = sampleDataLogic.downloadMRHead()
foregroundNode = SampleDataLogic().downloadMRHead()
foregroundNode.SetName('Foreground')
volumesLogic = slicer.modules.volumes.logic()
......
......@@ -95,12 +95,10 @@ class ViewControllersSliceInterpolationBug1926Test(ScriptedLoadableModuleTest):
#
# first, get some data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
self.delayDisplay("Getting Data")
head = sampleDataLogic.downloadMRHead()
tumor = sampleDataLogic.downloadMRBrainTumor1()
from SampleData import SampleDataLogic
head = SampleDataLogic().downloadMRHead()
tumor = SampleDataLogic().downloadMRBrainTumor1()
# Change to a CompareView
ln = slicer.util.getNode(pattern='vtkMRMLLayoutNode*')
......
......@@ -96,10 +96,9 @@ class sceneImport2428Test(ScriptedLoadableModuleTest):
#
# first, get some data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
self.delayDisplay("Getting Data")
head = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
head = SampleDataLogic().downloadMRHead()
#
# create a label map and set it for editing
......
......@@ -66,9 +66,8 @@ class SegmentEditorScriptedSegmentEditorEffectModuleTemplateTest(ScriptedLoadabl
##################################
self.delayDisplay("Load master volume")
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
masterVolumeNode = sampleDataLogic.downloadMRBrainTumor1()
from SampleData import SampleDataLogic
masterVolumeNode = SampleDataLogic().downloadMRBrainTumor1()
##################################
self.delayDisplay("Create segmentation containing a few spheres")
......
......@@ -16,10 +16,9 @@ note that from the 't' variable in the console you can access the readers and ot
class vtkITKReaderAgainstNRRDReader(unittest.TestCase):
def setUp(self):
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
dtiSource = sampleDataLogic.sourceForSampleName('DTIBrain')
self.file_name = sampleDataLogic.downloadSourceIntoCache(dtiSource)[0]
from SampleData import SampleDataLogic
dtiSource = SampleDataLogic().sourceForSampleName('DTIBrain')
self.file_name = SampleDataLogic().downloadSourceIntoCache(dtiSource)[0]
self.ritk = vtkITK.vtkITKArchetypeDiffusionTensorImageReaderFile()
self.ritk.SetUseOrientationFromFile(True)
......
......@@ -16,10 +16,9 @@ note that from the 't' variable in the console you can access the readers and ot
class vtkITKReaderAgainstNRRDReader(unittest.TestCase):
def setUp(self):
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
brainSource = sampleDataLogic.sourceForSampleName('MRHead')
self.file_name = sampleDataLogic.downloadSourceIntoCache(brainSource)[0]
from SampleData import SampleDataLogic
brainSource = SampleDataLogic().sourceForSampleName('MRHead')
self.file_name = SampleDataLogic().downloadSourceIntoCache(brainSource)[0]
self.ritk = vtkITK.vtkITKArchetypeImageSeriesScalarReader()
self.ritk.SetUseOrientationFromFile(True)
......
......@@ -58,7 +58,9 @@ class CropVolumeSelfTestTest(ScriptedLoadableModuleTest):
print("Running CropVolumeSelfTest Test case:")
vol = self.downloadMRHead()
from SampleData import SampleDataLogic
vol = SampleDataLogic().downloadMRHead()
roi = slicer.vtkMRMLAnnotationROINode()
roi.Initialize(slicer.mrmlScene)
......@@ -85,7 +87,7 @@ class CropVolumeSelfTestTest(ScriptedLoadableModuleTest):
mainWindow.moduleSelector().selectModule('Transforms')
mainWindow.moduleSelector().selectModule('CropVolume')
cropVolumeNode = slicer.mrmlScene.GetNodeByID('vtkMRMLCropVolumeParametersNode1')
vol = self.downloadMRHead()
vol = SampleDataLogic().downloadMRHead()
roi = slicer.vtkMRMLAnnotationROINode()
roi.Initialize(slicer.mrmlScene)
cropVolumeNode.SetInputVolumeNodeID(vol.GetID())
......@@ -93,10 +95,3 @@ class CropVolumeSelfTestTest(ScriptedLoadableModuleTest):
cropVolumeLogic.Apply(cropVolumeNode)
self.delayDisplay('Test passed')
def downloadMRHead(self):
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
self.delayDisplay('Getting MR Head Volume')
mrHeadVolume = sampleDataLogic.downloadMRHead()
return mrHeadVolume
......@@ -79,10 +79,9 @@ class MarkupsInCompareViewersSelfTestLogic(ScriptedLoadableModuleLogic):
#
# first load the data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
#
# link the viewers
......
......@@ -134,10 +134,9 @@ class MarkupsInViewsSelfTestLogic(ScriptedLoadableModuleLogic):
#
# first load the data
#
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
print("Getting MR Head Volume")
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
#
# link the viewers
......
......@@ -142,11 +142,9 @@ class NeurosurgicalPlanningTutorialMarkupsSelfTestLogic(ScriptedLoadableModuleLo
slicer.util.selectModule('SampleData')
# use the sample data module logic to load data for the self test
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
self.delayDisplay("Getting Baseline volume")
baselineVolume = sampleDataLogic.downloadWhiteMatterExplorationBaselineVolume()
from SampleData import SampleDataLogic
baselineVolume = SampleDataLogic().downloadWhiteMatterExplorationBaselineVolume()
self.takeScreenshot('NeurosurgicalPlanning-Loaded','Data loaded')
......
......@@ -156,9 +156,8 @@ class AddStorableDataAfterSceneViewTestTest(ScriptedLoadableModuleTest):
# add another storable node, a volume
#
slicer.util.delayDisplay("Adding a new storable node, after creating a scene view")
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
mrHeadVolume = sampleDataLogic.downloadMRHead()
from SampleData import SampleDataLogic
mrHeadVolume = SampleDataLogic().downloadMRHead()
mrHeadID = mrHeadVolume.GetID()
#
......@@ -179,7 +178,7 @@ class AddStorableDataAfterSceneViewTestTest(ScriptedLoadableModuleTest):
#
# add new storable again
mrHeadVolume = sampleDataLogic.downloadMRHead()
mrHeadVolume = SampleDataLogic().downloadMRHead()
mrHeadID = mrHeadVolume.GetID()
#
......
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