def __init__(self, parent=None): qt.QDialog.__init__(self, parent) self.label = qt.QLabel('Please Select Output File Format : ') self.outputImageFormat = qt.QComboBox(self) self.outputImageFormat.addItem("EDF") self.outputImageFormat.addItem("Tiff") self.outputImageFormat.addItem("Nrrd") self.outputImageFormat.addItem("Numpy") self.outputImageFormat.addItem("Matlab") self.outputImageFormat.addItem("PNG") self.outputImageFormat.addItem("Dicom") buttonBox = qt.QDialogButtonBox(qt.QDialogButtonBox.Ok | qt.QDialogButtonBox.Cancel) qt.QObject.connect(buttonBox, qt.SIGNAL('accepted()'), self.accept) qt.QObject.connect(buttonBox, qt.SIGNAL('rejected()'), self.reject) self.mainLayout = qt.QGridLayout() self.mainLayout.addWidget(self.label, 0, 0) self.mainLayout.addWidget(self.outputImageFormat, 0, 1) self.mainLayout.addWidget(buttonBox, 1, 1) self.setLayout(self.mainLayout)
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): ''' Constructor ''' qt.QToolBar.__init__(self, parent) self.setIconSize(qt.QSize(25, 25)) self.zoomAutoAction = qt.QAction(qt.QIcon('Icones/autozoom.png'), '&Zoom', self) self.zoomAutoAction.setStatusTip('Fit window') self.zoomAutoAction.setCheckable(False) self.zoomAutoAction.setChecked(False) self.zoomActive = False qt.QObject.connect(self.zoomAutoAction, qt.SIGNAL("triggered()"), self.zoomAutoPushed) self.zone1Action = qt.QAction(qt.QIcon('Icones/zone.png'), '&ZoneSelection', self) self.zone1Action.setStatusTip('Select Zone') self.zone1Action.setCheckable(True) self.zone1Action.setChecked(False) qt.QObject.connect(self.zone1Action, qt.SIGNAL("triggered()"), self.zone1Selected) self.pointerAction = qt.QAction(qt.QIcon('Icones/cursor.png'), '&PointerSelection', self) self.pointerAction.setStatusTip('Select Pointer') self.pointerAction.setCheckable(True) self.pointerAction.setChecked(True) qt.QObject.connect(self.pointerAction, qt.SIGNAL("triggered()"), self.pointerSelected) self.drawingAction = qt.QAction(qt.QIcon('Icones/circle18.png'), '&DrawingSelection', self) self.drawingAction.setStatusTip('Select Drawing') self.drawingAction.setCheckable(True) self.drawingAction.setChecked(False) qt.QObject.connect(self.drawingAction, qt.SIGNAL("triggered()"), self.drawingSelected) self.polygonAction = qt.QAction(qt.QIcon('Icones/polygon.png'), '&PolygonSelection', self) self.polygonAction.setStatusTip('Select Polygone') self.polygonAction.setCheckable(True) self.polygonAction.setChecked(False) qt.QObject.connect(self.polygonAction, qt.SIGNAL("triggered()"), self.polygonSelected) self.pointRemoveAction = qt.QAction(qt.QIcon('Icones/remove.png'), '&DeletePoint', self) self.pointRemoveAction.setStatusTip('remove Point') self.pointRemoveAction.setCheckable(False) self.pointRemoveAction.setChecked(False) self.radius = LabelEditAndButton(True, "", True, str(100), False) self.doubleSlider = DoubleSlider(self) self.setMinAndMaxToolBar(0, 0) self.doubleSlider.setMaximumWidth(800) self.colorChoice = qt.QComboBox() self.colormapList = [] colorMapDefault = "GrayLevel", range(256), range(256), range(256) self.colormapList.append(colorMapDefault) self.colorChoice.addItems([self.colormapList[0][0]]) self.addColorMap('Jet', './jet_color.txt') self.addAction(self.zoomAutoAction) self.addSeparator() self.addAction(self.pointerAction) self.addAction(self.zone1Action) self.addAction(self.drawingAction) self.ActionRadius = self.addWidget(self.radius) self.ActionRadius.setVisible(False) self.addAction(self.polygonAction) self.addAction(self.pointRemoveAction) self.addWidget(self.doubleSlider) self.addWidget(self.colorChoice)