slitflow.img.image module

class Image(info_path=None)[source]

Bases: Data

Stack of Two-dimensional image Data class saved as tiff files.

Images are loaded upside down to facilitate picking up pixel value. See also Data for properties and methods. Concrete subclass is mainly in slitflow.img.

EXT = '.tif'
load_data(path)[source]

Load tiff file as numpy.ndarray.

save_data(stack, path)[source]

Save numpy.ndarray data into tiff file.

split_data()[source]

Splits the list of 3D np.array based on the index DataFrame.

set_info(param={})[source]

Convert input information to Info object.

This method creates columns and parameters information. The columns information is used to handle data structure. The parameter dictionaries are set as param of process(). This method is called before run(). Implemented in subclass.

Parameters:

param (dict, optional) – Parameters for columns or params.

to_imshow(position)[source]

Convert image to use in matplotlib.pyplot.imshow().

Returns:

Grayscale image according to imshow format

Return type:

numpy.ndarray

set_img_size(self)[source]

Set the image size to the param info in pixel.

This function is used in post_run() to append image size information into the result information.

class RGB(info_path=None)[source]

Bases: Image

Stack of RGB color image class saved as tiff files.

uint8, uint16 color can be saved as color tiff stack. float32 color can be saved as hyperstack tiff.

load_data(path)[source]

Load tiff file as numpy.ndarray.

save_data(stack, path)[source]

Save numpy.ndarray data into tiff file.

set_index()[source]

How to get slitflow.info.Info.index.

Default function for RGB is set_color_index().

to_imshow(position)[source]

Convert image to use in matplotlib.pyplot.imshow().

Returns:

Color image according to imshow format

Return type:

numpy.ndarray

set_color_index(Data, req_no, index_depth)[source]

Set color index.

The color index is a number to represent color. 1:R, 2:G, 3:B.