1from __main__
import ctk, slicer
4from qt
import QVBoxLayout, QHBoxLayout, QGridLayout, QFormLayout, QSizePolicy, QDialog, QSize, QPoint
5from qt
import QWidget, QLabel, QPushButton, QCheckBox, QRadioButton, QSpinBox, QTimer, QButtonGroup, QGroupBox
6from qSlicerMultiVolumeExplorerModuleHelper
import qSlicerMultiVolumeExplorerModuleHelper
as Helper
7from qSlicerMultiVolumeExplorerCharts
import LabeledImageChartView, MultiVolumeIntensityChartView
13 logging.debug(
"qSlicerMultiVolumeExplorerSimplifiedModuleWidget:init() called")
14 if not parent
or not hasattr(parent,
"layout"):
16 self.
parent.setLayout(QVBoxLayout())
40 layout = QGridLayout()
41 self.
widget.setLayout(layout)
54 self.
timer.setInterval(50)
73 inputFrameWidget = QWidget()
77 parent.addWidget(inputFrameWidget)
82 self.
frameSlider.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
85 self.
playButton.toolTip =
"Iterate over multivolume frames"
87 frameControlHBox = QHBoxLayout()
120 self.
chartPopupWindow.setWindowFlags(PythonQt.QtCore.Qt.WindowStaysOnTopHint)
121 layout = QGridLayout()
147 newValue = int(frameId)
151 logging.debug(
"qSlicerMultiVolumeExplorerSimplifiedModuleWidget:onVCMRMLSceneChanged")
193 if event ==
"LeaveEvent":
201 interactor = observee.GetInteractor()
209 mvDisplayNode.SetFrameComponent(frameNumber)
215 """When the layout changes, drop the observers from
216 all the old widgets and create new observers for the
217 newly created widgets
219 self.removeObservers()
221 layoutManager = slicer.app.layoutManager()
222 sliceNodeCount = slicer.mrmlScene.GetNumberOfNodesByClass(
"vtkMRMLSliceNode")
223 for nodeIndex
in range(sliceNodeCount):
225 sliceNode = slicer.mrmlScene.GetNthNodeByClass(nodeIndex,
"vtkMRMLSliceNode")
226 sliceWidget = layoutManager.sliceWidget(sliceNode.GetLayoutName())
229 style = sliceWidget.sliceView().interactorStyle()
230 self.sliceWidgetsPerStyle[style] = sliceWidget
231 events = (
"MouseMoveEvent",
"EnterEvent",
"LeaveEvent")
233 tag = style.AddObserver(event, self.processEvent)
234 self.styleObserverTags.append([style,tag])
238 observee.RemoveObserver(tag)
261 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.__init__(self, parent)
270 inputFrameCollapsibleLayout = QFormLayout(self.
inputFrame)
271 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupInputFrame(self, parent=inputFrameCollapsibleLayout)
280 plot in interactive charting. As an example, this can be used to overlay the \
281 curve obtained by fitting a model to the data"
285 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupFrameControlFrame(self)
294 self.
frameCopySelector.hideChildNodeTypes = [
"vtkMRMLDiffusionWeightedVolumeNode",
295 "vtkMRMLDiffusionTensorVolumeNode",
296 "vtkMRMLVectorVolumeNode"]
300 hbox.addWidget(QLabel(
"Current frame copy"))
315 hbox2 = QHBoxLayout()
316 hbox2.addWidget(QLabel(
"Current frame click-to-copy"))
338 hbox.addWidget(QLabel(
"Probed label volume"))
341 plotSettingsFrameLayout.addRow(hbox)
345 plotSettingsFrameLayout.addRow(self.
iCharting)
358 plottingModeLayout = QVBoxLayout()
373 plotGeneralSettingsLayout = QVBoxLayout()
379 plotSettingsFrameLayout.addRow(hbox)
384 hbox.addWidget(QLabel(
"Frame count(baseline calculation):"))
386 plotSettingsFrameLayout.addRow(hbox)
392 plotFrameLayout = QGridLayout(self.
plotFrame)
394 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupPlottingFrame(self, parent=plotFrameLayout)
397 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.onDockChartViewToggled(self, checked)
403 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.dockChartView(self)
408 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setFramesEnabled(self, enabled)
411 self.
plotFrame.collapsed = 0
if enabled
else 1
414 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.setupConnections(self)
458 logging.info(
"qSlicerMultiVolumeExplorerModuleWidget:ForegroundInputChanged")
464 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.onBackgroundInputChanged(self)
474 If extract button is checked, will copy the current frame to the
475 selected volume node on each event from frame slider
485 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.onSliderChanged(self, frameId)
486 frameId = int(frameId)
494 frameVolumeCopy.SetName(frameName)
503 nodeVolume = slicer.mrmlScene.GetNodesByName(frameName).GetNumberOfItems()
504 if (nodeVolume == 0):
507 frameVolumeCopy.SetName(frameName)
514 mvLabels = MultiVolumeIntensityChartView.getMultiVolumeLabels(self.
_bgMultiVolumeNode)
517 multiVolumeNode=mvNode,
518 multiVolumeLabels=mvLabels,
521 chartViewNode.requestChartCreation()
526 qSlicerMultiVolumeExplorerSimplifiedModuleWidget.processEvent(self, observee, event)