How to use the histomicstk.segmentation.label.trace_object_boundaries function in histomicstk

To help you get started, we’ve selected a few histomicstk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DigitalSlideArchive / HistomicsTK / server / ComputeSuperpixelFeatures / ComputeSuperpixelFeatures.py View on Github external
continue

            # get superpixel data
            stain_data = np.zeros(
                (args.patchSize, args.patchSize, len(dict_stains)))

            for key in dict_stains.keys():
                k = dict_stains[key]
                im_stain = im_stains[:, :, k].astype(np.float)
                stain_data[:, :, k] = \
                    im_stain[min_row:max_row, min_col:max_col] / 255.0

            s_data.append(stain_data)

            # find boundaries
            bx, by = htk_seg.label.trace_object_boundaries(emask)

            with np.errstate(invalid='ignore'):
                # remove redundant points
                mby, mbx = htk_utils.merge_colinear(
                    by[0].astype(float), bx[0].astype(float))

            # get superpixel boundary at highest-res
            x_brs.append(
                (mbx - 1) * ratio_pixel + top)
            y_brs.append(
                (mby - 1) * ratio_pixel + left)

            # get superpixel centers at highest-res
            x_cent.append(
                round((cen_x * ratio_pixel + top), 1))
            y_cent.append(