def upload_segmentation_image_file(self, mapobject_type_name,
            plate_name, well_name, well_pos_y, well_pos_x, tpoint, zplane,
            filename):
        '''Uploads segmentations from a *PNG* image file.

        Parameters
        ----------
        mapobject_type_name: str
            name of the segmented objects
        plate_name: str
            name of the plate
        well_name: str
            name of the well in which the image is located
        well_pos_y: int
            y-position of the site relative to the well grid
        well_pos_x: int
            x-position of the site relative to the well grid
        tpoint: int, optional
            zero-based time point index (default: ``0``)
        zplane: int, optional
            zero-based z-plane index (default: ``0``)
        filename: str
            path to the file on disk

        Warning
        -------
        This approach will only works for images with less than 65536 objects,
        since the *PNG* format is limited to 16-bit grayscale images.

        See also
        --------
        :meth:`tmclient.api.TmClient.upload_segmentation_image`
        '''
        logger.info('upload segmentation image file "%s"', filename)
        if not filename.lower().endswith('png'):
            raise IOError('Filename must have "png" extension.')
        filename = os.path.expanduser(os.path.expandvars(filename))
        image = cv2.imread(filename, cv2.IMREAD_UNCHANGED | cv2.IMREAD_ANYDEPTH)
        self._upload_segmentation_image(
            mapobject_type_name, plate_name, well_name, well_pos_y, well_pos_x,
            tpoint, zplane, image.astype(np.int32)
        )
Uploads segmentations from a *PNG* image file.

        Parameters
        ----------
        mapobject_type_name: str
            name of the segmented objects
        plate_name: str
            name of the plate
        well_name: str
            name of the well in which the image is located
        well_pos_y: int
            y-position of the site relative to the well grid
        well_pos_x: int
            x-position of the site relative to the well grid
        tpoint: int, optional
            zero-based time point index (default: ``0``)
        zplane: int, optional
            zero-based z-plane index (default: ``0``)
        filename: str
            path to the file on disk

        Warning
        -------
        This approach will only works for images with less than 65536 objects,
        since the *PNG* format is limited to 16-bit grayscale images.

        See also
        --------
        :meth:`tmclient.api.TmClient.upload_segmentation_image`