SCTrack.utils module¶
- SCTrack.utils.convert_dtype(__image: ndarray) ndarray [source]¶
Convert image format from uint16 to uint8 :param __image: uint16 image ndarray :return: uint8 image ndarray
- SCTrack.utils.mask_seq_to_json(mask_dir, xrange=None)[source]¶
Convert mask sequence files to json annotation files. :param mask_dir: The folder path for the mask image sequence location :param xrange: The number of conversions, counting from the beginning of the mask sequence. :return: json annotation dict, can be directly dump to the json file.
- SCTrack.utils.mask_tif_to_json(image, xrange=None)[source]¶
Convert Multi-frame TIF mask image to json annotation files. :param image: The TIF filepath for mask location :param xrange: The number of conversions, counting from the beginning of the mask. :return: json annotation dict, can be directly dump to the json file.
- SCTrack.utils.mask_to_coords(mask: np.ndarray | os.PathLike, filename)[source]¶
Convert mask to contour coordinates. For the mask of an image, each different instance requires the same and unique pixel values within its range, and the pixel values of different instances are different. This requirement is only for instances within the same frame of image.
- Parameters:
mask – mask grayscale image, np.ndarray
filename – filename for the mask
- Returns:
a region tmp dict for each mask, the format see template.py
- SCTrack.utils.mask_to_json(annotation: file or folder, xrange=None)[source]¶
Convert mask image to json annotation files
- Parameters:
annotation – mask filepath.
xrange – The number of conversions, counting from the beginning of the annotation sequence.
- Returns:
json annotation dict, can be directly dump to the json file.
- SCTrack.utils.readTif(filepath)[source]¶
A generator, from a multi-frame tif file, read frame by frame and return the image and filename of each frame.