slitflow.loc.mask module

class Value(info_path=None)[source]

Bases: Table

Create mask value column at the coordinate position of each X and Y.

Caution

The mask image should be split into a single frame image. In other words, the shape of reqs[1] in process() should be (1, height, width).

Parameters:
  • reqs[0] (Table) – Table including X,Y-coordinates. Required params; length_unit, pitch.

  • reqs[1] (Image) – Image stack to pick up intensity.

  • param["add_cols"] (list of str, optional) – Additional columns to copy from required table. If this param is not defined, index columns are copied.

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

Returns:

Table containing mask value column

Return type:

Table

set_reqs(reqs, param)[source]

Drop elements that exist only in one required data.

set_info(param={})[source]

Copy info from reqs[0] and add params from reqs[1].

static process(reqs, param)[source]

Create mask value column at the coordinate position of each X and Y.

Parameters:
  • reqs[0] (pandas.DataFrame) – Table including X,Y-coordinate.

  • reqs[1] (numpy.ndarray) – Numpy 3D array with the shape of (1, height, width).

  • param["calc_cols"] (list of str) – Column names for X,Y-coordinate.

  • param["pitch"] (float) – Length per pixel.

  • param["index_cols"] (list of str) – Column names to keep in the result table.

Returns:

Table containing mask value column

Return type:

pandas.DataFrame

class BinaryImage(info_path=None)[source]

Bases: Table

Select table rows that have coordinates inside the binary mask.

Caution

The mask image should be split into a single frame image. In other words, the shape of reqs[1] in process() should be (1, height, width).

Parameters:
  • reqs[0] (Table) – Table including X,Y-coordinate. Required param; pitch, length_unit.

  • reqs[1] (Image) – Mask image to select table.

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

Returns:

Table with rows located inside mask image

Return type:

Table

set_reqs(reqs, param)[source]

Drop elements that exist only in one required data.

set_info(param={})[source]

Copy info from reqs[0] and add params from reqs[1].

static process(reqs, param)[source]

Select table rows that have coordinates inside the binary mask.

Parameters:
  • reqs[0] (pandas.DataFrame) – Table including X,Y-coordinate.

  • reqs[1] (numpy.ndarray) – Numpy 3D array with the shape of (1, height, width).

  • param["calc_cols"] (list of str) – Column names for X,Y-coordinate.

  • param["pitch"] (float) – Length per pixel.

Returns:

Table rows located inside mask image

Return type:

pandas.DataFrame