示例#1
0
    def __init__(self):
        super(TwoStepLandmarkWidget, self).__init__()

        self.textFrame = QTextEdit(
            "<p>Place your mouse over the desired "
            "landmark point. Press 'Space' to shoot a ray through the volume. "
            "Move the volume around and move the mouse to move the locator. "
            "Press 'Space' again to define the final place of the landmark.</p>"
            "<p>You can also use the ray profile to define the landmark's location.</p>"
        )
        self.textFrame.setReadOnly(True)
        self.textFrame.setFrameShape(QFrame.NoFrame)
        self.textFrame.setAutoFillBackground(False)
        self.textFrame.setAttribute(Qt.WA_TranslucentBackground)
        self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.textFrame.setStyleSheet("background: #aaa")

        self.histogramWidget = TrackingHistogramWidget()
        self.histogramWidget.setMinimumHeight(100)
        self.histogramWidget.setVisible(False)

        self.button = QPushButton("Pick current landmark position")
        self.button.clicked.connect(self.applyButtonClicked)
        self.button.setVisible(False)

        layout = QGridLayout()
        layout.setAlignment(Qt.AlignTop)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.textFrame)
        layout.addWidget(self.histogramWidget)
        layout.addWidget(self.button)
        self.setLayout(layout)
	def __init__(self):
		super(TwoStepLandmarkWidget, self).__init__()

		self.textFrame = QTextEdit("<p>Place your mouse over the desired "
			"landmark point. Press 'Space' to shoot a ray through the volume. "
			"Move the volume around and move the mouse to move the locator. "
			"Press 'Space' again to define the final place of the landmark.</p>"
			"<p>You can also use the ray profile to define the landmark's location.</p>")
		self.textFrame.setReadOnly(True)
		self.textFrame.setFrameShape(QFrame.NoFrame)
		self.textFrame.setAutoFillBackground(False)
		self.textFrame.setAttribute(Qt.WA_TranslucentBackground)
		self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
		self.textFrame.setStyleSheet("background: #aaa")

		self.histogramWidget = TrackingHistogramWidget()
		self.histogramWidget.setMinimumHeight(100)
		self.histogramWidget.setVisible(False)

		self.button = QPushButton("Pick current landmark position")
		self.button.clicked.connect(self.applyButtonClicked)
		self.button.setVisible(False)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setSpacing(0)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(self.textFrame)
		layout.addWidget(self.histogramWidget)
		layout.addWidget(self.button)
		self.setLayout(layout)
class LandmarkWidget(QWidget):
	"""
	LandmarkWidget
	"""

	pickedPosition = Signal()

	def __init__(self):
		super(LandmarkWidget, self).__init__()

		self.histogramWidget = TrackingHistogramWidget()
		self.button = QPushButton("Pick current landmark position")
		self.button.clicked.connect(self.applyButtonClicked)
		self.button.setVisible(False)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Ray profile:"))
		layout.addWidget(self.histogramWidget)
		layout.addWidget(self.button)

		self.setLayout(layout)

	def setSamples(self, samples, scope=None):
		self.histogram = Histogram()
		self.histogram.bins = samples
		
		if scope:
			self.histogram.minY = scope[0]
			self.histogram.maxY = scope[1]
			self.histogram.enabled = True

		self.histogramWidget.setHistogram(self.histogram)
		self.histogramWidget.setAxeMode(left=HistogramWidget.AxeNormal)
		self.histogramWidget.nodeItem.tracking = True
		self.button.setVisible(True)

	@Slot()
	def applyButtonClicked(self):
		self.pickedPosition.emit()

	@Slot()
	def pickedLocation(self, location):
		self.histogramWidget.nodeItem.tracking = False
		self.button.setVisible(False)
	def __init__(self):
		super(LandmarkWidget, self).__init__()

		self.histogramWidget = TrackingHistogramWidget()
		self.button = QPushButton("Pick current landmark position")
		self.button.clicked.connect(self.applyButtonClicked)
		self.button.setVisible(False)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.addWidget(QLabel("Ray profile:"))
		layout.addWidget(self.histogramWidget)
		layout.addWidget(self.button)

		self.setLayout(layout)
示例#5
0
class TwoStepLandmarkWidget(QWidget):
    """
	TwoStepLandmarkWidget
	"""

    pickedPosition = Signal()

    def __init__(self):
        super(TwoStepLandmarkWidget, self).__init__()

        self.textFrame = QTextEdit(
            "<p>Place your mouse over the desired "
            "landmark point. Press 'Space' to shoot a ray through the volume. "
            "Move the volume around and move the mouse to move the locator. "
            "Press 'Space' again to define the final place of the landmark.</p>"
            "<p>You can also use the ray profile to define the landmark's location.</p>"
        )
        self.textFrame.setReadOnly(True)
        self.textFrame.setFrameShape(QFrame.NoFrame)
        self.textFrame.setAutoFillBackground(False)
        self.textFrame.setAttribute(Qt.WA_TranslucentBackground)
        self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.textFrame.setStyleSheet("background: #aaa")

        self.histogramWidget = TrackingHistogramWidget()
        self.histogramWidget.setMinimumHeight(100)
        self.histogramWidget.setVisible(False)

        self.button = QPushButton("Pick current landmark position")
        self.button.clicked.connect(self.applyButtonClicked)
        self.button.setVisible(False)

        layout = QGridLayout()
        layout.setAlignment(Qt.AlignTop)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.textFrame)
        layout.addWidget(self.histogramWidget)
        layout.addWidget(self.button)
        self.setLayout(layout)

    def setSamples(self, samples, scope=None):
        self.textFrame.setVisible(False)
        self.histogramWidget.setVisible(True)

        self.histogram = Histogram()
        self.histogram.bins = samples

        if scope:
            self.histogram.minY = scope[0]
            self.histogram.maxY = scope[1]
            self.histogram.enabled = True

        self.histogramWidget.setHistogram(self.histogram)
        self.histogramWidget.setAxeMode(left=HistogramWidget.AxeNormal)
        self.histogramWidget.nodeItem.tracking = True
        self.button.setVisible(True)

    @Slot()
    def applyButtonClicked(self):
        self.pickedPosition.emit()

    @Slot()
    def pickedLocation(self, location):
        self.histogramWidget.nodeItem.tracking = False
        self.button.setVisible(False)
class TwoStepLandmarkWidget(QWidget):
	"""
	TwoStepLandmarkWidget
	"""

	pickedPosition = Signal()

	def __init__(self):
		super(TwoStepLandmarkWidget, self).__init__()

		self.textFrame = QTextEdit("<p>Place your mouse over the desired "
			"landmark point. Press 'Space' to shoot a ray through the volume. "
			"Move the volume around and move the mouse to move the locator. "
			"Press 'Space' again to define the final place of the landmark.</p>"
			"<p>You can also use the ray profile to define the landmark's location.</p>")
		self.textFrame.setReadOnly(True)
		self.textFrame.setFrameShape(QFrame.NoFrame)
		self.textFrame.setAutoFillBackground(False)
		self.textFrame.setAttribute(Qt.WA_TranslucentBackground)
		self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
		self.textFrame.setStyleSheet("background: #aaa")

		self.histogramWidget = TrackingHistogramWidget()
		self.histogramWidget.setMinimumHeight(100)
		self.histogramWidget.setVisible(False)

		self.button = QPushButton("Pick current landmark position")
		self.button.clicked.connect(self.applyButtonClicked)
		self.button.setVisible(False)

		layout = QGridLayout()
		layout.setAlignment(Qt.AlignTop)
		layout.setSpacing(0)
		layout.setContentsMargins(0, 0, 0, 0)
		layout.addWidget(self.textFrame)
		layout.addWidget(self.histogramWidget)
		layout.addWidget(self.button)
		self.setLayout(layout)

	def setSamples(self, samples, scope=None):
		self.textFrame.setVisible(False)
		self.histogramWidget.setVisible(True)

		self.histogram = Histogram()
		self.histogram.bins = samples
		
		if scope:
			self.histogram.minY = scope[0]
			self.histogram.maxY = scope[1]
			self.histogram.enabled = True

		self.histogramWidget.setHistogram(self.histogram)
		self.histogramWidget.setAxeMode(left=HistogramWidget.AxeNormal)
		self.histogramWidget.nodeItem.tracking = True
		self.button.setVisible(True)

	@Slot()
	def applyButtonClicked(self):
		self.pickedPosition.emit()

	@Slot()
	def pickedLocation(self, location):
		self.histogramWidget.nodeItem.tracking = False
		self.button.setVisible(False)