Extraction

src.actions.extraction.extract_leaf_images(lseq_list, output_path_list, overwrite, format_dict)[source]

Extract differenced leaf images from a list of LeafSequence objects. No objects are returned, but the LeafSequence objects will be mutated.

Parameters
  • lseq_list – list of LeafSequences

  • output_path_list (List[str]) – list of file paths of where the differenced images should be saved; this path is enumerated as images are saved

  • overwrite (bool) – whether leaves that exist at the same file path should be overwritten

  • format_dict (Dict) – what format the leaves should be extracted in, e.g. should they be shifted by 256

Return type

None

Returns

None

src.actions.extraction.extract_multipage_mask_images(mseq_list, output_path_list, overwrite, binarise)[source]

Extract mask images from a multipage file. No objects are returned, but the MaskSequence objects will be mutated.

Parameters
  • mseq_list – list of MaskSequence objects

  • output_path_list (List[str]) – list of file paths of where the mask images should be saved; this path is enumerated as images are saved

  • overwrite (bool) – whether masks that exist at the same file path should be overwritten

  • binarise (bool) – whether the masks should be saved in a binary format; i.e. 0 for no-embolism and 1 for embolism

Return type

None

Returns

None

src.actions.extraction.extract_tiles(seq_objects, length_x, stride_x, length_y, stride_y, output_path_list=None, overwrite=False, **kwargs)[source]

Extract tiles from either a list of mask or leaf sequence objects. The tiles are not stored in the Sequence objects to save memory, hence the sequence images are not mutated when they are returned.

Parameters
  • seq_objects – list of either MaskSequence or LeafSequence objects

  • length_x (int) – the x-length of the tile

  • stride_x (int) – the size of the x stride

  • length_y (int) – the y-length of the tile

  • stride_y (int) – the size of the y stride

  • output_path_list (Optional[List[str]]) – list of file paths of where the mask images should be saved; if no path is provided, tiles are saved in a default location

  • overwrite (bool) – whether tiles that exist at the same file path should be overwritten

  • kwargs – kwargs for how the sequence object images should be loaded

Return type

None

Returns

None