def __init__(self,parent=None, Orientation=1) : qt.QWidget.__init__(self, parent) self.slider=qt.QSlider(1) self.slider.setMinimum(1) self.slider.setMaximum(100) self.Label=qt.QLabel("0") self.Label.setFixedSize(45,45) self.layout=qt.QHBoxLayout() self.layout.addWidget(self.slider) self.layout.addWidget(self.Label) self._changeLabel() self.connect(self.slider,qt.SIGNAL("valueChanged(int)"),self._changeLabel) self.setLayout(self.layout)
def _build(self) : self.layout=qt.QHBoxLayout() self.label =None self.lineEdit =None self.button =None if(self.boolLabel) : self.label=qt.QLabel(self.textLabel,self) self.layout.addWidget(self.label) if(self.booltextEdit) : self.lineEdit= qt.QLineEdit(self.textEdit,self) self.layout.addWidget(self.lineEdit) if(self.boolButton) : self.button=qt.QPushButton(self.textButton,self) self.layout.addWidget(self.button) self.connect(self.button,qt.SIGNAL("clicked()"),self.buttonPushed) self.setLayout(self.layout)
def _build(self): self.layout = qt.QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.label = None self.button = None if (self.boolTitle): self.label = qt.QLabel(self.textTitle, self) self.label.setMinimumWidth(200) self.layout.addWidget(self.label) if (self.boolIcons): self.save = qt.QPushButton() self.saveas = qt.QPushButton() self.load = qt.QPushButton() self.save.setMaximumWidth(30) self.saveas.setMaximumWidth(30) self.load.setMaximumWidth(30) self.save.setMaximumHeight(30) self.saveas.setMaximumHeight(30) self.load.setMaximumHeight(30) self.save.setFlat(True) self.saveas.setFlat(True) self.load.setFlat(True) if self.pathIcon1 != '': self.save.setIcon(qt.QIcon(qt.QPixmap(self.pathIcon1))) if self.pathIcon2 != '': self.saveas.setIcon(qt.QIcon(qt.QPixmap(self.pathIcon2))) if self.pathIcon3 != '': self.load.setIcon(qt.QIcon(qt.QPixmap(self.pathIcon3))) self.layout.addWidget(self.save) self.layout.addWidget(self.saveas) self.layout.addWidget(self.load) self.setLayout(self.layout)
def __init__( self, parent=None, ): qt.QWidget.__init__(self, parent) self.mainLayout = qt.QGridLayout() self.frame = VtkUF.VTK_Render_QT() nb_row = 9 width_widget = 350 self.check_parameters_files() self.ImagesList = [] self.DataList = [] self.ItemLists = [] """ Image To Render """ self.labelIR = qt.QLabel("Volume To Render") self.labelIR.setMaximumWidth(width_widget) self.comboBoxIR = qt.QComboBox() self.comboBoxIR.setMaximumWidth(width_widget) self.labelVF = qt.QLabel("Vector Field To Render") self.labelVF.setMaximumWidth(width_widget) self.comboBoxVF = qt.QComboBox() self.comboBoxVF.setMaximumWidth(width_widget) self.labelP = qt.QLabel("Plane Image To Render") self.labelP.setMaximumWidth(width_widget) self.comboBoxP = qt.QComboBox() self.comboBoxP.setMaximumWidth(width_widget) self.LayoutPlane = qt.QHBoxLayout() self.Xplane = LabelEditAndButton(True, "X: ", True, str(0), False) self.Xplane.setMaximumWidth(width_widget / 3.0) self.Yplane = LabelEditAndButton(True, "X: ", True, str(0), False) self.Yplane.setMaximumWidth(width_widget / 3.0) self.Zplane = LabelEditAndButton(True, "Z: ", True, str(0), False) self.Zplane.setMaximumWidth(width_widget / 3.0) self.LayoutPlane.addWidget(self.Xplane) self.LayoutPlane.addWidget(self.Yplane) self.LayoutPlane.addWidget(self.Zplane) self.setImages() """------------------------------------ COLOR TABLE -------------------------------------""" self.color_TitleAndIcons = TitleAndIcones(True, "Color Table", True, './Icones/save.png', './Icones/saveas.png', './Icones/load.png') self.connect(self.color_TitleAndIcons.save, qt.SIGNAL("clicked()"), self._buttonColorSavePushed) self.connect(self.color_TitleAndIcons.saveas, qt.SIGNAL("clicked()"), self._buttonColorSaveasPushed) self.connect(self.color_TitleAndIcons.load, qt.SIGNAL("clicked()"), self._buttonColorLoadPushed) self.colorCoef = qt.QTableWidget(nb_row, 6) self.colorCoef.verticalHeader().hide() self.colorCoef.setColumnWidth(0, 50) self.colorCoef.setColumnWidth(1, 50) self.colorCoef.setColumnWidth(2, 50) self.colorCoef.setColumnWidth(3, 50) self.colorCoef.setColumnWidth(4, 70) self.colorCoef.setColumnWidth(5, 85) for i in range(nb_row): self.colorCoef.setRowHeight(i, 15) self.colorCoef.setMaximumWidth(width_widget) self.colorCoef.setHorizontalHeaderLabels( ['Value', 'R', 'G', 'B', 'Midpoint', 'Sharpness']) self.colorCoef.setContentsMargins(-1, 0, -1, -1) self.fill_colorTable() """------------------------------------ ALPHA TABLE -------------------------------------""" self.alpha_TitleAndIcons = TitleAndIcones(True, "Alpha Table", True, './Icones/save.png', './Icones/saveas.png', './Icones/load.png') self.connect(self.alpha_TitleAndIcons.save, qt.SIGNAL("clicked()"), self._buttonAlphaSavePushed) self.connect(self.alpha_TitleAndIcons.saveas, qt.SIGNAL("clicked()"), self._buttonAlphaSaveasPushed) self.connect(self.alpha_TitleAndIcons.load, qt.SIGNAL("clicked()"), self._buttonAlphaLoadPushed) self.AlphaCoef = qt.QTableWidget(nb_row, 4) self.AlphaCoef.verticalHeader().hide() self.AlphaCoef.setColumnWidth(0, 50) self.AlphaCoef.setColumnWidth(1, 50) self.AlphaCoef.setColumnWidth(2, 70) self.AlphaCoef.setColumnWidth(3, 85) for i in range(nb_row): self.AlphaCoef.setRowHeight(i, 15) self.AlphaCoef.setMaximumWidth(width_widget) self.AlphaCoef.setHorizontalHeaderLabels( ['Value', 'Alpha', 'Midpoint', 'Sharpness']) self.AlphaCoef.setContentsMargins(-1, 0, -1, -1) self.fill_alphaTable() """------------------------------------ PARAMETERS -------------------------------------""" self.parameters_TitleAndIcons = TitleAndIcones( True, "Volume Parameters", True, './Icones/save.png', './Icones/saveas.png', './Icones/load.png') self.connect(self.parameters_TitleAndIcons.save, qt.SIGNAL("clicked()"), self._buttonParaSavePushed) self.connect(self.parameters_TitleAndIcons.saveas, qt.SIGNAL("clicked()"), self._buttonParaSaveasPushed) self.connect(self.parameters_TitleAndIcons.load, qt.SIGNAL("clicked()"), self._buttonParaLoadPushed) self.renderButton = qt.QPushButton("Render") self.renderButton.setMaximumWidth(width_widget) self.check_box_mesh = qt.QCheckBox("Marching Cube Volume") self.ThresholdMC = LabelEditAndButton(True, "Value For Threshold", True, str(0.5), False) self.check_smooth = qt.QCheckBox("Smoothing Mesh") self.SmoothIterNb = LabelEditAndButton(True, "Smooth Iteration Number :", True, str(10), False) self.SmoothRelaxF = LabelEditAndButton(True, "Relaxation Factor :", True, str(0.5), False) self.check_box_mesh.setMaximumWidth(width_widget) self.ThresholdMC.setMaximumWidth(width_widget) self.check_smooth.setMaximumWidth(width_widget) self.SmoothIterNb.setMaximumWidth(width_widget) self.SmoothRelaxF.setMaximumWidth(width_widget) self.checkBox = qt.QCheckBox("Shade") self.checkBox.setMaximumWidth(width_widget) self.LabelAmb = qt.QLabel("Ambient lighting coefficient") self.LabelAmb.setContentsMargins(-1, -1, -1, 0) self.sliderAmb = SliderAndLabel.SliderAndLabelSpecificScale() self.sliderAmb.setMaximumWidth(width_widget) self.sliderAmb._setStepPrecision(0.05) self.sliderAmb._setRange(0, 10.0) self.sliderAmb.setContentsMargins(-1, 0, -1, -1) self.LabelDif = qt.QLabel("Diffuse lighting Coefficient") self.LabelDif.setContentsMargins(-1, -1, -1, 0) self.sliderDif = SliderAndLabel.SliderAndLabelSpecificScale() self.sliderDif.setMaximumWidth(width_widget) self.sliderDif._setStepPrecision(0.05) self.sliderDif._setRange(0, 10.0) self.sliderDif.setContentsMargins(-1, 0, -1, -1) self.LabelSpe = qt.QLabel("Specular lighting Coefficient") self.LabelSpe.setContentsMargins(-1, -1, -1, 0) self.sliderSpe = SliderAndLabel.SliderAndLabelSpecificScale() self.sliderSpe.setMaximumWidth(width_widget) self.sliderSpe._setStepPrecision(0.05) self.sliderSpe._setRange(0, 10.0) self.sliderSpe.setContentsMargins(-1, 0, -1, -1) self.LabelSpeP = qt.QLabel("Specular power Coefficient") self.LabelSpeP.setContentsMargins(-1, -1, -1, 0) self.sliderSpeP = SliderAndLabel.SliderAndLabelSpecificScale() self.sliderSpeP.setMaximumWidth(width_widget) self.sliderSpeP._setStepPrecision(0.05) self.sliderSpeP._setRange(0, 10.0) self.sliderSpeP.setContentsMargins(-1, 0, -1, -1) self.LabelOpa = qt.QLabel("Opacity unit distance") self.LabelOpa.setContentsMargins(-1, -1, -1, 0) self.sliderOpa = SliderAndLabel.SliderAndLabelSpecificScale() self.sliderOpa.setMaximumWidth(width_widget) self.sliderOpa._setStepPrecision(1) self.sliderOpa._setRange(0, 1000) self.sliderOpa.setContentsMargins(-1, 0, -1, -1) self.fill_para() self.mainLayout.addWidget(self.frame, 0, 0) self.mainLayout.addWidget(self.color_TitleAndIcons, 0, 1) self.mainLayout.addWidget(self.colorCoef, 1, 1, 10, 1) self.mainLayout.addWidget(self.alpha_TitleAndIcons, 12, 1) self.mainLayout.addWidget(self.AlphaCoef, 13, 1, 10, 1) self.mainLayout.addWidget(self.labelIR, 1, 2) self.mainLayout.addWidget(self.comboBoxIR, 2, 2) self.mainLayout.addWidget(self.labelVF, 3, 2) self.mainLayout.addWidget(self.comboBoxVF, 4, 2) self.mainLayout.addWidget(self.labelP, 5, 2) self.mainLayout.addWidget(self.comboBoxP, 6, 2) self.mainLayout.addWidget(self.check_box_mesh, 7, 2) self.mainLayout.addWidget(self.ThresholdMC, 8, 2) self.mainLayout.addWidget(self.check_smooth, 9, 2) self.mainLayout.addWidget(self.SmoothIterNb, 10, 2) self.mainLayout.addWidget(self.SmoothRelaxF, 11, 2) self.mainLayout.addLayout(self.LayoutPlane, 12, 2) self.mainLayout.addWidget(self.parameters_TitleAndIcons, 13, 2) self.mainLayout.addWidget(self.checkBox, 14, 2) self.mainLayout.addWidget(self.LabelAmb, 15, 2) self.mainLayout.addWidget(self.sliderAmb, 16, 2) self.mainLayout.addWidget(self.LabelDif, 17, 2) self.mainLayout.addWidget(self.sliderDif, 18, 2) self.mainLayout.addWidget(self.LabelSpe, 19, 2) self.mainLayout.addWidget(self.sliderSpe, 20, 2) self.mainLayout.addWidget(self.LabelSpeP, 21, 2) self.mainLayout.addWidget(self.sliderSpeP, 22, 2) self.mainLayout.addWidget(self.LabelOpa, 23, 2) self.mainLayout.addWidget(self.sliderOpa, 24, 2) self.mainLayout.addWidget(self.renderButton, 25, 2) self.setLayout(self.mainLayout) qt.QObject.connect(self.renderButton, qt.SIGNAL("clicked()"), self._render)
def __init__(self, parent=None): qt.QWidget.__init__(self, parent) self.toolBar = CustomToolBar(self) self.axialWidget = SliceVisualizer(0) self.coronalWidget = SliceVisualizer(1) self.sagittalWidget = SliceVisualizer(2) self.Items = {'Seeds':{'Direction0':[],'Direction1':[],'Direction2':[]},\ 'Zones':{'Direction0':[],'Direction1':[],'Direction2':[]},\ 'Circles':{'Direction0':[],'Direction1':[],'Direction2':[]},\ 'Poly':{'Direction0':[],'Direction1':[],'Direction2':[]}} layoutTop = qt.QHBoxLayout() layoutTop.addWidget(self.toolBar) layout = qt.QVBoxLayout() layout.addLayout(layoutTop) splitterVertical = qt.QSplitter(self) splitterAxialCoronal = qt.QSplitter(0, self) splitterVertical.addWidget(self.axialWidget) splitterAxialCoronal.addWidget(self.sagittalWidget) splitterAxialCoronal.addWidget(self.coronalWidget) splitterVertical.addWidget(splitterAxialCoronal) layout.addWidget(splitterVertical) self.toolBar.doubleSlider.sigDoubleSliderValueChanged.connect( self.axialWidget._doubleSliderValueChanged) self.toolBar.doubleSlider.sigDoubleSliderValueChanged.connect( self.coronalWidget._doubleSliderValueChanged) self.toolBar.doubleSlider.sigDoubleSliderValueChanged.connect( self.sagittalWidget._doubleSliderValueChanged) qt.QObject.connect(self.toolBar.zoomAutoAction, qt.SIGNAL("triggered()"), self.axialWidget.view.autofit) qt.QObject.connect(self.toolBar.zoomAutoAction, qt.SIGNAL("triggered()"), self.coronalWidget.view.autofit) qt.QObject.connect(self.toolBar.zoomAutoAction, qt.SIGNAL("triggered()"), self.sagittalWidget.view.autofit) qt.QObject.connect(self.toolBar.zone1Action, qt.SIGNAL("triggered()"), self.axialWidget.changeSelectorToRuberband) qt.QObject.connect(self.toolBar.zone1Action, qt.SIGNAL("triggered()"), self.coronalWidget.changeSelectorToRuberband) qt.QObject.connect(self.toolBar.zone1Action, qt.SIGNAL("triggered()"), self.sagittalWidget.changeSelectorToRuberband) qt.QObject.connect(self.toolBar.drawingAction, qt.SIGNAL("triggered()"), self.axialWidget.changeSelectorToCircle) qt.QObject.connect(self.toolBar.drawingAction, qt.SIGNAL("triggered()"), self.coronalWidget.changeSelectorToCircle) qt.QObject.connect(self.toolBar.drawingAction, qt.SIGNAL("triggered()"), self.sagittalWidget.changeSelectorToCircle) qt.QObject.connect(self.toolBar.pointerAction, qt.SIGNAL("triggered()"), self.axialWidget.changeSelectorToPointer) qt.QObject.connect(self.toolBar.pointerAction, qt.SIGNAL("triggered()"), self.coronalWidget.changeSelectorToPointer) qt.QObject.connect(self.toolBar.pointerAction, qt.SIGNAL("triggered()"), self.sagittalWidget.changeSelectorToPointer) self.connect(self.toolBar.colorChoice, qt.SIGNAL("currentIndexChanged(int)"), self._colorMapChanged) self.setLayout(layout)