Commit 9ecca3f0 authored by finetjul's avatar finetjul

ENH: Add Scene Performance test

It measures time spent by some scene actions such as loading, closing,
restoring, relayouting a scene or modifying/adding nodes.
Issue #2642

Example of performance on a MacBookPro laptop (2.4GHz):
AddData (BrainAtlas2012.mrb) took 44865 msecs
CloseScene () took 28706 msecs
AddData (BrainAtlas2012.mrb) took 44579 msecs
ModifyNode (vtkMRMLScalarVolumeNode1) took 4 msecs
ModifyNode (vtkMRMLScalarVolumeNode2) took 35 msecs
ModifyNode (vtkMRMLScalarVolumeNode3) took 20 msecs
ModifyNode (vtkMRMLModelHierarchyNode2) took 14 msecs
ModifyNode (vtkMRMLModelNode4) took 0 msecs
ModifyNode (vtkMRMLModelDisplayNode5) took 14 msecs
ModifyNode (vtkMRMLModelHierarchyNode3) took 13 msecs
ModifyNode (vtkMRMLModelStorageNode1) took 4 msecs
ModifyNode (vtkMRMLModelHierarchyNode301) took 18 msecs
ModifyNode (vtkMRMLModelDisplayNode304) took 23 msecs
ModifyNode (vtkMRMLModelHierarchyNode51) took 19 msecs
AddNode (vtkMRMLModelNode302) took 46 msecs

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21579 3bd1e089-480b-0410-8dfb-8563597acbee
parent fb51209d
......@@ -175,6 +175,7 @@ if(Slicer_USE_QtTesting AND Slicer_USE_PYTHONQT)
slicer_add_python_unittest(SCRIPT Slicer4Minute.py)
slicer_add_python_unittest(SCRIPT Charting.py)
slicer_add_python_unittest(SCRIPT SliceLinkLogic.py)
slicer_add_python_unittest(SCRIPT ScenePerformance.py)
slicer_add_python_unittest(SCRIPT RSNA2012Vis.py)
slicer_add_python_unittest(SCRIPT RSNA2012Quant.py)
slicer_add_python_unittest(SCRIPT slicerCloseCrashBug2590.py)
......@@ -192,6 +193,7 @@ if(Slicer_USE_QtTesting AND Slicer_USE_PYTHONQT)
Slicer4Minute.py
Charting.py
SliceLinkLogic.py
ScenePerformance.py
RSNA2012Vis.py
RSNA2012Quant.py
slicerCloseCrashBug2590.py
......@@ -200,6 +202,7 @@ if(Slicer_USE_QtTesting AND Slicer_USE_PYTHONQT)
)
set(KIT_PYTHON_RESOURCES
Resources/UI/ScenePerformance.ui
)
ctkMacroCompilePythonScript(
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ScenePerformance</class>
<widget class="qMRMLWidget" name="ScenePerformance">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<height>387</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Scene Performance</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Action</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="FileLabel">
<property name="text">
<string>File</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="ctkPathLineEdit" name="ActionPathLineEdit"/>
</item>
<item row="0" column="0" colspan="2">
<widget class="QComboBox" name="ActionComboBox">
<item>
<property name="text">
<string>Add Data (or Scene)</string>
</property>
</item>
<item>
<property name="text">
<string>Restore scene</string>
</property>
</item>
<item>
<property name="text">
<string>Close Scene</string>
</property>
</item>
<item>
<property name="text">
<string>Switch to Layout</string>
</property>
</item>
<item>
<property name="text">
<string>Add (copy of current) node</string>
</property>
</item>
<item>
<property name="text">
<string>Modify (current) node</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="URLLabel">
<property name="text">
<string>URL</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="ResultsLabel">
<property name="text">
<string>Results</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QTextEdit" name="ResultsTextEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="LayoutLabel">
<property name="text">
<string>Layout</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="LayoutSpinBox">
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>27</number>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="URLLineEdit"/>
</item>
<item>
<widget class="QLabel" name="URLFileNameLabel">
<property name="text">
<string>file name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="URLFileNameLineEdit"/>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="MRMLNodeLabel">
<property name="text">
<string>Node</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="qMRMLNodeComboBox" name="MRMLNodeComboBox">
<property name="showHidden">
<bool>true</bool>
</property>
<property name="addEnabled">
<bool>false</bool>
</property>
<property name="removeEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="TimePushButton">
<property name="text">
<string>Run and time</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QSpinBox" name="RepeatSpinBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="SceneViewLabel">
<property name="text">
<string>SceneView</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="SceneViewSpinBox"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>qMRMLNodeComboBox</class>
<extends>QWidget</extends>
<header>qMRMLNodeComboBox.h</header>
</customwidget>
<customwidget>
<class>qMRMLWidget</class>
<extends>QWidget</extends>
<header>qMRMLWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ctkPathLineEdit</class>
<extends>QWidget</extends>
<header>ctkPathLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>ScenePerformance</sender>
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal>
<receiver>MRMLNodeComboBox</receiver>
<slot>setMRMLScene(vtkMRMLScene*)</slot>
<hints>
<hint type="sourcelabel">
<x>10</x>
<y>173</y>
</hint>
<hint type="destinationlabel">
<x>99</x>
<y>180</y>
</hint>
</hints>
</connection>
</connections>
</ui>
This diff is collapsed.
......@@ -269,6 +269,14 @@ bool qSlicerCoreIOManager::loadScene(const QString& fileName, bool clear)
return this->loadNodes(QString("SceneFile"), properties);
}
//-----------------------------------------------------------------------------
bool qSlicerCoreIOManager::loadFile(const QString& fileName)
{
qSlicerIO::IOProperties properties;
properties["fileName"] = fileName;
return this->loadNodes(this->fileType(fileName), properties);
}
//-----------------------------------------------------------------------------
bool qSlicerCoreIOManager::loadNodes(const qSlicerIO::IOFileType& fileType,
#if QT_VERSION < 0x040700
......
......@@ -104,6 +104,10 @@ public:
/// loadNodes function with QString("SceneFile")
bool loadScene(const QString& fileName, bool clear = true);
/// Convenient function to load a file. All the options (e.g. filetype) are
/// chosen by default.
Q_INVOKABLE bool loadFile(const QString& fileName);
/// Save nodes (or scene) using the registered writers.
/// Return true on success, false otherwise.
/// Attributes are typically:
......
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