Skip to content

Commit ab4521d

Browse files
committed
PERF: Speedup loading of modules including Editor effects
Loading time improved by ~45% (2.6s -> 1.4s, warm cache) for the following modules: * Editor * ThresholdThreadingTest * SlicerMRBMultipleSaveRestoreTest * SlicerMRBMultipleSaveRestoreLoopTest * NeurosurgicalPlanningTutorialMarkupsSelfTest git-svn-id: http://svn.slicer.org/Slicer4/trunk@25134 3bd1e089-480b-0410-8dfb-8563597acbee
1 parent 837364a commit ab4521d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

Modules/Scripted/EditorLib/WatershedFromMarkerEffect.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77

88
import math
99

10-
HAVE_SIMPLEITK=True
11-
try:
12-
import SimpleITK as sitk
13-
import sitkUtils
14-
except ImportError:
15-
HAVE_SIMPLEITK=False
16-
1710
__all__ = [
1811
'WatershedFromMarkerEffectOptions',
1912
'WatershedFromMarkerEffectTool',
@@ -46,7 +39,10 @@ def __del__(self):
4639
def create(self):
4740
super(WatershedFromMarkerEffectOptions,self).create()
4841

49-
if not HAVE_SIMPLEITK:
42+
try:
43+
import SimpleITK as sitk
44+
import sitkUtils
45+
except ImportError:
5046
self.warningLabel = qt.QLabel()
5147
self.warningLabel.text = "WatershedFromMarker is not available because\nSimpleITK is not available in this build"
5248
self.widgets.append(self.warningLabel)
@@ -207,7 +203,6 @@ def processEvent(self, caller=None, event=None):
207203
"""
208204
pass
209205

210-
211206
#
212207
# WatershedFromMarkerEffectLogic
213208
#
@@ -231,13 +226,10 @@ def __init__(self,sliceLogic):
231226
def apply(self,xy):
232227
pass
233228

234-
try:
229+
def doit(self):
230+
235231
import SimpleITK as sitk
236232
import sitkUtils
237-
except ImportError:
238-
pass
239-
240-
def doit(self):
241233

242234
labelLogic = self.sliceLogic.GetLabelLayer()
243235
labelNode = labelLogic.GetVolumeNode()

0 commit comments

Comments
 (0)