Example #1
0
    def set_beamline_setup(self, beamline_setup):
        self._beamline_setup = beamline_setup

        limits_dict = self._beamline_setup.get_acquisition_limit_values()

        if 'osc_range' in limits_dict:
            limits = tuple(map(float, limits_dict['osc_range'].split(',')))
            (lower, upper) = limits
            osc_start_validator = qt.QDoubleValidator(lower, upper, 4, self)
            osc_range_validator = qt.QDoubleValidator(lower, upper, 4, self)
        else:
            osc_start_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
            osc_range_validator = qt.QDoubleValidator(-10000, 10000, 4, self)

        osc_start_ledit = self.acq_widget_layout.child('osc_start_ledit')
        self._acquisition_mib.bind_value_update('osc_start', osc_start_ledit,
                                                float, osc_start_validator)

        osc_range_ledit = self.acq_widget_layout.child('osc_range_ledit')
        self._acquisition_mib.bind_value_update('osc_range', osc_range_ledit,
                                                float, osc_range_validator)

        if 'exposure_time' in limits_dict:
            limits = tuple(map(float, limits_dict['exposure_time'].split(',')))
            (lower, upper) = limits
            exp_time_valdidator = qt.QDoubleValidator(lower, upper, 5, self)
        else:
            exp_time_valdidator = qt.QDoubleValidator(-0.003, 6000, 5, self)

        exp_time_ledit = self.acq_widget_layout.child('exp_time_ledit')
        self._acquisition_mib.bind_value_update('exp_time', exp_time_ledit,
                                                float, exp_time_valdidator)

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
                           qt.SIGNAL("toggled(bool)"),
                           self.osc_start_cbox_click)

        te = beamline_setup.tunable_wavelength()
        self.set_tunable_energy(te)

        has_aperture = self._beamline_setup.has_aperture()
        self.hide_aperture(has_aperture)
    def __init__(self,parent,name,uifile = 'LookupScan.ui',cmd_name = 'ltscan',**kwargs) :
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, cmd_name=cmd_name, **kwargs)
        self._graphicSelection = None
        self.__polyNb = 0
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self._ltinit = None
        
        self.addProperty('offsetmeasure','float',1e3)
        
        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        # PopUp Menu
        self.__polygonListWidget = self._widgetTree.child('__polygonList')
        self.__polygonListWidget.setSelectionMode(qt.QListView.Extended)

        self.__polygonPopUpMenu = qt.QPopupMenu(self.__polygonListWidget)
        for itemName,cbk in [('Create new',self.__createPolygon),
                             ('Remove',self.__removeSelectedPolygon),
                             ('Revert selection',self.__revertSelectedPolygon)] :
            self.__polygonPopUpMenu.insertItem(itemName,cbk)

        self.connect(self.__polygonListWidget,qt.SIGNAL('rightButtonPressed(QListViewItem*,const QPoint &,int)'),
                     self.__polygonPopUpDisplay)

        timeWidget = self._widgetTree.child('__time')
        self.connect(timeWidget,qt.SIGNAL('returnPressed()'),self.__refreshInfoText)
        self.connect(timeWidget,qt.SIGNAL('lostFocus()'),self.__refreshInfoText)
Example #3
0
    def __init__(self, brick, widgetTree, xoryMotor, zMotor, rMotor,
                 tableyMotor, tablezMotor, table_y_inverted, table_z_inverted):
        self.__brick = brick
        self.__zMotor, self.__xoryMotor, self.__rotationMotor = zMotor, xoryMotor, rMotor
        self.__widgetTree = widgetTree
        self.endAlignementFlag = False
        self.alignementProcedureOff = True
        self.hLines = []
        self.motorReadyFlag = False
        self.bx = None
        self.by = None
        self.__tableYMotor = tableyMotor
        self.__tableZMotor = tablezMotor
        self.table_y_inverted = table_y_inverted
        self.table_z_inverted = table_z_inverted

        alignementTable = self.__widgetTree.child('alignementTable')
        header = alignementTable.horizontalHeader()
        header.setLabel(0, rMotor.userName())

        phiStepLineEditor = self.__widgetTree.child('__deltaPhiCalib')
        phiStepLineEditor.setValidator(qt.QDoubleValidator(self.__widgetTree))

        ####### ALIGNMENT TYPE #######
        self.nbPoint4Alignement = 3
        self.alignementProcessState = _cancelAlignementProcess(
            self, self.__widgetTree)

        self.__centerRotation = None
        self.__helpLines = []

        ####### QT SIGNAL #######
        startAlignementButton = self.__widgetTree.child('__startAlignement')
        qt.QObject.connect(startAlignementButton, qt.SIGNAL('clicked()'),
                           self.__startAlignement)

        cancelAlignementButton = self.__widgetTree.child('__cancelAlignement')
        qt.QObject.connect(cancelAlignementButton, qt.SIGNAL('clicked()'),
                           self.__cancelAlignementButton)

        showCenter = self.__widgetTree.child('__showCenter')
        qt.QObject.connect(showCenter, qt.SIGNAL('toggled(bool)'),
                           self.__showCenter)

        showHelpLines = self.__widgetTree.child('__helpLines')
        qt.QObject.connect(showHelpLines, qt.SIGNAL('toggled(bool)'),
                           self.__showHelpLines)

        ####### BRICK CONNECTION #######
        self.__brick.connect(self.__rotationMotor, qt.PYSIGNAL("stateChanged"),
                             self.__updateMotorState)
Example #4
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.addProperty("mnemonic", "string", "")
        self.addProperty("icons", "string", "")
        self.addProperty("formatString", "formatString", "###.##")

        self.beamstop_hwobj = None

        self.top_gbox = qt.QHGroupBox("Beamstop distance", self)
        self.top_gbox.setInsideMargin(4)
        self.top_gbox.setInsideSpacing(2)

        self.params_widget = qt.QWidget(self.top_gbox)
        qt.QGridLayout(self.params_widget, 2, 3, 0, 2)

        label1 = qt.QLabel("Current:", self.params_widget)
        label1.setFixedWidth(70)
        self.params_widget.layout().addWidget(label1, 0, 0)

        self.current_position_ledit = qt.QLineEdit(self.params_widget)
        self.current_position_ledit.setReadOnly(True)
        self.params_widget.layout().addWidget(self.current_position_ledit, 0,
                                              1)

        label2 = qt.QLabel("Set to:", self.params_widget)
        label2.setFixedWidth(70)
        self.params_widget.layout().addWidget(label2, 1, 0)

        self.new_position_ledit = qt.QLineEdit(self.params_widget)
        self.new_position_ledit.setAlignment(qt.QWidget.AlignRight)
        self.params_widget.layout().addWidget(self.new_position_ledit, 1, 1)
        self.new_position_ledit.setValidator(qt.QDoubleValidator(self))
        self.new_position_ledit.setPaletteBackgroundColor(
            BeamstopDistanceBrick.CONNECTED_COLOR)

        qt.QObject.connect(self.new_position_ledit,
                           qt.SIGNAL("returnPressed()"), self.change_position)
        qt.QObject.connect(
            self.new_position_ledit,
            qt.SIGNAL("textChanged(const QString &)"),
            self.input_field_changed,
        )

        self.instanceSynchronize("new_position_ledit")

        qt.QVBoxLayout(self)
        self.layout().addWidget(self.top_gbox)
Example #5
0
    def __init__(self, parent, name, **kwargs):
        BaseGraphicScan.__init__(self,
                                 parent,
                                 name,
                                 uifile='A2Scan.ui',
                                 cmd_name='a2scan',
                                 **kwargs)
        self.__points = []
        ####### INIT GUI #######
        aTable = self._widgetTree.child('__table')
        qt.QObject.connect(aTable, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)
        aTable.setColumnReadOnly(4, True)

        intervals = self._widgetTree.child('__intervals')
        intervals.setValidator(qt.QIntValidator(intervals))
        qt.QObject.connect(intervals, qt.SIGNAL('returnPressed ()'),
                           self.__intervalsChanged)
        qt.QObject.connect(intervals, qt.SIGNAL('lostFocus()'),
                           self.__intervalsChanged)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
Example #6
0
 def __init__(self, parent, options):
     qt.QSpinBox.__init__(self, parent)
     self.decimalPlaces = 1
     self.colorGroupDict = {}
     self.setValidator(qt.QDoubleValidator(self))
     self.editor().setAlignment(qt.QWidget.AlignLeft)
     qt.QObject.connect(self.editor(),
                        qt.SIGNAL('textChanged(const QString &)'),
                        self.inputFieldChanged)
     self.__name = options['variableName']
     if options.has_key('unit'):
         qt.QSpinBox.setSuffix(self, ' ' + options['unit'])
     if options.has_key('defaultValue'):
         val = float(options['defaultValue'])
         self.setValue(int(val * float(10**self.decimalPlaces)))
     if options.has_key('upperBound'):
         self.setMaxValue(float(options['upperBound']))
     else:
         qt.QSpinBox.setMaxValue(self, sys.maxint)
     if options.has_key('lowerBound'):
         self.setMinValue(float(options['lowerBound']))
     if options.has_key('tooltip'):
         qt.QToolTip.add(self, options['tooltip'])
Example #7
0
    def __init__(self, parent, name, uifile='MxLookupScan.ui', **kwargs):
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, **kwargs)
        self._graphicSelection = None
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self.old_mot1_pos = None
        self.old_mot2_pos = None
        self._shape_history = None

        self.addProperty('offsetmeasure', 'float', 1e3)
        self.defineSignal("addToQueue", ())
        self.defineSignal('clearQueue', ())
        self.defineSignal("dataCollectParametersRequest", ())
        self.defineSignal("goToCollect", ())

        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        timeWidget = self._widgetTree.child('__time')
        timeWidget.hide()
Example #8
0
    def set_beamline_setup(self, beamline_setup):
        self._beamline_setup = beamline_setup

        limits_dict = self._beamline_setup.get_acquisition_limit_values()

        if "osc_range" in limits_dict:
            limits = tuple(map(float, limits_dict["osc_range"].split(",")))
            (lower, upper) = limits
            osc_start_validator = qt.QDoubleValidator(lower, upper, 4, self)
            osc_range_validator = qt.QDoubleValidator(lower, upper, 4, self)
        else:
            osc_start_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
            osc_range_validator = qt.QDoubleValidator(-10000, 10000, 4, self)

        osc_start_ledit = self.acq_widget_layout.child("osc_start_ledit")
        self._acquisition_mib.bind_value_update(
            "osc_start", osc_start_ledit, float, osc_start_validator
        )

        osc_range_ledit = self.acq_widget_layout.child("osc_range_ledit")
        self._acquisition_mib.bind_value_update(
            "osc_range", osc_range_ledit, float, osc_range_validator
        )

        kappa_validator = qt.QDoubleValidator(0, 360, 2, self)
        kappa_ledit = self.acq_widget_layout.child("kappa_ledit")
        self._acquisition_mib.bind_value_update(
            "kappa", kappa_ledit, float, kappa_validator
        )

        kappa_phi_validator = qt.QDoubleValidator(0, 360, 2, self)
        kappa_phi_ledit = self.acq_widget_layout.child("kappa_phi_ledit")
        self._acquisition_mib.bind_value_update(
            "kappa_phi", kappa_phi_ledit, float, kappa_phi_validator
        )

        if "exposure_time" in limits_dict:
            limits = tuple(map(float, limits_dict["exposure_time"].split(",")))
            (lower, upper) = limits
            exp_time_valdidator = qt.QDoubleValidator(lower, upper, 5, self)
        else:
            exp_time_valdidator = qt.QDoubleValidator(-0.003, 6000, 5, self)

        exp_time_ledit = self.acq_widget_layout.child("exp_time_ledit")
        self._acquisition_mib.bind_value_update(
            "exp_time", exp_time_ledit, float, exp_time_valdidator
        )

        if "number_of_images" in limits_dict:
            limits = tuple(map(int, limits_dict["number_of_images"].split(",")))
            (lower, upper) = limits
            num_img_valdidator = qt.QIntValidator(lower, upper, self)
            first_img_valdidator = qt.QIntValidator(lower, upper, self)
        else:
            num_img_valdidator = qt.QIntValidator(1, 9999, self)
            first_img_valdidator = qt.QIntValidator(1, 9999, self)

        first_img_ledit = self.acq_widget_layout.child("first_image_ledit")
        self._acquisition_mib.bind_value_update(
            "first_image", first_img_ledit, int, first_img_valdidator
        )

        num_img_ledit = self.acq_widget_layout.child("num_images_ledit")
        self._acquisition_mib.bind_value_update(
            "num_images", num_img_ledit, int, num_img_valdidator
        )

        num_passes = self.acq_widget_layout.child("num_passes_ledit")

        if num_passes:
            self._acquisition_mib.bind_value_update(
                "num_passes", num_passes, int, qt.QIntValidator(1, 1000, self)
            )

        overlap_ledit = self.acq_widget_layout.child("overlap_ledit")

        if overlap_ledit:
            self._acquisition_mib.bind_value_update(
                "overlap",
                overlap_ledit,
                float,
                qt.QDoubleValidator(-1000, 1000, 2, self),
            )

        self._acquisition_mib.bind_value_update(
            "energy",
            self.acq_widget_layout.child("energy_ledit"),
            float,
            qt.QDoubleValidator(0, 1000, 4, self),
        )

        self._acquisition_mib.bind_value_update(
            "transmission",
            self.acq_widget_layout.child("transmission_ledit"),
            float,
            qt.QDoubleValidator(0, 1000, 2, self),
        )

        self._acquisition_mib.bind_value_update(
            "resolution",
            self.acq_widget_layout.child("resolution_ledit"),
            float,
            qt.QDoubleValidator(0, 1000, 3, self),
        )

        self._acquisition_mib.bind_value_update(
            "inverse_beam", self.acq_widget_layout.child("inverse_beam_cbx"), bool, None
        )

        self._acquisition_mib.bind_value_update(
            "shutterless", self.acq_widget_layout.child("shutterless_cbx"), bool, None
        )

        te = beamline_setup.tunable_wavelength()
        self.set_tunable_energy(te)

        has_shutter_less = self._beamline_setup.detector_has_shutterless()
        self.acq_widget_layout.child("shutterless_cbx").setEnabled(has_shutter_less)
        self.acq_widget_layout.child("shutterless_cbx").setChecked(has_shutter_less)

        if self._beamline_setup.disable_num_passes():
            num_passes = self.acq_widget_layout.child("num_passes_ledit")
            if num_passes:
                self.acq_widget_layout.child("num_passes_ledit").setDisabled(True)

        has_aperture = self._beamline_setup.has_aperture()
        self.hide_aperture(has_aperture)
Example #9
0
    def set_beamline_setup(self, beamline_setup):
        self._beamline_setup = beamline_setup

        limits_dict = self._beamline_setup.get_acquisition_limit_values()

        if 'osc_range' in limits_dict:
            limits = tuple(map(float, limits_dict['osc_range'].split(',')))
            (lower, upper) = limits
            osc_start_validator = qt.QDoubleValidator(lower, upper, 4, self)
            osc_range_validator = qt.QDoubleValidator(lower, upper, 4, self)
        else:
            osc_start_validator = qt.QDoubleValidator(-10000, 10000, 4, self)
            osc_range_validator = qt.QDoubleValidator(-10000, 10000, 4, self)

        osc_start_ledit = self.acq_widget_layout.child('osc_start_ledit')
        self._acquisition_mib.bind_value_update('osc_start', osc_start_ledit,
                                                float, osc_start_validator)

        osc_range_ledit = self.acq_widget_layout.child('osc_range_ledit')
        self._acquisition_mib.bind_value_update('osc_range', osc_range_ledit,
                                                float, osc_range_validator)

        kappa_validator = qt.QDoubleValidator(0, 360, 2, self)
        kappa_ledit = self.acq_widget_layout.child('kappa_ledit')
        self._acquisition_mib.bind_value_update('kappa', kappa_ledit, float,
                                                kappa_validator)

        kappa_phi_validator = qt.QDoubleValidator(0, 360, 2, self)
        kappa_phi_ledit = self.acq_widget_layout.child('kappa_phi_ledit')
        self._acquisition_mib.bind_value_update('kappa_phi', kappa_phi_ledit,
                                                float, kappa_phi_validator)

        if 'exposure_time' in limits_dict:
            limits = tuple(map(float, limits_dict['exposure_time'].split(',')))
            (lower, upper) = limits
            exp_time_valdidator = qt.QDoubleValidator(lower, upper, 5, self)
        else:
            exp_time_valdidator = qt.QDoubleValidator(-0.003, 6000, 5, self)

        exp_time_ledit = self.acq_widget_layout.child('exp_time_ledit')
        self._acquisition_mib.bind_value_update('exp_time', exp_time_ledit,
                                                float, exp_time_valdidator)

        if 'number_of_images' in limits_dict:
            limits = tuple(map(int,
                               limits_dict['number_of_images'].split(',')))
            (lower, upper) = limits
            num_img_valdidator = qt.QIntValidator(lower, upper, self)
            first_img_valdidator = qt.QIntValidator(lower, upper, self)
        else:
            num_img_valdidator = qt.QIntValidator(1, 9999, self)
            first_img_valdidator = qt.QIntValidator(1, 9999, self)

        first_img_ledit = self.acq_widget_layout.child('first_image_ledit')
        self._acquisition_mib.bind_value_update('first_image', first_img_ledit,
                                                int, first_img_valdidator)

        num_img_ledit = self.acq_widget_layout.child('num_images_ledit')
        self._acquisition_mib.bind_value_update('num_images', num_img_ledit,
                                                int, num_img_valdidator)

        num_passes = self.acq_widget_layout.child('num_passes_ledit')

        if num_passes:
            self._acquisition_mib.\
                bind_value_update('num_passes', num_passes, int,
                                  qt.QIntValidator(1, 1000, self))

        overlap_ledit = self.acq_widget_layout.child('overlap_ledit')

        if overlap_ledit:
            self._acquisition_mib.\
                bind_value_update('overlap', overlap_ledit, float,
                                  qt.QDoubleValidator(-1000, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        self._acquisition_mib.\
             bind_value_update('inverse_beam',
                               self.acq_widget_layout.child('inverse_beam_cbx'),
                               bool,
                               None)

        self._acquisition_mib.\
             bind_value_update('shutterless',
                               self.acq_widget_layout.child('shutterless_cbx'),
                               bool,
                               None)

        te = beamline_setup.tunable_wavelength()
        self.set_tunable_energy(te)

        has_shutter_less = self._beamline_setup.detector_has_shutterless()
        self.acq_widget_layout.child('shutterless_cbx').\
             setEnabled(has_shutter_less)
        self.acq_widget_layout.child('shutterless_cbx').setChecked(
            has_shutter_less)

        if self._beamline_setup.disable_num_passes():
            num_passes = self.acq_widget_layout.child('num_passes_ledit')
            if num_passes:
                self.acq_widget_layout.child('num_passes_ledit').setDisabled(
                    True)

        has_aperture = self._beamline_setup.has_aperture()
        self.hide_aperture(has_aperture)
Example #10
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.diffractometer_hwobj = None

        self.addProperty("mnemonic", "string", "")
        self.addProperty("label", "string", "")
        self.addProperty("showLabel", "boolean", True)
        self.addProperty("showBox", "boolean", True)
        self.addProperty("showStop", "boolean", True)
        self.addProperty("showPosition", "boolean", True)
        self.addProperty("icons", "string", "")

        self.container_hbox = qt.QHGroupBox(self)
        self.container_hbox.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed)

        self.label_hbox = qt.QHBox(self.container_hbox)
        self.motor_hbox = qt.QHBox(self.container_hbox)

        self.label = qt.QLabel(self.label_hbox)

        self.kappa_value_edit = qt.QLineEdit(self.motor_hbox)
        self.kappa_value_edit.setFixedSize(qt.QSize(55, 25))
        self.kappa_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self))
        self.kappa_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN)
        self.kappa_value_edit.setAlignment(qt.QWidget.AlignRight)
        self.phi_value_edit = qt.QLineEdit(self.motor_hbox)
        self.phi_value_edit.setFixedSize(qt.QSize(55, 25))
        self.phi_value_edit.setValidator(qt.QDoubleValidator(0, 180, 2, self))
        self.phi_value_edit.setPaletteBackgroundColor(widget_colors.LIGHT_GREEN)
        self.phi_value_edit.setAlignment(qt.QWidget.AlignRight)

        self.move_motors_button = qt.QPushButton("Apply", self.motor_hbox)
        self.stop_motors_button = qt.QPushButton(self.motor_hbox)
        self.stop_motors_button.setPixmap(Icons.load("stop_small"))
        self.stop_motors_button.setEnabled(False)

        self.connect(
            self.kappa_value_edit,
            qt.SIGNAL("textChanged(const QString &)"),
            self.kappa_edit_input_changed,
        )
        self.connect(
            self.phi_value_edit,
            qt.SIGNAL("textChanged(const QString &)"),
            self.phi_edit_input_changed,
        )
        self.connect(
            self.move_motors_button,
            qt.SIGNAL("clicked()"),
            self.move_motors_button_clicked,
        )
        self.connect(
            self.stop_motors_button,
            qt.SIGNAL("clicked()"),
            self.stop_motors_button_clicked,
        )

        self.stop_motors_button.setSizePolicy(
            qt.QSizePolicy.Fixed, qt.QSizePolicy.Minimum
        )
        self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed)
        qt.QVBoxLayout(self)
        self.layout().addWidget(self.container_hbox)
Example #11
0
    def __init__(self, parent=None, name=None, fl=0, acq_params=None,
                 path_template=None, layout='horizontal'):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        self._beamline_setup = None
        self.previous_energy = 0

        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.\
                                           AcquisitionParameters()
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(self._acquisition_parameters)
        #self._path_template_mib = DataModelInputBinder(self._path_template)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        if layout == 'vertical':
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_vertical_layout.ui'))
        elif layout == 'horizontal':
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_horizontal_layout.ui'))

            widget.child('inverse_beam_cbx').hide()
            widget.child('subwedge_size_label').hide()
            widget.child('subwedge_size_ledit').hide()
        else:
            widget = qtui.QWidgetFactory.\
                     create(os.path.join(os.path.dirname(__file__),
                                         'ui_files/acquisition_widget_vertical_layout.ui'))

        widget.reparent(self, qt.QPoint(0, 0))
        self.acq_widget_layout = widget
        h_layout.addWidget(self.acq_widget_layout)

        #
        # Logic
        #
        self._acquisition_mib.\
             bind_value_update('osc_start',
                               self.acq_widget_layout.child('osc_start_ledit'),
                               float,
                               qt.QDoubleValidator(-10000, 10000, 2, self))

        self._acquisition_mib.\
             bind_value_update('first_image',
                              self.acq_widget_layout.child('first_image_ledit'),
                              int,
                              qt.QIntValidator(1, 9999, self))

        self._acquisition_mib.\
             bind_value_update('exp_time',
                               self.acq_widget_layout.child('exp_time_ledit'),
                               float,
                               qt.QDoubleValidator(0.003, 6000, 3, self))

        self._acquisition_mib.\
             bind_value_update('osc_range',
                               self.acq_widget_layout.child('osc_range_ledit'),
                               float,
                               qt.QDoubleValidator(0.001, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('num_images',
                               self.acq_widget_layout.child('num_images_ledit'),
                               int,
                               qt.QIntValidator(1, 9999, self))

        self._acquisition_mib.\
             bind_value_update('num_passes',
                               self.acq_widget_layout.child('num_passes_ledit'),
                               int,
                               qt.QIntValidator(1, 1000, self))

        self._acquisition_mib.\
             bind_value_update('overlap',
                               self.acq_widget_layout.child('overlap_ledit'),
                               float,
                               qt.QDoubleValidator(-1000, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        self._acquisition_mib.\
             bind_value_update('inverse_beam',
                               self.acq_widget_layout.child('inverse_beam_cbx'),
                               bool,
                               None)

        self._acquisition_mib.\
             bind_value_update('shutterless',
                               self.acq_widget_layout.child('shutterless_cbx'),
                               bool,
                               None)

        qt.QObject.connect(self.acq_widget_layout.child('energies_combo'),
                        qt.SIGNAL("activated(int)"),
                        self.energy_selected)

        qt.QObject.connect(self.acq_widget_layout.child('mad_cbox'),
                        qt.SIGNAL("toggled(bool)"),
                        self.use_mad)

        qt.QObject.connect(self.acq_widget_layout.child('inverse_beam_cbx'),
                           qt.SIGNAL("toggled(bool)"),
                           self.set_use_inverse_beam)

        qt.QObject.connect(self.acq_widget_layout.child('first_image_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.first_image_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('num_images_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.num_images_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('overlap_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.overlap_changed)

        qt.QObject.connect(self.acq_widget_layout.child('subwedge_size_ledit'),
                           qt.SIGNAL("textChanged(const QString &)"),
                           self.subwedge_size_ledit_change)

        qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
                           qt.SIGNAL("toggled(bool)"),
                           self.osc_start_cbox_click)

        self.acq_widget_layout.child('subwedge_size_ledit').setDisabled(True)
        self.acq_widget_layout.child('energies_combo').setDisabled(True)
        self.acq_widget_layout.child('energies_combo').\
            insertStrList(['ip: -', 'pk: -', 'rm1: -', 'rm2: -'])

        self.acq_widget_layout.child('osc_start_ledit').setEnabled(False)
Example #12
0
    def __init__(self, parent=None, name="parameter_widget"):
        qt.QWidget.__init__(self, parent, name)

        #
        # Private members
        #
        self._char = None
        self._char_params = queue_model_objects.CharacterisationParameters()
        self._char_params_mib = DataModelInputBinder(self._char_params)
        self._tree_view_item = None
        self.previous_energy = None

        self.add_dc_cb = None

        self.char_type_widget = CharTypeWidget(self)
        self.routine_dc_widget = self.char_type_widget.routine_dc_page
        self.sad_widget = self.char_type_widget.sad_page
        self.rad_dmg_char_widget = self.char_type_widget.rad_damage_page
        self.reference_img_widget = ReferenceImageWidget(self)
        self.acq_widget = self.reference_img_widget.acq_widget
        self.path_widget = self.reference_img_widget.path_widget
        self.opt_parameters_widget = OptimisationParametersWidgetLayout(self)
        self.rad_dmg_widget = RadiationDamageModelWidgetLayout(self)
        self.position_widget = SnapshotWidgetLayout(self)
        self.vertical_dimension_widget = VerticalCrystalDimensionWidgetLayout(
            self)

        # Fix the widths of the widgets to make the layout look nicer,
        # and beacuse the qt layout engine is so tremendosly good.
        self.opt_parameters_widget.setFixedWidth(600)
        self.reference_img_widget.setFixedWidth(772)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 11, 15, "main_layout")
        rone_hlayout = qt.QHBoxLayout(v_layout, 15, "rone")
        rone_cone_vlayout = qt.QVBoxLayout(rone_hlayout, 15, "rone_cone")
        rtwo_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")
        rthree_hlayout = qt.QHBoxLayout(v_layout, 15, "rtwo")

        rone_hlayout.addWidget(self.position_widget)
        rone_cone_vlayout.addWidget(self.reference_img_widget)
        rone_hlayout.addStretch()

        rtwo_hlayout.addWidget(self.char_type_widget)
        rtwo_hlayout.addWidget(self.opt_parameters_widget)
        rtwo_hlayout.addStretch(10)
        v_layout.addStretch(10)

        rthree_hlayout.addWidget(self.rad_dmg_widget)
        rthree_hlayout.addWidget(self.vertical_dimension_widget)
        rthree_hlayout.addStretch(10)
        v_layout.addStretch(10)

        #
        # Widget logic
        #
        self.toggle_permitted_range(self.\
            opt_parameters_widget.permitted_range_cbx.isOn())
        qt.QObject.connect(self.opt_parameters_widget.permitted_range_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.toggle_permitted_range)

        self._char_params_mib.bind_value_update(
            'min_dose', self.routine_dc_widget.dose_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_time', self.routine_dc_widget.time_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'use_min_dose', self.routine_dc_widget.min_dose_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'use_min_time', self.routine_dc_widget.min_time_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'account_rad_damage', self.routine_dc_widget.radiation_damage_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'auto_res', self.sad_widget.automatic_resolution_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'opt_sad', self.sad_widget.optimal_sad_radio, bool, None)

        self._char_params_mib.bind_value_update(
            'determine_rad_params', self.rad_dmg_char_widget.rad_damage_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'burn_osc_start', self.rad_dmg_char_widget.burn_osc_start_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'burn_osc_interval',
            self.rad_dmg_char_widget.burn_osc_interval_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'use_aimed_resolution', self.opt_parameters_widget.maximum_res_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'use_aimed_multiplicity',
            self.opt_parameters_widget.aimed_mult_cbx, bool, None)

        self._char_params_mib.bind_value_update(
            'aimed_resolution', self.opt_parameters_widget.maximum_res_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_multiplicity', self.opt_parameters_widget.aimed_mult_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_i_sigma', self.opt_parameters_widget.i_over_sigma_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'aimed_completness', self.opt_parameters_widget.aimed_comp_ledit,
            float, qt.QDoubleValidator(0.01, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'strategy_complexity', self.opt_parameters_widget.start_comp_cbox,
            int, None)

        self._char_params_mib.bind_value_update(
            'use_permitted_rotation',
            self.opt_parameters_widget.permitted_range_cbx, bool, None)

        self._char_params_mib.bind_value_update(
            'permitted_phi_start', self.opt_parameters_widget.phi_start_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'permitted_phi_end', self.opt_parameters_widget.phi_end_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'low_res_pass_strat', self.opt_parameters_widget.low_res_pass_cbx,
            bool, None)

        self._char_params_mib.bind_value_update(
            'rad_suscept', self.rad_dmg_widget.sensetivity_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'beta', self.rad_dmg_widget.beta_over_gray_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'gamma', self.rad_dmg_widget.gamma_over_gray_ledit, float,
            qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'max_crystal_vdim', self.vertical_dimension_widget.max_vdim_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_crystal_vdim', self.vertical_dimension_widget.min_vdim_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'min_crystal_vphi', self.vertical_dimension_widget.min_vphi_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.bind_value_update(
            'max_crystal_vphi', self.vertical_dimension_widget.max_vphi_ledit,
            float, qt.QDoubleValidator(0.0, 1000, 2, self))

        #self._char_params_mib.bind_value_update('space_group',
        #                                        self.vertical_dimension_widget.space_group_ledit,
        #                                        str,
        #                                        None)


        self.vertical_dimension_widget.space_group_ledit.\
            insertStrList(queue_model_enumerables.XTAL_SPACEGROUPS)

        qt.QObject.connect(self.char_type_widget.charact_type_tbox,
                           qt.SIGNAL("currentChanged(int)"),
                           self.update_char_type)

        qt.QObject.connect(self.rad_dmg_char_widget.rad_damage_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_opt_parameters_widget)

        qt.QObject.connect(self.opt_parameters_widget.maximum_res_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_maximum_res_ledit)

        qt.QObject.connect(self.opt_parameters_widget.aimed_mult_cbx,
                           qt.SIGNAL("toggled(bool)"),
                           self.enable_aimed_mult_ledit)

        qt.QObject.connect(
            self.path_widget.data_path_widget_layout.child('prefix_ledit'),
            qt.SIGNAL("textChanged(const QString &)"),
            self._prefix_ledit_change)

        qt.QObject.connect(
            self.path_widget.data_path_widget_layout.child('run_number_ledit'),
            qt.SIGNAL("textChanged(const QString &)"),
            self._run_number_ledit_change)

        qt.QObject.connect(self.vertical_dimension_widget.space_group_ledit,
                           qt.SIGNAL("activated(int)"),
                           self._space_group_change)

        qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'),
                           self.tab_changed)
    def __init__(self,
                 parent=None,
                 name=None,
                 fl=0,
                 acq_params=None,
                 path_template=None,
                 layout=None):
        qt.QWidget.__init__(self, parent, name, fl)

        #
        # Attributes
        #
        if acq_params is None:
            self._acquisition_parameters = queue_model_objects.AcquisitionParameters(
            )
        else:
            self._acquisition_parameters = acq_params

        if path_template is None:
            self._path_template = queue_model_objects.PathTemplate()
        else:
            self._path_template = path_template

        self._acquisition_mib = DataModelInputBinder(
            self._acquisition_parameters)

        #
        # Layout
        #
        h_layout = qt.QHBoxLayout(self)

        current_dir = os.path.dirname(__file__)
        ui_file = 'ui_files/acquisition_widget_vertical_simple_layout.ui'
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0, 0))
        h_layout.addWidget(widget)

        self.acq_widget_layout = widget

        #
        # Logic
        #
        self._acquisition_mib.\
          bind_value_update('exp_time',
                            self.acq_widget_layout.child('exp_time_ledit'),
                            float,
                            qt.QDoubleValidator(0.001, 6000, 3, self))

        self._acquisition_mib.\
          bind_value_update('osc_range',
                            self.acq_widget_layout.child('osc_range_ledit'),
                            float,
                            qt.QDoubleValidator(0.001, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('osc_start',
                               self.acq_widget_layout.child('osc_start_ledit'),
                               float,
                               qt.QDoubleValidator(-1000, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('energy',
                               self.acq_widget_layout.child('energy_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 4, self))

        self._acquisition_mib.\
             bind_value_update('transmission',
                            self.acq_widget_layout.child('transmission_ledit'),
                            float,
                            qt.QDoubleValidator(0, 1000, 2, self))

        self._acquisition_mib.\
             bind_value_update('resolution',
                               self.acq_widget_layout.child('resolution_ledit'),
                               float,
                               qt.QDoubleValidator(0, 1000, 3, self))

        qt.QObject.connect(self.acq_widget_layout.child('osc_start_cbox'),
                           qt.SIGNAL("toggled(bool)"),
                           self.osc_start_cbox_click)

        self.acq_widget_layout.child('osc_start_ledit').setEnabled(False)

        # Default to 2-images
        self.acq_widget_layout.child('num_images_cbox').setCurrentItem(1)

        qt.QObject.connect(self.acq_widget_layout.child('num_images_cbox'),
                           qt.SIGNAL("activated(int)"), self.update_num_images)
Example #14
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Characterisation')

        if not name:
            self.setName("create_char_widget")

        #
        # Data attributes
        #
        self._current_selected_item = None
        self.init_models()
        self._char_params_mib = DataModelInputBinder(self._char_params)

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 6, "v_layout")

        self._acq_widget = \
            AcquisitionWidgetSimple(self, acq_params = self._acquisition_parameters,
                                    path_template = self._path_template)
        #self._acq_widget.setFixedHeight(170)

        current_dir = os.path.dirname(__file__)
        ui_file = 'ui_files/vertical_crystal_dimension_widget_layout.ui'
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._vertical_dimension_widget = widget

        ui_file = 'ui_files/characterise_simple_widget_vertical_layout.ui'
        widget = qtui.QWidgetFactory.\
                 create(os.path.join(current_dir, ui_file))

        widget.reparent(self, qt.QPoint(0, 0))
        self._char_widget = widget

        self._data_path_gbox = \
            qt.QVGroupBox('Data location', self, 'data_path_gbox')

        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           data_model = self._path_template,
                           layout = 'vertical')

        v_layout.addWidget(self._acq_widget)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._char_widget)
        v_layout.addWidget(self._vertical_dimension_widget)
        v_layout.addStretch(100)

        #
        # Logic
        #
        optimised_sad_cbx = self._char_widget.\
                            child('optimised_sad_cbx')
        account_rad_dmg_cbx = self._char_widget.\
                              child('account_rad_dmg_cbx')
        start_comp_cbox = self._char_widget.child('start_comp_cbox')
        #induced_burn_cbx = self._char_widget.child('induced_burn_cbx')
        max_vdim_ledit = self._vertical_dimension_widget.\
                         child('max_vdim_ledit')
        min_vdim_ledit = self._vertical_dimension_widget.\
                         child('min_vdim_ledit')

        min_vphi_ledit = self._vertical_dimension_widget.\
                         child('min_vphi_ledit')

        max_vphi_ledit = self._vertical_dimension_widget.\
                         child('max_vphi_ledit')

        space_group_ledit = self._vertical_dimension_widget.\
                            child('space_group_ledit')

        self._char_params_mib.bind_value_update('opt_sad', optimised_sad_cbx,
                                                bool, None)

        self._char_params_mib.bind_value_update('account_rad_damage',
                                                account_rad_dmg_cbx, bool,
                                                None)

        #self._char_params_mib.bind_value_update('determine_rad_params',
        #                                        induced_burn_cbx,
        #                                        bool, None)

        self._char_params_mib.bind_value_update('strategy_complexity',
                                                start_comp_cbox, int, None)

        self._char_params_mib.\
            bind_value_update('max_crystal_vdim',
                              max_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vdim',
                              min_vdim_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('min_crystal_vphi',
                              min_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        self._char_params_mib.\
            bind_value_update('max_crystal_vphi',
                              max_vphi_ledit, float,
                              qt.QDoubleValidator(0.0, 1000, 2, self))

        space_group_ledit.insertStrList(XTAL_SPACEGROUPS)

        prefix_ledit = self._data_path_widget.\
                       data_path_widget_layout.child('prefix_ledit')

        run_number_ledit = self._data_path_widget.\
                           data_path_widget_layout.child('run_number_ledit')

        self.connect(prefix_ledit, qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(run_number_ledit,
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(space_group_ledit, qt.SIGNAL("activated(int)"),
                     self._space_group_change)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Example #15
0
    def setup(self):
        self.measurementsLogic = PETPhantomAnalysisLogic()

        ScriptedLoadableModuleWidget.setup(self)

        # Instantiate and connect widgets ...

        #
        # Parameters Area
        #
        parametersCollapsibleButton = ctk.ctkCollapsibleButton()
        parametersCollapsibleButton.text = "PET Cylinder Phantom Analysis"
        self.layout.addWidget(parametersCollapsibleButton)
        parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

        #
        # input volume selector
        #
        self.inputSelector = slicer.qMRMLNodeComboBox()
        self.inputSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"]
        #self.inputSelector.addAttribute("vtkMRMLScalarVolumeNode", "DICOM.instanceUIDs", None) # add this to restrict to dicom datasets
        self.inputSelector.selectNodeUponCreation = True
        self.inputSelector.addEnabled = False
        self.inputSelector.removeEnabled = False
        self.inputSelector.noneEnabled = False
        self.inputSelector.showHidden = False
        self.inputSelector.showChildNodeTypes = False
        self.inputSelector.setMRMLScene(slicer.mrmlScene)
        self.inputSelector.setToolTip(
            "Input SUVbw normalized DICOM PET volume")
        self.inputSelector.connect("currentNodeChanged(bool)",
                                   self.refreshUIElements)
        self.inputSelector.connect("currentNodeChanged(bool)",
                                   self.inputVolumeSelected)
        parametersFormLayout.addRow("Input Volume", self.inputSelector)

        self.normalizationFactorLineEdit = qt.QLineEdit("1.0")
        self.normalizationFactorValidator = qt.QDoubleValidator()
        self.normalizationFactorValidator.bottom = 0.0
        self.normalizationFactorLineEdit.setValidator(
            self.normalizationFactorValidator)
        self.normalizationFactorLineEdit.setToolTip(
            "Normalization factor for input dataset")
        self.normalizationFactorLineEdit.connect("textChanged(QString)",
                                                 self.refreshUIElements)
        parametersFormLayout.addRow("Normalization Factor",
                                    self.normalizationFactorLineEdit)

        self.segmentationSelector = slicer.qMRMLNodeComboBox()
        self.segmentationSelector.nodeTypes = ["vtkMRMLLabelMapVolumeNode"]
        self.segmentationSelector.selectNodeUponCreation = True
        self.segmentationSelector.addEnabled = True
        self.segmentationSelector.removeEnabled = True
        self.segmentationSelector.noneEnabled = False
        self.segmentationSelector.showHidden = False
        self.segmentationSelector.showChildNodeTypes = False
        self.segmentationSelector.setMRMLScene(slicer.mrmlScene)
        self.segmentationSelector.setToolTip(
            "Output cylinder reference region volume")
        self.segmentationSelector.connect("currentNodeChanged(bool)",
                                          self.refreshUIElements)
        parametersFormLayout.addRow("Output Volume", self.segmentationSelector)

        self.segmentButton = qt.QPushButton("Analyze cylinder phantom")
        self.segmentButton.toolTip = "Analyze cylinder phantom and show results"
        self.segmentButton.connect('clicked(bool)', self.onApplyButton)
        parametersFormLayout.addRow("Analysis", self.segmentButton)

        # Normalization form
        normalizationCollapsibleButton = ctk.ctkCollapsibleButton()
        normalizationCollapsibleButton.text = "Normalization Metadata"
        self.layout.addWidget(normalizationCollapsibleButton)
        normalizationFormLayout = qt.QFormLayout(
            normalizationCollapsibleButton)

        self.inputTypeLabel = qt.QLabel('unspecified')
        normalizationFormLayout.addRow("Input Volume Type",
                                       self.inputTypeLabel)

        self.halfLifeLineEdit = qt.QLineEdit(float('inf'))
        self.halfLifeLineEditValidator = qt.QDoubleValidator()
        self.halfLifeLineEditValidator.bottom = 0.0
        self.halfLifeLineEdit.setValidator(self.halfLifeLineEditValidator)
        self.halfLifeLineEdit.setToolTip("Radionuclide half life time")
        self.halfLifeLineEdit.connect("textChanged(QString)",
                                      self.updateNormalizationFactor)
        normalizationFormLayout.addRow("Radionuclide Half Life (s)",
                                       self.halfLifeLineEdit)

        self.activityLineEdit = qt.QLineEdit("1.0")
        self.activityLineEditValidator = qt.QDoubleValidator()
        self.activityLineEditValidator.bottom = 0.0
        self.activityLineEdit.setValidator(self.activityLineEditValidator)
        self.activityLineEdit.setToolTip(
            "Normalization factor for input dataset")
        self.activityLineEdit.connect("textChanged(QString)",
                                      self.updateNormalizationFactor)
        normalizationFormLayout.addRow(u"Syringe Activity (\u00B5Ci)",
                                       self.activityLineEdit)

        self.activityTimeEdit = qt.QTimeEdit()
        self.activityTimeEdit.connect("timeChanged(QTime)",
                                      self.updateNormalizationFactor)
        normalizationFormLayout.addRow("Syringe Assay Time",
                                       self.activityTimeEdit)

        self.residualActivityLineEdit = qt.QLineEdit("0.0")
        self.residualActivityLineEditValidator = qt.QDoubleValidator()
        self.residualActivityLineEditValidator.bottom = 0.0
        self.residualActivityLineEdit.setValidator(
            self.residualActivityLineEditValidator)
        self.residualActivityLineEdit.setToolTip(
            "Normalization factor for input dataset")
        self.residualActivityLineEdit.connect("textChanged(QString)",
                                              self.updateNormalizationFactor)
        normalizationFormLayout.addRow(u"Syringe Residual Activity (\u00B5Ci)",
                                       self.residualActivityLineEdit)

        self.residualactivityTimeEdit = qt.QTimeEdit()
        self.residualactivityTimeEdit.connect("timeChanged(QTime)",
                                              self.updateNormalizationFactor)
        normalizationFormLayout.addRow("Syringe Residual Activity Time",
                                       self.residualactivityTimeEdit)

        self.scanTimeEdit = qt.QTimeEdit()
        self.scanTimeEdit.connect("timeChanged(QTime)",
                                  self.updateNormalizationFactor)
        normalizationFormLayout.addRow("Scan Time", self.scanTimeEdit)

        self.weightLineEdit = qt.QLineEdit("1000.0")
        self.weightLineEditValidator = qt.QDoubleValidator()
        self.weightLineEditValidator.bottom = 0.0
        self.weightLineEdit.setValidator(self.weightLineEditValidator)
        self.weightLineEdit.setToolTip(
            "Normalization factor for input dataset")
        self.weightLineEdit.connect("textChanged(QString)",
                                    self.updateNormalizationFactor)
        normalizationFormLayout.addRow("Fill Weight (g)", self.weightLineEdit)

        self.inputVolumeSUVNormalizationLabel = qt.QLabel("1.0")
        self.inputVolumeSUVNormalizationLabel.setToolTip(
            "Normalization factor applied to input volume")
        normalizationFormLayout.addRow("Input Volume Normalization Factor",
                                       self.inputVolumeSUVNormalizationLabel)

        # Measurement results
        measurementsCollapsibleButton = ctk.ctkCollapsibleButton()
        measurementsCollapsibleButton.text = "Measurements"
        self.layout.addWidget(measurementsCollapsibleButton)
        parametersFormLayout = qt.QFormLayout(measurementsCollapsibleButton)

        self.meanValueLineEdit = qt.QLineEdit("-")
        self.meanValueLineEdit.setReadOnly(True)
        self.meanValueLineEdit.setToolTip("Mean value in measurement region")
        parametersFormLayout.addRow("Mean", self.meanValueLineEdit)
        self.stdValueLineEdit = qt.QLineEdit("-")
        self.stdValueLineEdit.setReadOnly(True)
        self.stdValueLineEdit.setToolTip(
            "Standard deviation in measurement region")
        parametersFormLayout.addRow("Standard Deviation",
                                    self.stdValueLineEdit)
        self.maxRelDiffValueLineEdit = qt.QLineEdit("-")
        self.maxRelDiffValueLineEdit.setReadOnly(True)
        self.maxRelDiffValueLineEdit.setToolTip(
            "Maximum relative difference  in axial direction in reference region"
        )
        parametersFormLayout.addRow("Maximum Relative Difference",
                                    self.maxRelDiffValueLineEdit)

        # visualize matched cylinder
        self.cylinderModelNode = slicer.mrmlScene.AddNewNodeByClass(
            "vtkMRMLModelNode")
        self.cylinderModelNode.CreateDefaultDisplayNodes()
        self.cylinderModelNode.SetName("MatchedPhantomCylinderModelNode")
        self.cylinderModelNode.GetDisplayNode().HideFromEditorsOn()
        self.cylinderModelNode.GetDisplayNode().SetColor(0, 1, 0)
        self.cylinderModelNode.GetDisplayNode().SliceIntersectionVisibilityOn()
        self.cylinderModelNode.HideFromEditorsOn()

        # Add vertical spacer
        self.layout.addStretch(1)

        self.inputVolumeSelected()
        self.refreshUIElements()