示例#1
0
 def set_item_parameters(self, itemparams):
     """Set the item parameters, required for the GUI display of the
     measurement parameters."""
     update_dataset(self.measurement,
                    itemparams.get("MeasurementParameter"),
                    visible_only=True)
     ImageItem.set_item_parameters(self, itemparams)
示例#2
0
 def image(
     self,
     data=None,
     filename=None,
     title=None,
     alpha_mask=None,
     alpha=None,
     background_color=None,
     colormap=None,
     xdata=[None, None],
     ydata=[None, None],
     pixel_size=None,
     center_on=None,
     interpolation="linear",
     eliminate_outliers=None,
     xformat="%.1f",
     yformat="%.1f",
     zformat="%.1f",
 ):
     """
     Make an image `plot item` from data
     (:py:class:`guiqwt.image.ImageItem` object or 
     :py:class:`guiqwt.image.RGBImageItem` object if data has 3 dimensions)
     """
     assert isinstance(xdata, (tuple, list)) and len(xdata) == 2
     assert isinstance(ydata, (tuple, list)) and len(ydata) == 2
     param = ImageParam(title=_("Image"), icon="image.png")
     data, filename, title = self._get_image_data(data, filename, title, to_grayscale=True)
     if data.ndim == 3:
         return self.rgbimage(data=data, filename=filename, title=title, alpha_mask=alpha_mask, alpha=alpha)
     assert data.ndim == 2, "Data must have 2 dimensions"
     if pixel_size is None:
         assert center_on is None, "Ambiguous parameters: both `center_on`" " and `xdata`/`ydata` were specified"
         xmin, xmax = xdata
         ymin, ymax = ydata
     else:
         xmin, xmax, ymin, ymax = self.compute_bounds(data, pixel_size, center_on)
     self.__set_image_param(
         param,
         title,
         alpha_mask,
         alpha,
         interpolation,
         background=background_color,
         colormap=colormap,
         xmin=xmin,
         xmax=xmax,
         ymin=ymin,
         ymax=ymax,
         xformat=xformat,
         yformat=yformat,
         zformat=zformat,
     )
     image = ImageItem(data, param)
     image.set_filename(filename)
     if eliminate_outliers is not None:
         image.set_lut_range(lut_range_threshold(image, 256, eliminate_outliers))
     return image
示例#3
0
 def __init__(self, measurement=None):
     """\arg measurement a Measurement object storing data and scanning
     parameter.
     """
     self.__baseclass__ = ThothMapItem
     ImageItem.__init__(self, data=None, param=ImageParam(_("Image")))
     if measurement is not None:
         self.set_measurement(measurement)
     else:
         self.measurement = Measurement()
     self.current_index = 0
示例#4
0
 def __init__(self, measurement=None):
     """\arg measurement a Measurement object storing data and scanning
     parameter.
     """
     self.__baseclass__ = ThothImageItem
     param = ImageParam(_("Image"), icon='image.png')
     param.interpolation = 1
     ImageItem.__init__(self, data=None, param=param)
     if measurement is not None:
         self.set_measurement(measurement)
     else:
         self.measurement = Measurement()
示例#5
0
 def image(self, data=None, filename=None, title=None, alpha_mask=None,
           alpha=None, background_color=None, colormap=None,
           xdata=[None, None], ydata=[None, None],
           pixel_size=None, center_on=None,
           interpolation='linear', eliminate_outliers=None,
           xformat='%.1f', yformat='%.1f', zformat='%.1f'):
     """
     Make an image `plot item` from data
     (:py:class:`guiqwt.image.ImageItem` object or 
     :py:class:`guiqwt.image.RGBImageItem` object if data has 3 dimensions)
     """
     assert isinstance(xdata, (tuple, list)) and len(xdata) == 2
     assert isinstance(ydata, (tuple, list)) and len(ydata) == 2
     param = ImageParam(title=_("Image"), icon='image.png')
     data, filename, title = self._get_image_data(data, filename, title,
                                                  to_grayscale=True)
     if data.ndim == 3:
         return self.rgbimage(data=data, filename=filename, title=title,
                              alpha_mask=alpha_mask, alpha=alpha)
     assert data.ndim == 2, "Data must have 2 dimensions"
     if pixel_size is None:
         assert center_on is None, "Ambiguous parameters: both `center_on`"\
                                   " and `xdata`/`ydata` were specified"
         xmin, xmax = xdata
         ymin, ymax = ydata
     else:
         xmin, xmax, ymin, ymax = self.compute_bounds(data, pixel_size,
                                                      center_on)
     self.__set_image_param(param, title, alpha_mask, alpha, interpolation,
                            background=background_color,
                            colormap=colormap,
                            xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
                            xformat=xformat, yformat=yformat,
                            zformat=zformat)
     image = ImageItem(data, param)
     image.set_filename(filename)
     if eliminate_outliers is not None:
         image.set_lut_range(lut_range_threshold(image, 256,
                                                 eliminate_outliers))
     return image
示例#6
0
 def get_item_parameters(self, itemparams):
     """Return the item parameters, required for the GUI display of the
     measurement parameters."""
     ImageItem.get_item_parameters(self, itemparams)
     itemparams.add("MeasurementParameter", self, self.measurement)
示例#7
0
 def __init__(self, param=None):
     ImageItem.__init__(self, numpy.zeros((1, 1)), param=param)
     TaurusEncodedBaseImageItem.__init__(self, self.__class__.__name__)
示例#8
0
文件: image.py 项目: cmft/taurus
 def __init__(self, param=None):
     ImageItem.__init__(self, numpy.zeros((1, 1)), param=param)
     TaurusEncodedBaseImageItem.__init__(self, self.__class__.__name__)