### Install HistomicsTK from source Source: https://digitalslidearchive.github.io/HistomicsTK/installation.html Use this method for non-Linux systems or when using system-level image libraries. ```bash $ git clone https://github.com/DigitalSlideArchive/HistomicsTK.git $ cd HistomicsTK $ pip install -e . ``` -------------------------------- ### Install HistomicsTK via pip Source: https://digitalslidearchive.github.io/HistomicsTK/installation.html Use this command on Linux to install HistomicsTK with prebuilt libraries for image format support. ```bash $ pip install histomicstk --find-links https://girder.github.io/large_image_wheels ``` -------------------------------- ### Import necessary libraries for HistomicsTK workflows Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Imports essential modules for running workflows, including girder client, data reading, and specific workflow components. Ensure these libraries are installed before use. ```python import tempfile import girder_client # import numpy as np from pandas import read_csv from histomicstk.workflows.workflow_runner import Slide_iterator # from histomicstk.saliency.cellularity_detection import ( # Cellularity_detector_superpixels) from histomicstk.saliency.cellularity_detection_thresholding import ( Cellularity_detector_thresholding) from histomicstk.workflows.workflow_runner import ( Workflow_runner, Slide_iterator) from histomicstk.workflows.specific_workflows import ( cellularity_detection_workflow) ``` -------------------------------- ### Get Single Tile by Position Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves a single tile from the slide at a specific position using `getSingleTile`. This is useful when you need a tile at a known linear position. Requires specifying tile size and scale. ```python pos = 1000 tile_info = ts.getSingleTile( tile_size=dict(width=1000, height=1000), scale=dict(magnification=20), tile_position=pos, ) plt.imshow(tile_info['tile']) ``` -------------------------------- ### Read Entire Slide at Low Magnification Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Reads the entire slide at a low magnification level. This is useful for getting a low-resolution overview of the whole slide. Ensure the desired magnification is specified. ```python im_low_res, _ = ts.getRegion( scale=dict(magnification=1.25), format=large_image.tilesource.TILE_FORMAT_NUMPY, ) plt.imshow(im_low_res) ``` -------------------------------- ### Get slide metadata Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieve basic slide metadata, including the number of levels, magnification, pixel dimensions, and tile size, using the getMetadata() function of the TileSource object. ```python ts.getMetadata() ``` -------------------------------- ### Get ROI at Specific Magnification Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Extracts a rectangular region of interest (ROI) from the slide at a specified magnification. Use this when you need a specific area of the image at a particular resolution. The output format can be NumPy array or PIL image. ```python im_roi, _ = ts.getRegion( region=dict(left=10000, top=10000, width=1000, height=1000, units='base_pixels'), format=large_image.tilesource.TILE_FORMAT_NUMPY, ) plt.imshow(im_roi) ``` -------------------------------- ### Print Workflow_runner.__init__.__doc__ Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Displays the documentation string for the Workflow_runner initialization method, outlining its arguments and purpose. ```python print(Workflow_runner.__init__.__doc__) ``` -------------------------------- ### Print Slide_iterator.__init__.__doc__ Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Displays the documentation string for the Slide_iterator initialization method, detailing its parameters for iterating over slides. ```python print(Slide_iterator.__init__.__doc__) ``` -------------------------------- ### Configure plotting and import libraries Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Set up default plotting configurations using matplotlib and import essential libraries like os and numpy. ```python import os import numpy as np import matplotlib.pyplot as plt %matplotlib inline #Some nice default configuration for plots plt.rcParams['figure.figsize'] = 10, 10 plt.rcParams['image.cmap'] = 'gray' ``` -------------------------------- ### Workflow_runner Initialization Documentation Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Provides details on initializing the Workflow_runner object. It requires a Slide_iterator instance, a workflow method, and workflow keyword arguments. Additional keyword arguments can override default settings. ```python Init Workflow_runner object. Arguments ----------- slide_iterator : object Slide_iterator object workflow : method method whose parameters include slide_id and monitorPrefix, which is called for each slide workflow_kwargs : dict keyword arguments for the workflow method kwargs : key-value pairs The following are already assigned defaults by Base_HTK_Class but can be passed here to override defaults [verbose, monitorPrefix, logging_savepath, suppress_warnings] ``` -------------------------------- ### Connect to Girder Client and Set Analysis Parameters Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Establishes a connection to a DSA server using provided API URL and API key. It also defines parameters for a cellularity detection workflow, including GTcodes, magnification, and visualization settings. The logging path is set to a temporary directory. ```python APIURL = 'http://candygram.neurology.emory.edu:8080/api/v1/' SAMPLE_SOURCE_FOLDER_ID = '5d5c28c6bd4404c6b1f3d598' SAMPLE_DESTINATION_FOLDER_ID = '5d9246f6bd4404c6b1faaa89' # girder client gc = girder_client.GirderClient(apiUrl=APIURL) # gc.authenticate(interactive=True) gc.authenticate(apiKey='kri19nTIGOkWH01TbzRqfohaaDWb6kPecRqGmemb') # This is where the run logs will be saved logging_savepath = tempfile.mkdtemp() # params for cellularity thresholding cdt_params = { 'gc': gc, 'slide_id': '', # this will be handled by the slide iterator 'GTcodes': read_csv('../../histomicstk/saliency/tests/saliency_GTcodes.csv'), 'MAG': 3.0, 'visualize': True, 'verbose': 2, 'logging_savepath': logging_savepath, } ``` -------------------------------- ### Initialize Cellularity Detector and Workflow Runner Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Initializes a specific cellularity detector (thresholding-based) and a workflow runner. The runner is configured to process a specific list of slides from a source folder, with results potentially copied to a destination folder. Existing annotations are not kept. ```python # Init specific workflow (Cellularity_detector_thresholding) cdt = Cellularity_detector_thresholding(**cdt_params) # Init workflow runner workflow_runner = Workflow_runner( slide_iterator=Slide_iterator( gc, source_folder_id=SAMPLE_SOURCE_FOLDER_ID, # keep_slides=None), # run all slides in girder directory keep_slides=[ 'TCGA-A1-A0SK-01Z-00-DX1_POST.svs', 'TCGA-A2-A04Q-01Z-00-DX1_POST.svs', ]), workflow=cellularity_detection_workflow, workflow_kwargs={ 'gc': gc, 'cdo': cdt, 'destination_folder_id': SAMPLE_DESTINATION_FOLDER_ID, 'keep_existing_annotations': False }, logging_savepath=cdt.logging_savepath, monitorPrefix='test') ``` -------------------------------- ### Import large_image library Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Import the necessary large_image library for image processing. ```python import large_image ``` -------------------------------- ### Download sample whole-slide image Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Download a sample whole-slide image from a given URL using curl. This code checks if the file already exists before downloading. ```python wsi_url = 'https://data.kitware.com/api/v1/file/5899dd6d8d777f07219fcb23/download' wsi_path = 'TCGA-02-0010-01Z-00-DX4.07de2e55-a8fe-40ee-9e98-bcb78050b9f7.svs' if not os.path.isfile(wsi_path): !curl -OJ "$wsi_url" ``` -------------------------------- ### Slide_iterator Initialization Documentation Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Details the initialization of the Slide_iterator object. It requires a girder client object, the source folder ID, and optional lists for keeping or discarding specific slides. Other keyword arguments can also be passed. ```python Init Slide_iterator object. Arguments ----------- gc : object girder client object source_folder_id : str girder ID of folder in which slides are located keep_slides : list List of slide names to keep. If None, all are kept. discard_slides : list List of slide names to discard. kwargs : key-value pairs The following are already assigned defaults by Base_HTK_Class but can be passed here to override defaults [verbose, monitorPrefix, logger, logging_savepath, suppress_warnings] ``` -------------------------------- ### Print Cellularity Detection Workflow Docstring Source: https://digitalslidearchive.github.io/HistomicsTK/examples/workflows.html Prints the docstring for the cellularity detection workflow, outlining its arguments and behavior. This is useful for understanding the workflow's parameters before execution. ```python print(cellularity_detection_workflow.__doc__) ``` -------------------------------- ### HistomicsTK Workflows Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Tools for running predefined workflows and orchestrating complex image analysis pipelines. ```APIDOC ## histomicstk.workflows ### Description Tools for running image analysis workflows. ### Capabilities - Workflow runner - Specific workflows ``` -------------------------------- ### getSingleTile() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves a single tile at a specific linear position within the tile iterator. ```APIDOC ## getSingleTile() ### Description Directly retrieves the tile at a specific position of the tile iterator. ### Parameters #### Query Parameters - **tile_size** (dict) - Optional - Size of the tile. - **scale** (dict) - Optional - Magnification or resolution. - **tile_position** (int) - Required - The linear position of the tile of interest. ``` -------------------------------- ### Load whole-slide image using getTileSource Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Load a whole-slide image using the large_image.getTileSource function. This function automatically detects and abstracts differences between various image file formats. ```python ts = large_image.getTileSource(wsi_path) ``` -------------------------------- ### Retrieve image region at scale with getRegionAtAnotherScale Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves an image region at a specified target magnification. Requires the source region definition and the desired output format. ```python # get a large region defined at base resolution at a much lower scale im_roi, _ = ts.getRegionAtAnotherScale( sourceRegion=dict(left=5000, top=5000, width=10000, height=10000, units='base_pixels'), targetScale=dict(magnification=1.25), format=large_image.tilesource.TILE_FORMAT_NUMPY) print im_roi.shape ``` -------------------------------- ### Iterate Through ROI with Specific Tile Size and Resolution Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Iterates through a specified region of interest (ROI) with custom tile size and resolution. It calculates the mean RGB color for each tile and the overall slide. Use this for processing large images tile by tile. ```python num_tiles = 0 tile_means = [] tile_areas = [] for tile_info in ts.tileIterator( region=dict(left=5000, top=5000, width=20000, height=20000, units='base_pixels'), scale=dict(magnification=20), tile_size=dict(width=1000, height=1000), tile_overlap=dict(x=50, y=50), format=large_image.tilesource.TILE_FORMAT_PIL, ): if num_tiles == 100: print('Tile-{} = '.format(num_tiles)) display(tile_info) im_tile = np.array(tile_info['tile']) tile_mean_rgb = np.mean(im_tile[:, :, :3], axis=(0, 1)) tile_means.append( tile_mean_rgb ) tile_areas.append( tile_info['width'] * tile_info['height'] ) num_tiles += 1 slide_mean_rgb = np.average(tile_means, axis=0, weights=tile_areas) print('Number of tiles = {}'.format(num_tiles)) print('Slide mean color = {}'.format(slide_mean_rgb)) ``` -------------------------------- ### getMagnificationForLevel() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves magnification and physical pixel size for a specified level in the image pyramid. ```APIDOC ## getMagnificationForLevel(level) ### Description The `getMagnificationForLevel()` function of the TileSource class returns a python dict containing the magnification and physical size of a pixel for a specified level in the image pyramid. ### Method GET (or equivalent for object method call) ### Endpoint Not applicable (object method) ### Parameters #### Path Parameters None #### Query Parameters - **level** (int) - Required - The image pyramid level for which to retrieve magnification information. ### Request Example ```python # Get the magnification associated with Level 0 ts.getMagnificationForLevel(level=0) # Get the magnification associated with all levels of the image pyramid for i in range(ts.levels): print('Level-{} : {}'.format(i, ts.getMagnificationForLevel(level=i))) ``` ### Response #### Success Response (200) - **level** (int) - The image pyramid level. - **magnification** (float) - The magnification factor for the specified level. - **mm_x** (float) - The physical width of a pixel in millimeters for the specified level. - **mm_y** (float) - The physical height of a pixel in millimeters for the specified level. - **scale** (float) - The scale factor for the specified level. #### Response Example ```json { "level": 0, "magnification": 0.078125, "mm_x": 0.128384, "mm_y": 0.128384, "scale": 256.0 } ``` ``` -------------------------------- ### HistomicsTK Utilities Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Utility functions for image and matrix manipulation, numerical computations, and pixel sampling. ```APIDOC ## histomicstk.utils ### Description Provides utility functions for image analysis tasks. ### Functions - `compute_tile_foreground_fraction()` - `convert_image_to_matrix()` - `convert_matrix_to_image()` - `del2()` - `eigen()` - `exclude_nonfinite()` - `fit_poisson_mixture()` - `gradient_diffusion()` - `hessian()` - `merge_colinear()` - `sample_pixels()` - `simple_mask()` ``` -------------------------------- ### tileIterator() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Provides an iterator for sequentially processing a slide or ROI in a tile-wise fashion at a specified resolution. ```APIDOC ## tileIterator() ### Description Provides an iterator for sequentially iterating through the entire slide or a region of interest (ROI) within the slide at any desired resolution in a tile-wise fashion. ### Parameters #### Query Parameters - **region** (dict) - Optional - ROI within the slide (left, top, width, height, units). - **scale** (dict) - Optional - Desired magnification or resolution. - **tile_size** (dict) - Optional - Size of the tile (width, height). - **tile_overlap** (dict) - Optional - Overlap between adjacent tiles. - **format** (str) - Optional - Format of the tile image (numpy array or PIL image). ### Response - **tile** (object) - Cropped tile image. - **format** (str) - Format of the tile. - **x, y** (int) - (left, top) coordinates in current magnification pixels. - **width, height** (int) - Size of current tile in current magnification pixels. - **level** (int) - Level of the current tile. - **magnification** (float) - Magnification of the current tile. - **mm_x, mm_y** (float) - Size of the current tile pixel in millimeters. - **gx, gy** (int) - (left, top) coordinate in base/maximum resolution pixels. - **gwidth, gheight** (int) - Size of the current tile in base/maximum resolution pixels. ``` -------------------------------- ### Convert region scale with convertRegionScale Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Converts a defined region from one magnification scale to another. The output provides the new coordinates and dimensions in the target units. ```python tr = ts.convertRegionScale( sourceRegion=dict(left=5000, top=5000, width=1000, height=1000, units='mag_pixels'), sourceScale=dict(magnification=20), targetScale=dict(magnification=10), targetUnits='mag_pixels', ) display(tr) ``` -------------------------------- ### HistomicsTK Modules Source: https://digitalslidearchive.github.io/HistomicsTK/genindex.html Lists the available modules within the HistomicsTK library. ```APIDOC ## HistomicsTK Modules This section lists the primary modules available in the HistomicsTK library. ### Modules - histomicstk.annotations_and_masks - histomicstk.annotations_and_masks.annotation_and_mask_utils - histomicstk.annotations_and_masks.annotation_database_parser - histomicstk.annotations_and_masks.annotations_to_masks_handler - histomicstk.annotations_and_masks.annotations_to_object_mask_handler - histomicstk.annotations_and_masks.masks_to_annotations_handler - histomicstk.annotations_and_masks.polygon_merger - histomicstk.annotations_and_masks.polygon_merger_v2 - histomicstk.annotations_and_masks.review_gallery - histomicstk.features - histomicstk.filters - histomicstk.filters.edge - histomicstk.filters.shape - histomicstk.preprocessing - histomicstk.preprocessing.augmentation - histomicstk.preprocessing.color_conversion - histomicstk.preprocessing.color_deconvolution - histomicstk.preprocessing.color_normalization - histomicstk.saliency - histomicstk.saliency.cellularity_detection_superpixels - histomicstk.saliency.cellularity_detection_thresholding - histomicstk.saliency.tissue_detection - histomicstk.segmentation - histomicstk.segmentation.label - histomicstk.segmentation.level_set - histomicstk.segmentation.nuclear - histomicstk.segmentation.positive_pixel_count - histomicstk.utils - histomicstk.workflows - histomicstk.workflows.specific_workflows - histomicstk.workflows.workflow_runner ``` -------------------------------- ### Retrieve Magnification for Pyramid Level Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Returns the magnification and physical pixel size for a specific level in the image pyramid. ```python # Get the magnification associated with Level 0 ts.getMagnificationForLevel(level=0) ``` ```python # Get the magnification associated with all levels of the image pyramid for i in range(ts.levels): print('Level-{} : {}'.format( i, ts.getMagnificationForLevel(level=i))) ``` -------------------------------- ### Retrieve Native Magnification Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Returns the base magnification and physical pixel size of the scanned slide. ```python ts.getNativeMagnification() ``` -------------------------------- ### convertRegionScale() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Converts a defined region from one scale or magnification to another. ```APIDOC ## convertRegionScale() ### Description Converts a region from one scale/magnification to another. ### Parameters - **sourceRegion** (dict) - Required - Dictionary containing left, top, width, height, and units. - **sourceScale** (dict) - Required - Dictionary containing the source magnification. - **targetScale** (dict) - Required - Dictionary containing the target magnification. - **targetUnits** (string) - Required - The units for the target region. ### Request Example ```python tr = ts.convertRegionScale( sourceRegion=dict(left=5000, top=5000, width=1000, height=1000, units='mag_pixels'), sourceScale=dict(magnification=20), targetScale=dict(magnification=10), targetUnits='mag_pixels', ) ``` ### Response - **left** (float) - The converted left coordinate. - **top** (float) - The converted top coordinate. - **width** (float) - The converted width. - **height** (float) - The converted height. - **units** (string) - The units of the result. ``` -------------------------------- ### Retrieve Pyramid Level for Magnification Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Finds the pyramid level that most closely matches a specified magnification or physical pixel width. ```python # get level whose magnification is closest to 10x print('Level with magnification closest to 10x = {}'.format( ts.getLevelForMagnification(10))) ``` ```python # get level whose pixel width is closest to 0.0005 mm print('Level with pixel width closest to 0.0005mm = {}'.format( ts.getLevelForMagnification(mm_x=0.0005))) ``` -------------------------------- ### HistomicsTK Annotations and Masks Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Tools for managing and converting between annotations (e.g., polygons) and image masks, including database parsing and utilities. ```APIDOC ## histomicstk.annotations_and_masks ### Description Tools for handling annotations and masks. ### Capabilities - Annotation database backup and sqlite parser - Mosaic review gallery - Annotations to semantic segmentation masks - Annotations to object segmentation masks - Masks to annotations - Annotation and mask utilities - Polygon merger ``` -------------------------------- ### getLevelForMagnification() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Finds the image pyramid level corresponding to a given magnification or pixel size. ```APIDOC ## getLevelForMagnification(magnification=None, mm_x=None, mm_y=None) ### Description The `getLevelForMagnification()` function of the TileSource class returns the level of the image pyramid associated with a specific magnification or pixel size in millimeters. ### Method GET (or equivalent for object method call) ### Endpoint Not applicable (object method) ### Parameters #### Query Parameters - **magnification** (float) - Optional - The target magnification factor. - **mm_x** (float) - Optional - The target pixel width in millimeters. - **mm_y** (float) - Optional - The target pixel height in millimeters. *Note: At least one of `magnification`, `mm_x`, or `mm_y` must be provided.* ### Request Example ```python # Get level whose magnification is closest to 10x ts.getLevelForMagnification(10) # Get level whose pixel width is closest to 0.0005 mm ts.getLevelForMagnification(mm_x=0.0005) ``` ### Response #### Success Response (200) - **level** (int) - The image pyramid level that best matches the provided criteria. #### Response Example ```json { "level": 7 } ``` ``` -------------------------------- ### Utility Functions and Attributes Source: https://digitalslidearchive.github.io/HistomicsTK/genindex.html Details specific functions and attributes available within HistomicsTK modules. ```APIDOC ## Utility Functions and Attributes This section details specific functions and attributes found within the HistomicsTK library. ### hessian() - **Module**: histomicstk.utils - **Description**: Computes the Hessian matrix. ### initialize_labeled_mask() - **Module**: histomicstk.saliency.cellularity_detection_thresholding - **Method**: CDT_single_tissue_piece - **Description**: Initializes a labeled mask. ### lab_mean_std() - **Module**: histomicstk.preprocessing.color_conversion - **Description**: Calculates the mean and standard deviation in LAB color space. ### lab_to_rgb() - **Module**: histomicstk.preprocessing.color_conversion - **Description**: Converts an image from LAB color space to RGB. ### max_clustering() - **Module**: histomicstk.segmentation.nuclear - **Description**: Performs maximum clustering. ### merge_colinear() - **Module**: histomicstk.utils - **Description**: Merges colinear points or segments. ### min_model() - **Module**: histomicstk.segmentation.nuclear - **Description**: Finds the minimum model. ### hue_value (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the hue value parameter. ### hue_width (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the hue width parameter. ### intensity_lower_limit (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the lower intensity limit parameter. ### intensity_strong_threshold (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the strong intensity threshold parameter. ### intensity_upper_limit (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the upper intensity limit parameter. ### intensity_weak_threshold (Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Parameters - **Description**: Represents the weak intensity threshold parameter. ### IntensityAverage (Output Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Output - **Description**: Represents the average intensity output. ### IntensityAverageWeakAndPositive (Output Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Output - **Description**: Represents the average weak and positive intensity output. ### IntensitySumPositive (Output Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Output - **Description**: Represents the sum of positive intensity output. ### IntensitySumStrongPositive (Output Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Output - **Description**: Represents the sum of strong positive intensity output. ### IntensitySumWeakPositive (Output Attribute) - **Module**: histomicstk.segmentation.positive_pixel_count.Output - **Description**: Represents the sum of weak positive intensity output. ``` -------------------------------- ### HistomicsTK Preprocessing Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Algorithms for preprocessing histopathology images, including color space conversion, deconvolution, normalization, and data augmentation. ```APIDOC ## histomicstk.preprocessing ### Description Algorithms for preprocessing histopathology images. ### Capabilities - Color space conversion - Color deconvolution - Color normalization - Data augmentation ``` -------------------------------- ### getRegion() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Extracts a rectangular region of interest (ROI) from the slide at a specified scale. ```APIDOC ## getRegion() ### Description Reads a rectangular region of interest (ROI) within the slide at any scale or magnification. ### Parameters #### Query Parameters - **region** (dict) - Optional - Dictionary containing (left, top, width, height, units) of the ROI. - **scale** (dict) - Optional - Dictionary containing magnification or physical pixel size (mm_x, mm_y). - **format** (str) - Optional - Format of the returned image. ``` -------------------------------- ### getNativeMagnification() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves the magnification and physical pixel size at the base resolution level of the scanned slide. ```APIDOC ## getNativeMagnification() ### Description The `getNativeMagnification()` function of the TileSource class returns a python dict containing the magnification and physical size of a pixel in millimeters at the base or highest resolution level at which the slide was scanned. ### Method GET (or equivalent for object method call) ### Endpoint Not applicable (object method) ### Parameters None ### Request Example ```python ts.getNativeMagnification() ``` ### Response #### Success Response (200) - **magnification** (float) - The magnification factor. - **mm_x** (float) - The physical width of a pixel in millimeters. - **mm_y** (float) - The physical height of a pixel in millimeters. #### Response Example ```json { "magnification": 20.0, "mm_x": 0.0005015, "mm_y": 0.0005015 } ``` ``` -------------------------------- ### HistomicsTK Saliency (Tissue/Cellularity Detection) Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Algorithms for detecting tissue regions and cellularity within histopathology images. ```APIDOC ## histomicstk.saliency ### Description Algorithms for tissue and cellularity detection. ### Detection Methods - Tissue detection - Cellularity detection (using thresholding) - Cellularity detection (using superpixels) ``` -------------------------------- ### getRegionAtAnotherScale() Source: https://digitalslidearchive.github.io/HistomicsTK/examples/using_large_image.html Retrieves an image of a region at a specified target scale. ```APIDOC ## getRegionAtAnotherScale() ### Description Retrieves an image of a region defined at one scale at a different target scale. ### Parameters - **sourceRegion** (dict) - Required - Dictionary defining the region (left, top, width, height, units). - **targetScale** (dict) - Required - Dictionary containing the target magnification. - **format** (constant) - Required - The output format (e.g., TILE_FORMAT_NUMPY). ### Request Example ```python im_roi, _ = ts.getRegionAtAnotherScale( sourceRegion=dict(left=5000, top=5000, width=10000, height=10000, units='base_pixels'), targetScale=dict(magnification=1.25), format=large_image.tilesource.TILE_FORMAT_NUMPY) ``` ### Response - **im_roi** (numpy.ndarray) - The image data of the requested region. ``` -------------------------------- ### HistomicsTK Segmentation Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Algorithms for segmenting various components within histopathology images, such as cells, nuclei, and boundaries. ```APIDOC ## histomicstk.segmentation ### Description Algorithms for segmenting image components. ### Functions - `embed_boundaries()` - `rag()` - `rag_add_layer()` - `rag_color()` - `simple_mask()` ### Capabilities - Label mask processing - Level-set segmentation - Nuclei segmentation - Positive pixel counting ``` -------------------------------- ### HistomicsTK Features Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Functions for extracting a wide range of features from histopathology images, including cell morphology, intensity, and texture. ```APIDOC ## histomicstk.features ### Description Functions for extracting image features. ### Feature Extraction Functions - `compute_fsd_features()` - `compute_global_cell_graph_features()` - `compute_gradient_features()` - `compute_haralick_features()` - `compute_intensity_features()` - `compute_morphometry_features()` - `compute_nuclei_features()` - `graycomatrixext()` ``` -------------------------------- ### HistomicsTK Filters Source: https://digitalslidearchive.github.io/HistomicsTK/histomicstk.html Image filtering techniques for enhancing specific structures or features within histopathology images. ```APIDOC ## histomicstk.filters ### Description Image filtering techniques for enhancing structures. ### Filter Types - Edge/gradient filters - Shape filters ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.