How to use the histomicstk.utils.compute_tile_foreground_fraction 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
'width':  args.analysis_roi[2],
                'height': args.analysis_roi[3],
                'units':  'base_pixels'
            }

        if is_wsi:

            print('\n>> Computing foreground fraction of all tiles ...\n')

            start_time = time.time()

            num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']

            print 'Number of tiles = %d' % num_tiles

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
                **it_kwargs
            )

            num_fgnd_tiles = np.count_nonzero(
                tile_fgnd_frac_list >= args.min_fgnd_frac)

            percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

            fgnd_frac_comp_time = time.time() - start_time

            print 'Number of foreground tiles = %d (%.2f%%)' % (
                num_fgnd_tiles, percent_fgnd_tiles)

            print 'Time taken = %s' % cli_utils.disp_time_hms(fgnd_frac_comp_time)
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / SuperpixelSegmentation / CreateDataset.py View on Github external
'scale': {'magnification': args.analysis_mag},
            }

            #
            # Compute foreground fraction of tiles in parallel using Dask
            #
            print('\n>> Computing foreground fraction of all tiles ...\n')

            start_time = time.time()

            num_tiles = \
                ts.getSingleTile(**it_kwargs)['iterator_range']['position']

            print('Number of tiles = {}'.format(num_tiles))

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
                it_kwargs
            )

            num_fgnd_tiles = np.count_nonzero(
                tile_fgnd_frac_list >= args.min_fgnd_frac)

            percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

            fgnd_frac_comp_time = time.time() - start_time

            print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
                num_fgnd_tiles, percent_fgnd_tiles))

            print('Tile foreground fraction computation time = {}'.format(
                cli_utils.disp_time_hms(fgnd_frac_comp_time)))
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / NucleiDetection / NucleiDetection.py View on Github external
'units':  'base_pixels'
        }

    if is_wsi:

        print('\n>> Computing foreground fraction of all tiles ...\n')

        start_time = time.time()

        num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']

        print('Number of tiles = {}'.format(num_tiles))

        if process_whole_image:

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                args.inputImageFile, im_fgnd_mask_lres, fgnd_seg_scale,
                it_kwargs
            )

        else:

            tile_fgnd_frac_list = np.full(num_tiles, 1.0)

        num_fgnd_tiles = np.count_nonzero(
            tile_fgnd_frac_list >= args.min_fgnd_frac)

        percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

        fgnd_frac_comp_time = time.time() - start_time

        print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
github DigitalSlideArchive / HistomicsTK / server / ComputeSuperpixelFeatures / TrainSuperpixelAutoencoder.py View on Github external
'width':  args.analysis_roi[2],
                'height': args.analysis_roi[3],
                'units':  'base_pixels'
            }

        if is_wsi:

            print('\n>> Computing foreground fraction of all tiles ...\n')

            start_time = time.time()

            num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']

            print 'Number of tiles = %d' % num_tiles

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                img_path[i], im_fgnd_mask_lres, fgnd_seg_scale,
                **it_kwargs
            )

            num_fgnd_tiles = np.count_nonzero(
                tile_fgnd_frac_list >= args.min_fgnd_frac)

            percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

            fgnd_frac_comp_time = time.time() - start_time

            print 'Number of foreground tiles = %d (%.2f%%)' % (
                num_fgnd_tiles, percent_fgnd_tiles)

            print 'Time taken = %s' % cli_utils.disp_time_hms(fgnd_frac_comp_time)
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / ComputeNucleiFeatures / ComputeNucleiFeatures.py View on Github external
'units':  'base_pixels'
        }

    if is_wsi:

        print('\n>> Computing foreground fraction of all tiles ...\n')

        start_time = time.time()

        num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']

        print('Number of tiles = {}'.format(num_tiles))

        if process_whole_image:

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                args.inputImageFile, im_fgnd_mask_lres, fgnd_seg_scale,
                it_kwargs
            )

        else:

            tile_fgnd_frac_list = [1.0] * num_tiles

        num_fgnd_tiles = np.count_nonzero(
            tile_fgnd_frac_list >= args.min_fgnd_frac)

        percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

        fgnd_frac_comp_time = time.time() - start_time

        print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / SuperpixelSegmentation / CreateDataset.py View on Github external
#
            print('\n>> Computing foreground fraction of all tiles ...\n')

            it_kwargs = {
                'tile_size': {'width': args.superpixel_tile_size},
                'scale': {'magnification': args.superpixel_mag},
            }

            start_time = time.time()

            num_tiles = \
                ts.getSingleTile(**it_kwargs)['iterator_range']['position']

            print('Number of tiles = {}'.format(num_tiles))

            tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
                img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
                it_kwargs
            )

            num_fgnd_tiles = np.count_nonzero(
                tile_fgnd_frac_list >= args.min_fgnd_frac
            )

            percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles

            fgnd_frac_comp_time = time.time() - start_time

            print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
                num_fgnd_tiles, percent_fgnd_tiles))

            print('Tile foreground fraction computation time = {}'.format(