deepscribe.pipeline.images

class deepscribe.pipeline.images.ProcessImageTask(*args, **kwargs)

Task mapping an hdf5 archive of images to another after applying an image processing function.

Requires implementation of the process_image function.

output()

The location of the transformed HDF5 archive on disk.

Returns:luigi.LocalTarget
process_image(img)

Task mapping an image to to a transformed image.

Parameters:img – np.ndarray
Returns:np.ndarray
run()

Runs the process_image function on every image in the HDF5 archive, keeping the archive structure constant.

Returns:
class deepscribe.pipeline.images.RescaleImageValuesTask(*args, **kwargs)

Subtracts out the mean brightness from each image.

process_image(img)

Normalizes the pixel values (assumed to be 8-bit integers) and subtracts out image-wise mean

Parameters:img – np.ndarray
Returns:np.ndarray
requires()
Returns:OchreToHD5Task, required
class deepscribe.pipeline.images.StandardizeImageSizeTask(*args, **kwargs)

Resizes and pads an image to a square with the provided dimension.

process_image(img)

from https://jdhao.github.io/2017/11/06/resize-image-to-square-with-padding/#using-opencv.

im : np.array
Description of parameter img.
target_size : int
Description of parameter new_size.
np.array
Description of returned object.
requires()

Switches task graph construction depending on self.threshold argument.

Returns:luigi.Task, either ThresholdImageTask or RescaleImageValuesTask
class deepscribe.pipeline.images.ThresholdImageTask(*args, **kwargs)

Performing Otsu thresholding - as an alternative to rescaling.

process_image(img)

Performs Otsu thresholding on the image using OpenCV

Parameters:img – np.ndarray
Returns:np.ndarray
requires()
Returns:OchreToHD5Task, required