示例#1
0
 def set_colorbar_table(self, ctab):
     """Sets color table ctab (np.array) - list of colors 32-bit unsigned words"""
     self._ctab = ct.np.array(ctab)
     arr = ct.array_for_color_bar(ctab, self.orient)
     self.set_pixmap_from_arr(arr, amin=arr[0],
                              amax=arr[-1])  # method of the FWViewImage
     self.new_color_table.emit()
示例#2
0
 def set_colorbar_table(self, ctab):
     """Sets color table ctab (np.array) - list of colors 32-bit unsigned words"""
     self._ctab = ct.np.array(ctab)
     arr = ct.array_for_color_bar(ctab, self.orient)
     self.set_pixmap_from_arr(arr)  # method of the FWViewImage
     #print('XXX Color table:', ctab)
     #self.emit(QtCore.SIGNAL('new_color_table()'))
     self.new_color_table.emit()
示例#3
0
 def __init__(self, parent=None,\
              coltab=ct.color_table_rainbow(ncolors=1000, hang1=250, hang2=-20),\
              orient='H', wlength=200, wwidth=50, change_mode=0o3, scale_ctl=''):
     self.orient = orient
     #print('XXX FWViewColorBar.orient: %s' % self.orient)
     arrct = ct.array_for_color_bar(coltab, orient)
     self._ctab_ind = None
     self._ctab = coltab
     self.wlength = wlength
     self.wwidth = wwidth
     self.change_mode = change_mode
     FWViewImage.__init__(self,
                          parent,
                          arrct,
                          coltab=None,
                          origin='UL',
                          scale_ctl=scale_ctl)
     self._name = self.__class__.__name__
示例#4
0
    def test_wfviewimage(tname):
        print('%s:' % sys._getframe().f_code.co_name)
        #import numpy as np
        #arr = np.random.random((1000, 1000))
        arr = image_with_random_peaks((1000, 1000))
        #ctab = ct.color_table_rainbow(ncolors=1000, hang1=250, hang2=-20)
        ctab = ct.color_table_monochr256()
        #ctab = ct.color_table_interpolated()

        app = QApplication(sys.argv)
        w = None
        if tname == '0':
            w = FWViewImage(None,
                            arr,
                            coltab=ctab,
                            origin='UL',
                            scale_ctl='HV')
        elif tname == '1':
            w = FWViewImage(None, arr, coltab=ctab, origin='UL', scale_ctl='H')
        elif tname == '2':
            w = FWViewImage(None, arr, coltab=ctab, origin='UL', scale_ctl='V')
        elif tname == '3':
            w = FWViewImage(None, arr, coltab=ctab, origin='UL', scale_ctl='')
        elif tname == '4':
            arrct = ct.array_for_color_bar(orient='H')
            w = FWViewImage(None,
                            arrct,
                            coltab=None,
                            origin='UL',
                            scale_ctl='H')
            w.setGeometry(50, 50, 500, 40)
        elif tname == '5':
            arrct = ct.array_for_color_bar(orient='V')
            w = FWViewImage(None,
                            arrct,
                            coltab=None,
                            origin='UL',
                            scale_ctl='V')
            w.setGeometry(50, 50, 40, 500)
        elif tname == '6':
            #ctab= ct.color_table_rainbow(ncolors=1000, hang1=0, hang2=360)
            #ctab = ct.color_table_rainbow(ncolors=1000, hang1=250, hang2=-20)
            #ctab = ct.color_table_monochr256()
            ctab = ct.color_table_interpolated()
            arrct = ct.array_for_color_bar(ctab, orient='H')
            w = FWViewImage(None,
                            arrct,
                            coltab=None,
                            origin='UL',
                            scale_ctl='H')
            w.setGeometry(50, 50, 500, 40)
        elif tname == '7':
            a = np.arange(15).reshape((5, 3))
            w = FWViewImage(None, a, coltab=ctab, origin='UL', scale_ctl='HV')
        else:
            print('test %s is not implemented' % tname)
            return

        w.connect_mouse_press_event_to(w.test_mouse_press_event_reception)
        w.connect_mouse_move_event_to(w.test_mouse_move_event_reception)
        w.connect_scene_rect_changed_to(w.test_scene_rect_changed_reception)

        w.show()
        app.exec_()

        del w
        del app