def __init__(self): self.__chartView = ctk.ctkVTKChartView() self.__bgxArray = vtk.vtkFloatArray() self.__bgyArray = vtk.vtkFloatArray() self.__bgxArray.SetName('') self.__bgyArray.SetName('1st multivolume') self.__chartTable = self.createNewVTKTable(self.__bgxArray, self.__bgyArray) self.__bgMultiVolumeNode = None self.__fgMultiVolumeNode = None self.__mvLabels = [] self.__xLogScaleEnabled = False self.__yLogScaleEnabled = False self.__mvRange = [0,0] self.__nFramesForBaselineCalculation = 1 self.__chartMode = None self.activateSignalIntensityMode() self.baselineAverageSignal = 0 self.__showLegend = False
def __init__(self): self.__chartView = ctk.ctkVTKChartView() self.__bgxArray = vtk.vtkFloatArray() self.__bgyArray = vtk.vtkFloatArray() self.__bgxArray.SetName('') self.__bgyArray.SetName('1st multivolume') self.__chartTable = self.createNewVTKTable(self.__bgxArray, self.__bgyArray) self.__bgMultiVolumeNode = None self.__fgMultiVolumeNode = None self.__mvLabels = [] self.__xLogScaleEnabled = False self.__yLogScaleEnabled = False self.__mvRange = [0, 0] self.__nFramesForBaselineCalculation = 1 self.__chartMode = None self.activateSignalIntensityMode() self.baselineAverageSignal = 0 self.__showLegend = False
def setup( self ): self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout # create frames self.inputFrame = ctk.ctkCollapsibleButton() self.inputFrame.text = "Input" self.inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.inputFrame) self.layout.addWidget(self.inputFrame) self.ctrlFrame = ctk.ctkCollapsibleButton() self.ctrlFrame.text = "Frame control" self.ctrlFrame.collapsed = 0 ctrlFrameLayout = qt.QGridLayout(self.ctrlFrame) self.layout.addWidget(self.ctrlFrame) self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = qt.QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) self.plotSettingsFrame = ctk.ctkCollapsibleButton() self.plotSettingsFrame.text = "Settings" self.plotSettingsFrame.collapsed = 1 plotSettingsFrameLayout = qt.QGridLayout(self.plotSettingsFrame) plotFrameLayout.addWidget(self.plotSettingsFrame,0,1) label = qt.QLabel('Input multivolume') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) self.__mvSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onInputChanged) self.__mvSelector.addEnabled = 0 inputFrameLayout.addRow(label, self.__mvSelector) label = qt.QLabel('Input secondary multivolume') self.fgSelector = slicer.qMRMLNodeComboBox() self.fgSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.fgSelector.setMRMLScene(slicer.mrmlScene) self.fgSelector.addEnabled = 0 self.fgSelector.noneEnabled = 1 self.fgSelector.toolTip = "Secondary multivolume will be used for the secondary \ plot in interactive charting. As an example, this can be used to overlay the \ curve obtained by fitting a model to the data" inputFrameLayout.addRow(label, self.fgSelector) # TODO: initialize the slider based on the contents of the labels array # slider to scroll over metadata stored in the vector container being explored self.__mdSlider = ctk.ctkSliderWidget() label = qt.QLabel('Current frame number') # "play" control self.playButton = qt.QPushButton('Play') self.playButton.toolTip = 'Iterate over multivolume frames' self.playButton.checkable = True ctrlFrameLayout.addWidget(label, 0, 0) ctrlFrameLayout.addWidget(self.__mdSlider, 0, 1) ctrlFrameLayout.addWidget(self.playButton, 0, 2) self.playButton.connect('toggled(bool)', self.onPlayButtonToggled) self.__mdSlider.connect('valueChanged(double)', self.onSliderChanged) label = qt.QLabel('Current frame copy') self.__vfSelector = slicer.qMRMLNodeComboBox() self.__vfSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__vfSelector.setMRMLScene(slicer.mrmlScene) self.__vfSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVFMRMLSceneChanged) self.__vfSelector.addEnabled = 1 self.__vfSelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.__vfSelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", \ "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrame = False self.extractButton = qt.QPushButton('Enable current frame copying') self.extractButton.checkable = True self.extractButton.connect('toggled(bool)', self.onExtractFrameToggled) ctrlFrameLayout.addWidget(label, 1, 0) ctrlFrameLayout.addWidget(self.__vfSelector,1,1,1,2) ctrlFrameLayout.addWidget(self.extractButton,2,0,1,3) # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers() # label map for probing label = qt.QLabel('Probed label volume') self.__fSelector = slicer.qMRMLNodeComboBox() self.__fSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__fSelector.addAttribute('vtkMRMLScalarVolumeNode','LabelMap','1') self.__fSelector.toolTip = 'Label map to be probed' self.__fSelector.setMRMLScene(slicer.mrmlScene) self.__fSelector.addEnabled = 0 self.chartButton = qt.QPushButton('Chart') self.chartButton.checkable = False self.chartButton.connect('clicked()', self.onChartRequested) plotSettingsFrameLayout.addWidget(label,0,0) plotSettingsFrameLayout.addWidget(self.__fSelector,0,1) plotSettingsFrameLayout.addWidget(self.chartButton,0,2) self.iCharting = qt.QPushButton() self.iCharting.text = 'Enable interactive charting' self.iCharting.checkable = True plotSettingsFrameLayout.addWidget(self.iCharting,1,0,1,3) self.iCharting.setChecked(True) self.iCharting.connect('toggled(bool)', self.onInteractiveChartingChanged) groupLabel = qt.QLabel('Interactive plotting mode:') self.iChartingMode = qt.QButtonGroup() self.iChartingIntensity = qt.QRadioButton('Signal intensity') #self.iChartingIntensity.tooltip = 'Plot range adjusted dynamically to the range over the time course for the selected pixel' self.iChartingIntensityFixedAxes = qt.QRadioButton('Fixed range intensity') #self.iChartingIntensityFixedAxes.tooltip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.iChartingPercent = qt.QRadioButton('Percent change') #self.iChartingPercent.tooltip = 'Percent change relative to the average of the first N frames (parameter set below)' self.iChartingIntensity.setChecked(1) self.groupWidget = qt.QWidget() self.groupLayout = qt.QFormLayout(self.groupWidget) self.groupLayout.addRow(groupLabel) self.groupLayout.addRow(self.iChartingIntensity) self.groupLayout.addRow(self.iChartingIntensityFixedAxes) self.groupLayout.addRow(self.iChartingPercent) self.baselineFrames = qt.QSpinBox() self.baselineFrames.minimum = 1 label = qt.QLabel('Number of frames for baseline calculation') self.groupLayout.addRow(label,self.baselineFrames) self.xLogScaleCheckBox = qt.QCheckBox() self.xLogScaleCheckBox.setChecked(0) label = qt.QLabel('Use log scale for X axis') self.groupLayout.addRow(self.xLogScaleCheckBox,label) self.xLogScaleCheckBox.connect('stateChanged(int)', self.onXLogScaleRequested) self.yLogScaleCheckBox = qt.QCheckBox() self.yLogScaleCheckBox.setChecked(0) label = qt.QLabel('Use log scale for Y axis') self.groupLayout.addRow(self.yLogScaleCheckBox,label) self.yLogScaleCheckBox.connect('stateChanged(int)', self.onYLogScaleRequested) plotSettingsFrameLayout.addWidget(self.groupWidget,2,0) # add chart container widget self.__chartView = ctk.ctkVTKChartView(w) plotFrameLayout.addWidget(self.__chartView,3,0,1,3) self.__chart = self.__chartView.chart() self.__chartTable = vtk.vtkTable() self.__xArray = vtk.vtkFloatArray() self.__yArray = vtk.vtkFloatArray() # will crash if there is no name self.__xArray.SetName('') self.__yArray.SetName('signal intensity') self.__chartTable.AddColumn(self.__xArray) self.__chartTable.AddColumn(self.__yArray)
def setup(self): self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout # create frames self.inputFrame = ctk.ctkCollapsibleButton() self.inputFrame.text = "Input" self.inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.inputFrame) self.layout.addWidget(self.inputFrame) self.ctrlFrame = ctk.ctkCollapsibleButton() self.ctrlFrame.text = "Frame control" self.ctrlFrame.collapsed = 0 ctrlFrameLayout = qt.QGridLayout(self.ctrlFrame) self.layout.addWidget(self.ctrlFrame) self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = qt.QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) self.plotSettingsFrame = ctk.ctkCollapsibleButton() self.plotSettingsFrame.text = "Settings" self.plotSettingsFrame.collapsed = 1 plotSettingsFrameLayout = qt.QGridLayout(self.plotSettingsFrame) plotFrameLayout.addWidget(self.plotSettingsFrame, 0, 1) label = qt.QLabel('Input multivolume') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) self.__mvSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onInputChanged) self.__mvSelector.addEnabled = 0 inputFrameLayout.addRow(label, self.__mvSelector) label = qt.QLabel('Input secondary multivolume') self.fgSelector = slicer.qMRMLNodeComboBox() self.fgSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.fgSelector.setMRMLScene(slicer.mrmlScene) self.fgSelector.addEnabled = 0 self.fgSelector.noneEnabled = 1 self.fgSelector.toolTip = "Secondary multivolume will be used for the secondary \ plot in interactive charting. As an example, this can be used to overlay the \ curve obtained by fitting a model to the data" inputFrameLayout.addRow(label, self.fgSelector) # TODO: initialize the slider based on the contents of the labels array # slider to scroll over metadata stored in the vector container being explored self.__mdSlider = ctk.ctkSliderWidget() label = qt.QLabel('Current frame number') # "play" control self.playButton = qt.QPushButton('Play') self.playButton.toolTip = 'Iterate over multivolume frames' self.playButton.checkable = True ctrlFrameLayout.addWidget(label, 0, 0) ctrlFrameLayout.addWidget(self.__mdSlider, 0, 1) ctrlFrameLayout.addWidget(self.playButton, 0, 2) self.playButton.connect('toggled(bool)', self.onPlayButtonToggled) self.__mdSlider.connect('valueChanged(double)', self.onSliderChanged) label = qt.QLabel('Current frame copy') self.__vfSelector = slicer.qMRMLNodeComboBox() self.__vfSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__vfSelector.setMRMLScene(slicer.mrmlScene) self.__vfSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVFMRMLSceneChanged) self.__vfSelector.addEnabled = 1 self.__vfSelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.__vfSelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", \ "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrame = False self.extractButton = qt.QPushButton('Enable current frame copying') self.extractButton.checkable = True self.extractButton.connect('toggled(bool)', self.onExtractFrameToggled) ctrlFrameLayout.addWidget(label, 1, 0) ctrlFrameLayout.addWidget(self.__vfSelector, 1, 1, 1, 2) ctrlFrameLayout.addWidget(self.extractButton, 2, 0, 1, 3) # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers() # label map for probing label = qt.QLabel('Probed label volume') self.__fSelector = slicer.qMRMLNodeComboBox() self.__fSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__fSelector.addAttribute('vtkMRMLScalarVolumeNode', 'LabelMap', '1') self.__fSelector.toolTip = 'Label map to be probed' self.__fSelector.setMRMLScene(slicer.mrmlScene) self.__fSelector.addEnabled = 0 self.chartButton = qt.QPushButton('Chart') self.chartButton.checkable = False self.chartButton.connect('clicked()', self.onChartRequested) plotSettingsFrameLayout.addWidget(label, 0, 0) plotSettingsFrameLayout.addWidget(self.__fSelector, 0, 1) plotSettingsFrameLayout.addWidget(self.chartButton, 0, 2) self.iCharting = qt.QPushButton() self.iCharting.text = 'Enable interactive charting' self.iCharting.checkable = True plotSettingsFrameLayout.addWidget(self.iCharting, 1, 0, 1, 3) self.iCharting.setChecked(True) self.iCharting.connect('toggled(bool)', self.onInteractiveChartingChanged) groupLabel = qt.QLabel('Interactive plotting mode:') self.iChartingMode = qt.QButtonGroup() self.iChartingIntensity = qt.QRadioButton('Signal intensity') #self.iChartingIntensity.tooltip = 'Plot range adjusted dynamically to the range over the time course for the selected pixel' self.iChartingIntensityFixedAxes = qt.QRadioButton( 'Fixed range intensity') #self.iChartingIntensityFixedAxes.tooltip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.iChartingPercent = qt.QRadioButton('Percent change') #self.iChartingPercent.tooltip = 'Percent change relative to the average of the first N frames (parameter set below)' self.iChartingIntensity.setChecked(1) self.groupWidget = qt.QWidget() self.groupLayout = qt.QFormLayout(self.groupWidget) self.groupLayout.addRow(groupLabel) self.groupLayout.addRow(self.iChartingIntensity) self.groupLayout.addRow(self.iChartingIntensityFixedAxes) self.groupLayout.addRow(self.iChartingPercent) self.baselineFrames = qt.QSpinBox() self.baselineFrames.minimum = 1 label = qt.QLabel('Number of frames for baseline calculation') self.groupLayout.addRow(label, self.baselineFrames) self.xLogScaleCheckBox = qt.QCheckBox() self.xLogScaleCheckBox.setChecked(0) label = qt.QLabel('Use log scale for X axis') self.groupLayout.addRow(self.xLogScaleCheckBox, label) self.xLogScaleCheckBox.connect('stateChanged(int)', self.onXLogScaleRequested) self.yLogScaleCheckBox = qt.QCheckBox() self.yLogScaleCheckBox.setChecked(0) label = qt.QLabel('Use log scale for Y axis') self.groupLayout.addRow(self.yLogScaleCheckBox, label) self.yLogScaleCheckBox.connect('stateChanged(int)', self.onYLogScaleRequested) plotSettingsFrameLayout.addWidget(self.groupWidget, 2, 0) # add chart container widget self.__chartView = ctk.ctkVTKChartView(w) plotFrameLayout.addWidget(self.__chartView, 3, 0, 1, 3) self.__chart = self.__chartView.chart() self.__chartTable = vtk.vtkTable() self.__xArray = vtk.vtkFloatArray() self.__yArray = vtk.vtkFloatArray() # will crash if there is no name self.__xArray.SetName('') self.__yArray.SetName('signal intensity') self.__chartTable.AddColumn(self.__xArray) self.__chartTable.AddColumn(self.__yArray)
def setup( self ): self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout # create frames self.inputFrame = ctk.ctkCollapsibleButton() self.inputFrame.text = "Input" self.inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.inputFrame) self.layout.addWidget(self.inputFrame) self.ctrlFrame = ctk.ctkCollapsibleButton() self.ctrlFrame.text = "Frame control" self.ctrlFrame.collapsed = 0 ctrlFrameLayout = qt.QGridLayout(self.ctrlFrame) self.layout.addWidget(self.ctrlFrame) self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = qt.QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) label = qt.QLabel('Input multivolume') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) self.__mvSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onInputChanged) self.__mvSelector.addEnabled = 0 inputFrameLayout.addRow(label, self.__mvSelector) ##self.layout.addWidget(label) ##self.layout.addWidget(self.__mvSelector) # TODO: initialize the slider based on the contents of the labels array # slider to scroll over metadata stored in the vector container being explored self.__mdSlider = ctk.ctkSliderWidget() #self.__mdSlider.setRange(0,10) #self.__mdSlider.setValue(5) label = qt.QLabel('Current frame number') ##self.layout.addWidget(label) ##self.layout.addWidget(self.__mdSlider) # "play" control self.playButton = qt.QPushButton('Play') self.playButton.toolTip = 'Iterate over multivolume frames' self.playButton.checkable = True ctrlFrameLayout.addWidget(label, 0, 0) ctrlFrameLayout.addWidget(self.__mdSlider, 0, 1) ctrlFrameLayout.addWidget(self.playButton, 0, 2) self.playButton.connect('toggled(bool)', self.onPlayButtonToggled) self.__mdSlider.connect('valueChanged(double)', self.onSliderChanged) label = qt.QLabel('Current frame copy') self.__vfSelector = slicer.qMRMLNodeComboBox() self.__vfSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__vfSelector.setMRMLScene(slicer.mrmlScene) self.__vfSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVFMRMLSceneChanged) self.__vfSelector.addEnabled = 1 self.__vfSelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.__vfSelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", \ "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrame = False self.extractButton = qt.QPushButton('Enable current frame copying') self.extractButton.checkable = True self.extractButton.connect('toggled(bool)', self.onExtractFrameToggled) ctrlFrameLayout.addWidget(label, 1, 0) ctrlFrameLayout.addWidget(self.__vfSelector,1,1,1,2) ctrlFrameLayout.addWidget(self.extractButton,2,0,1,3) # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers() # label map for probing label = qt.QLabel('Probed label volume') self.__fSelector = slicer.qMRMLNodeComboBox() self.__fSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__fSelector.addAttribute('vtkMRMLScalarVolumeNode','LabelMap','1') self.__fSelector.toolTip = 'Label map to be probed' self.__fSelector.setMRMLScene(slicer.mrmlScene) self.__fSelector.addEnabled = 0 self.__fSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onLabelVolumeChanged) self.__fSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onLVMRMLSceneChanged) plotFrameLayout.addWidget(label,0,0,1,1) plotFrameLayout.addWidget(self.__fSelector,0,1,1,2) self.iCharting = qt.QPushButton() self.iCharting.text = 'Enable interactive charting' self.iCharting.checkable = True plotFrameLayout.addWidget(self.iCharting,1,0,1,3) self.iCharting.setChecked(True) self.iCharting.connect('toggled(bool)', self.onInteractiveChartingChanged) label = qt.QLabel("Use intensity range to fix axis extent") label.toolTip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.__fixedAxesCheckbox = qt.QCheckBox() self.__fixedAxesCheckbox.toolTip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.__fixedAxesCheckbox.checked = False plotFrameLayout.addWidget(label, 2, 0) plotFrameLayout.addWidget(self.__fixedAxesCheckbox, 2,1,1,2) # add chart container widget self.__chartView = ctk.ctkVTKChartView(w) plotFrameLayout.addWidget(self.__chartView,3,0,1,3) self.__chart = self.__chartView.chart() self.__chartTable = vtk.vtkTable() self.__xArray = vtk.vtkFloatArray() self.__yArray = vtk.vtkFloatArray() # will crash if there is no name self.__xArray.SetName('') self.__yArray.SetName('signal intensity') self.__chartTable.AddColumn(self.__xArray) self.__chartTable.AddColumn(self.__yArray)
def __init__(self,param): super(LesionFormWidget,self).__init__() # parameters node keeps all that is needed to render # the form and to store the scores self.param = param self.widget = qt.QWidget() self.layout = qt.QHBoxLayout(self.widget) lesionNameWidget = qt.QWidget() scoreSheetWidget = qt.QWidget() plotWidget = qt.QWidget() lnLayout = qt.QVBoxLayout(lesionNameWidget) ssLayout = qt.QVBoxLayout(scoreSheetWidget) pLayout = qt.QVBoxLayout(plotWidget) lesionName = qt.QLabel(self.param.lesionName) lnLayout.addWidget(lesionName) w = qt.QWidget() wl = qt.QHBoxLayout(w) for i in range(0,6): if i: label = qt.QLabel(str(i)) else: label = qt.QLabel('') wl.addWidget(label) ssLayout.addWidget(w) w = qt.QWidget() wl = qt.QHBoxLayout(w) t2label = qt.QLabel('T2W') wl.addWidget(t2label) t2radios = [] self.t2group = qt.QButtonGroup() for i in range(1,6): t2radios.append(qt.QRadioButton()) self.t2group.addButton(t2radios[-1],i) wl.addWidget(t2radios[-1]) self.t2group.connect('buttonClicked(int)', self.onT2scoreUpdated) ssLayout.addWidget(w) w = qt.QWidget() wl = qt.QHBoxLayout(w) dwilabel = qt.QLabel('DWI') wl.addWidget(dwilabel) dwiradios = [] self.dwigroup = qt.QButtonGroup() for i in range(1,6): dwiradios.append(qt.QRadioButton()) self.dwigroup.addButton(dwiradios[-1],i) wl.addWidget(dwiradios[-1]) self.dwigroup.connect('buttonClicked(int)', self.onDWIscoreUpdated) ssLayout.addWidget(w) w = qt.QWidget() wl = qt.QHBoxLayout(w) dcelabel = qt.QLabel('DCE') wl.addWidget(dcelabel) dceradios = [] self.dcegroup = qt.QButtonGroup() for i in range(1,6): dceradios.append(qt.QRadioButton()) self.dcegroup.addButton(dceradios[-1],i) wl.addWidget(dceradios[-1]) self.dcegroup.connect('buttonClicked(int)', self.onDCEscoreUpdated) ssLayout.addWidget(w) chartView = ctk.ctkVTKChartView(plotWidget) chart = chartView.chart() table = vtk.vtkTable() x = vtk.vtkFloatArray() y = vtk.vtkFloatArray() x.SetName('time point') y.SetName('signal intensity') table.AddColumn(x) table.AddColumn(y) table.SetNumberOfRows(100) for c in range(len(self.param.x)): table.SetValue(c,0,self.param.x[c]) table.SetValue(c,1,self.param.y[c]) plot = chart.AddPlot(0) plot.SetInput(table,0,1) chart.AddPlot(0) cw = qt.QWidget() cwl = qt.QVBoxLayout(cw) cwl.addWidget(chartView) pLayout.addWidget(cw) self.layout.addWidget(lesionNameWidget) self.layout.addWidget(scoreSheetWidget) self.layout.addWidget(plotWidget)
def setup(self, wName, parent): if self.ctrlWidget: return self.LinkViewers() self.numFrames = len(self.nodeImgList[0][0]) if parent: self.ctrlWidget = parent else: # Create seperate window self.ctrlWidget = slicer.qMRMLWidget() self.ctrlWidget.setMRMLScene(slicer.mrmlScene) self.ctrlWidget.setLayout(qt.QFormLayout()) self.ctrlWidget.setWindowTitle(wName) ctrlLayout = self.ctrlWidget.layout() # Create Slider Panel self.sliderPanel = qt.QWidget() self.sliderPanel.setLayout(qt.QGridLayout()) ctrlLayout.addWidget(self.sliderPanel) sliderLayout = self.sliderPanel.layout() if self.numFrames > 1: self.ctrlFrameLabel = qt.QLabel('Frame') self.ctrlFrameSlider = ctk.ctkSliderWidget() self.ctrlFrameSlider.connect('valueChanged(double)', self.onSliderFrameChanged) sliderLayout.addWidget(self.ctrlFrameLabel, 0, 0) sliderLayout.addWidget(self.ctrlFrameSlider, 0, 1) self.ctrlLevelLabel = qt.QLabel('Level') self.ctrlLevelSlider = ctk.ctkSliderWidget() self.ctrlLevelSlider.connect('valueChanged(double)', self.onSliderLevelChanged) sliderLayout.addWidget(self.ctrlLevelLabel, 1, 0) sliderLayout.addWidget(self.ctrlLevelSlider, 1, 1) self.ctrlWindowLabel = qt.QLabel('Window') self.ctrlWindowSlider = ctk.ctkSliderWidget() self.ctrlWindowSlider.connect('valueChanged(double)', self.onSliderWindowChanged) sliderLayout.addWidget(self.ctrlWindowLabel, 2, 0) sliderLayout.addWidget(self.ctrlWindowSlider, 2, 1) self.setSliderRangesAndValues() if self.sliceNodeList: self.orientPanel = qt.QWidget() self.orientPanel.setLayout(qt.QGridLayout()) ctrlLayout.addWidget(self.orientPanel) self.orientationButtons = {} index = 0 for orientation in self.orientations: self.orientationButtons[orientation] = qt.QRadioButton() self.orientationButtons[orientation].text = orientation # self.orientationBox.layout().addWidget(self.orientationButtons[orientation]) self.orientPanel.layout().addWidget( self.orientationButtons[orientation], 0, index) self.orientationButtons[orientation].connect( "clicked()", lambda o=orientation: self.setOrientation(o)) index += 1 self.setOrientation(self.selectedOrientation) if False: #self.plotFrame = ctk.ctkCollapsibleButton() #self.plotFrame.text = "Plotting" #self.plotFrame.collapsed = 0 self.plotFrame = qt.QWidget() plotFrameLayout = qt.QGridLayout(self.plotFrame) ctrlLayout.addWidget(self.plotFrame) self.plotSettingsFrame = ctk.ctkCollapsibleButton() self.plotSettingsFrame.text = "Settings" self.plotSettingsFrame.collapsed = 1 plotSettingsFrameLayout = qt.QGridLayout(self.plotSettingsFrame) #plotFrameLayout.addWidget(self.plotSettingsFrame,0,1) self.xLogScaleCheckBox = qt.QCheckBox() self.xLogScaleCheckBox.setChecked(0) self.yLogScaleCheckBox = qt.QCheckBox() self.yLogScaleCheckBox.setChecked(0) # taken from https://github.com/fedorov/MultiVolumeExplorer self.__chartView = ctk.ctkVTKChartView(self.ctrlWidget) # self.plotFrame) # self.ctrlWidget plotFrameLayout.addWidget(self.__chartView, 0, 0) self.__chart = self.__chartView.chart() self.__chartTable = vtk.vtkTable() self.__xArray = vtk.vtkFloatArray() self.__yArray = vtk.vtkFloatArray() # will crash if there is no name self.__xArray.SetName('') self.__yArray.SetName('signal intensity') self.__chartTable.AddColumn(self.__xArray) self.__chartTable.AddColumn(self.__yArray) self.onInputChanged() self.refreshObservers() self.buttonPanel = qt.QWidget() self.buttonPanel.setLayout(qt.QGridLayout()) ctrlLayout.addWidget(self.buttonPanel) self.exitButton = qt.QPushButton("Exit") self.exitButton.toolTip = "Close down slicer." self.exitButton.name = "sviewer exit" self.buttonPanel.layout().addWidget(self.exitButton, 0, 0) self.exitButton.connect('clicked()', exit) # do not do ctrlWin.show() here - for some reason window does not pop up then return self.ctrlWidget
def setup(self): self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) w = qt.QWidget() layout = qt.QGridLayout() w.setLayout(layout) self.layout.addWidget(w) w.show() self.layout = layout # create frames self.inputFrame = ctk.ctkCollapsibleButton() self.inputFrame.text = "Input" self.inputFrame.collapsed = 0 inputFrameLayout = qt.QFormLayout(self.inputFrame) self.layout.addWidget(self.inputFrame) self.ctrlFrame = ctk.ctkCollapsibleButton() self.ctrlFrame.text = "Frame control" self.ctrlFrame.collapsed = 0 ctrlFrameLayout = qt.QGridLayout(self.ctrlFrame) self.layout.addWidget(self.ctrlFrame) self.plotFrame = ctk.ctkCollapsibleButton() self.plotFrame.text = "Plotting" self.plotFrame.collapsed = 0 plotFrameLayout = qt.QGridLayout(self.plotFrame) self.layout.addWidget(self.plotFrame) label = qt.QLabel('Input multivolume') self.__mvSelector = slicer.qMRMLNodeComboBox() self.__mvSelector.nodeTypes = ['vtkMRMLMultiVolumeNode'] self.__mvSelector.setMRMLScene(slicer.mrmlScene) self.__mvSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVCMRMLSceneChanged) self.__mvSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onInputChanged) self.__mvSelector.addEnabled = 0 inputFrameLayout.addRow(label, self.__mvSelector) ##self.layout.addWidget(label) ##self.layout.addWidget(self.__mvSelector) # TODO: initialize the slider based on the contents of the labels array # slider to scroll over metadata stored in the vector container being explored self.__mdSlider = ctk.ctkSliderWidget() #self.__mdSlider.setRange(0,10) #self.__mdSlider.setValue(5) label = qt.QLabel('Current frame number') ##self.layout.addWidget(label) ##self.layout.addWidget(self.__mdSlider) # "play" control self.playButton = qt.QPushButton('Play') self.playButton.toolTip = 'Iterate over multivolume frames' self.playButton.checkable = True ctrlFrameLayout.addWidget(label, 0, 0) ctrlFrameLayout.addWidget(self.__mdSlider, 0, 1) ctrlFrameLayout.addWidget(self.playButton, 0, 2) self.playButton.connect('toggled(bool)', self.onPlayButtonToggled) self.__mdSlider.connect('valueChanged(double)', self.onSliderChanged) label = qt.QLabel('Current frame copy') self.__vfSelector = slicer.qMRMLNodeComboBox() self.__vfSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__vfSelector.setMRMLScene(slicer.mrmlScene) self.__vfSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onVFMRMLSceneChanged) self.__vfSelector.addEnabled = 1 self.__vfSelector.enabled = 0 # do not show "children" of vtkMRMLScalarVolumeNode self.__vfSelector.hideChildNodeTypes = ["vtkMRMLDiffusionWeightedVolumeNode", \ "vtkMRMLDiffusionTensorVolumeNode", "vtkMRMLVectorVolumeNode"] self.extractFrame = False self.extractButton = qt.QPushButton('Enable current frame copying') self.extractButton.checkable = True self.extractButton.connect('toggled(bool)', self.onExtractFrameToggled) ctrlFrameLayout.addWidget(label, 1, 0) ctrlFrameLayout.addWidget(self.__vfSelector, 1, 1, 1, 2) ctrlFrameLayout.addWidget(self.extractButton, 2, 0, 1, 3) # initialize slice observers (from DataProbe.py) # keep list of pairs: [observee,tag] so they can be removed easily self.styleObserverTags = [] # keep a map of interactor styles to sliceWidgets so we can easily get sliceLogic self.sliceWidgetsPerStyle = {} self.refreshObservers() # label map for probing label = qt.QLabel('Probed label volume') self.__fSelector = slicer.qMRMLNodeComboBox() self.__fSelector.nodeTypes = ['vtkMRMLScalarVolumeNode'] self.__fSelector.addAttribute('vtkMRMLScalarVolumeNode', 'LabelMap', '1') self.__fSelector.toolTip = 'Label map to be probed' self.__fSelector.setMRMLScene(slicer.mrmlScene) self.__fSelector.addEnabled = 0 self.__fSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onLabelVolumeChanged) self.__fSelector.connect('mrmlSceneChanged(vtkMRMLScene*)', self.onLVMRMLSceneChanged) plotFrameLayout.addWidget(label, 0, 0, 1, 1) plotFrameLayout.addWidget(self.__fSelector, 0, 1, 1, 2) self.iCharting = qt.QPushButton() self.iCharting.text = 'Enable interactive charting' self.iCharting.checkable = True plotFrameLayout.addWidget(self.iCharting, 1, 0, 1, 3) self.iCharting.setChecked(True) self.iCharting.connect('toggled(bool)', self.onInteractiveChartingChanged) label = qt.QLabel("Use intensity range to fix axis extent") label.toolTip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.__fixedAxesCheckbox = qt.QCheckBox() self.__fixedAxesCheckbox.toolTip = "If checked, the extent of the vertical axis of the plot will be fixed to the range of the intensities in the input MultiVolume" self.__fixedAxesCheckbox.checked = False plotFrameLayout.addWidget(label, 2, 0) plotFrameLayout.addWidget(self.__fixedAxesCheckbox, 2, 1, 1, 2) # add chart container widget self.__chartView = ctk.ctkVTKChartView(w) plotFrameLayout.addWidget(self.__chartView, 3, 0, 1, 3) self.__chart = self.__chartView.chart() self.__chartTable = vtk.vtkTable() self.__xArray = vtk.vtkFloatArray() self.__yArray = vtk.vtkFloatArray() # will crash if there is no name self.__xArray.SetName('') self.__yArray.SetName('signal intensity') self.__chartTable.AddColumn(self.__xArray) self.__chartTable.AddColumn(self.__yArray)