How to use the histomicstk.cli.utils.create_dask_client 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 / histomicstk / cli / SeparateStainsMacenkoPCA / SeparateStainsMacenkoPCA.py View on Github external
def main(args):
    args = utils.splitArgs(args)
    args.macenko.I_0 = numpy.array(args.macenko.I_0)

    utils.create_dask_client(args.dask)
    sample = utils.sample_pixels(args.sample)
    stain_matrix = rgb_separate_stains_macenko_pca(sample.T, **vars(args.macenko))
    with open(args.returnParameterFile, 'w') as f:
        for i, stain in enumerate(stain_matrix.T):
            f.write('stainColor_{} = {}\n'.format(i+1, ','.join(map(str, stain))))
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / NucleiClassification / NucleiClassification.py View on Github external
def main(args):

    print('\n>> CLI Parameters ...\n')

    print(args)

    #
    # Initiate Dask client
    #
    print('\n>> Creating Dask client ...\n')

    c = cli_utils.create_dask_client(args)

    print(c)

    #
    # read model file
    #
    print('\n>> Loading classification model ...\n')

    clf_model = joblib.load(args.inputModelFile)

    #
    # read feature file
    #
    print('\n>> Loading nuclei feature file ...\n')

    ddf = read_feature_file(args)
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / PositivePixelCount / PositivePixelCount.py View on Github external
def main(args):
    utils.create_dask_client(args)
    ts = large_image.getTileSource(args.inputImageFile)
    make_label_image = getattr(args, 'outputLabelImage', None) is not None
    region = utils.get_region_dict(
        args.region,
        *(args.maxRegionSize, ts) if make_label_image else ()
    ).get('region')
    ppc_params = ppc.Parameters(
        **{k: getattr(args, k) for k in ppc.Parameters._fields}
    )
    results = ppc.count_slide(
        args.inputImageFile, ppc_params, region,
        args.tile_grouping, make_label_image,
    )
    if make_label_image:
        stats, label_image = results
        # Colorize label image.  Colors from the "coolwarm" color map
github DigitalSlideArchive / HistomicsTK / histomicstk / cli / SuperpixelSegmentation / CreateDataset.py View on Github external
print('\n>> Reading VGG pre-trained model ... \n')
    model = applications.VGG16(include_top=True, weights='imagenet')
    model = Model(inputs=model.input, outputs=model.get_layer('fc1').output)

    print('\n>> Load PCA fitted model ... \n')
    pca = joblib.load(args.inputPCAModel)

    #
    # Initiate Dask client
    #
    print('\n>> Creating Dask client ...\n')

    start_time = time.time()

    c = cli_utils.create_dask_client(args)

    print(c)

    dask_setup_time = time.time() - start_time
    print('Dask setup time = {}'.format(
        cli_utils.disp_time_hms(dask_setup_time)))

    slide_superpixels = []
    slide_x_centroids = []
    slide_y_centroids = []
    slide_names = []
    slide_spixel_index = []
    first_spixel_index = np.zeros((n_slides, args.columnSize), dtype=np.int32)
    slide_wsi_mean = np.zeros((n_slides, args.channelSize), dtype=np.float32)
    slide_wsi_std = np.zeros((n_slides, args.channelSize), dtype=np.float32)