slitflow.fig.figure module

class Figure(info_path=None)[source]

Bases: Pickle

Figure Data saved as matplotlib pickle object.

EXT = '.fig'
save_data(data, path)[source]

matplotlib.axes.Axes cannot be copied. All figures should be saved as a file after executing each process. You have to use run mode 2.

class ToTiff(info_path=None)[source]

Bases: RGB

Convert matplotlib figure object to RGB tiff class.

Parameters:
  • reqs[0] (Figure) – Figure class containing matplotlib.figure.Figure objects.

  • param["dpi"] (int, optional) – Dot per inch of image. Defaults to 400.

  • param["scalebar"] (list, optional) – [length, left position, bottom position, line width, line color] of the scale bar. Positions should be the relative positions of figure size (0-1). Line color should be [R(0-255), G(0-255), B(0-255)]. This parameter requires “limit”, “size” and “length_unit” to reqs[0].

  • param["split_depth"] (int) – File split depth number.

Returns:

Image of figure

Return type:

slitflow.img.image.RGB

set_info(param={})[source]

Copy information from reqs[0] and add parameters.

static process(reqs, param)[source]

Convert matplotlib figure object to RGB tiff class.

Parameters:
  • reqs[0] (matplotlib.figure.Figure) – Figure object.

  • param["dpi"] (int, optional) – Dot per inch of image. Defaults to 400.

  • param["scalebar"] (list, optional) – [length, left position, bottom position, line width, line color] of the scale bar. Positions should be the relative positions of figure size (0-1). Line color should be [R(0-255), G(0-255), B(0-255)]. This parameter requires “limit”, “size” and “length_unit” to reqs[0].

  • param["limit"] (list of float, optional) – [left, right, bottom, top] limits of figure axes. Required if scale in param.

Returns:

Image of figure

Return type:

numpy.ndarray

get_stack(fig, dpi)[source]

Convert matplotlib.figure.Figure to numpy.ndarray of RGB image.

Parameters:
Returns:

RGB image with the shape of (color, height, width)

Return type:

numpy.ndarray

inherit_split_depth(Data, reqs_no, group_depth)[source]

Set the group and split depth based on the reqs data.

Parameters:
  • Data (Data) – Target Data object to set split_depth.

  • reqs_no (int) – Required Data number to get split_depth.

  • group_depth (int) – Data grouping depth number to set calc_cols.