fusion_tools package
- fusion_tools.components package
- fusion_tools.components.maps module
ChannelMixerMapComponentMultiFrameSlideMapSlideImageOverlaySlideMapSlideMap.add_manual_roi()SlideMap.download_manual_roi()SlideMap.export_image_overlay_bounds()SlideMap.gen_image_mover()SlideMap.gen_layout()SlideMap.get_callbacks()SlideMap.get_click_popup()SlideMap.get_image_overlay_popup()SlideMap.get_namespace()SlideMap.get_scale_factors()SlideMap.load()SlideMap.make_geojson_layers()SlideMap.move_image_overlay()SlideMap.update_image_overlay_transparency()SlideMap.update_layout()SlideMap.update_slide()SlideMap.update_vis_session()SlideMap.upload_shape()
- fusion_tools.components.tools module
GlobalPropertyPlotterGlobalPropertyPlotter.extract_all_properties()GlobalPropertyPlotter.extract_property_info()GlobalPropertyPlotter.gen_layout()GlobalPropertyPlotter.gen_scatter_plot()GlobalPropertyPlotter.gen_umap_cols()GlobalPropertyPlotter.gen_violin_plot()GlobalPropertyPlotter.generate_plot()GlobalPropertyPlotter.generate_property_dict()GlobalPropertyPlotter.get_callbacks()GlobalPropertyPlotter.load()GlobalPropertyPlotter.parse_filter_divs()GlobalPropertyPlotter.select_data_from_plot()GlobalPropertyPlotter.update_drop_type()GlobalPropertyPlotter.update_filter_properties()GlobalPropertyPlotter.update_properties_and_filters()GlobalPropertyPlotter.update_property_selector()
HRAViewerMultiToolOverlayOptionsOverlayOptions.add_filter()OverlayOptions.add_structure_line_color()OverlayOptions.adv_update_overlays()OverlayOptions.create_layer_from_filter()OverlayOptions.export_layers()OverlayOptions.gen_layout()OverlayOptions.get_callbacks()OverlayOptions.load()OverlayOptions.parse_added_filters()OverlayOptions.update_filter_selector()OverlayOptions.update_overlays()OverlayOptions.update_slide()
PropertyPlotterPropertyPlotter.extract_data_from_features()PropertyPlotter.extract_property()PropertyPlotter.gen_layout()PropertyPlotter.gen_scatter_plot()PropertyPlotter.gen_selected_div()PropertyPlotter.gen_umap_cols()PropertyPlotter.gen_violin_plot()PropertyPlotter.generate_property_dict()PropertyPlotter.get_callbacks()PropertyPlotter.load()PropertyPlotter.make_property_plot_tabs()PropertyPlotter.remove_marker_label()PropertyPlotter.select_data_from_plot()PropertyPlotter.sub_select_data()PropertyPlotter.update_property_graph()PropertyPlotter.update_slide()PropertyPlotter.update_sub_div()
PropertyViewerTool
- fusion_tools.components.maps module
- fusion_tools.utils package
- fusion_tools.utils.shapes module
align_object_props()convert_histomics()detect_geojson()detect_histomics()export_annotations()extract_geojson_properties()extract_listed_prop()extract_nested_prop()find_intersecting()find_nested_levels()load_annotations()load_aperio()load_geojson()load_histomics()load_label_mask()load_polygon_csv()load_visium()merge_dict()path_to_indices()path_to_mask()process_filters_queries()spatially_aggregate()
- fusion_tools.utils.shapes module
- fusion_tools.visualization package
- fusion_tools.visualization.components module
VisualizationVisualization.check_for_uploader()Visualization.gen_header_components()Visualization.gen_layout()Visualization.get_callbacks()Visualization.get_layout_children()Visualization.initialize_stores()Visualization.open_header()Visualization.open_header_component()Visualization.open_navbar()Visualization.start()Visualization.update_page()Visualization.update_page_layout()
- fusion_tools.visualization.vis_utils module
- fusion_tools.visualization.components module
fusion_tools.handler module
- class fusion_tools.handler.DSATool
Bases:
ToolA sub-class of Tool specific to DSA components. The only difference is that these components always update relative to the session data.
- Parameters:
Tool (None) – General class for components that perform visualization and analysis of data.
- class fusion_tools.handler.Handler
Bases:
object
fusion_tools.tileserver module
Tile server components
- class fusion_tools.tileserver.CustomTileServer(tiles_url: str, regions_url: str, image_metadata: dict, annotations_url: str | None = None, name: str = None)
Bases:
TileServerCustomTileServer component if using some other tiles endpoint (must pass tileSize and levels in dictionary)
- class fusion_tools.tileserver.DSATileServer(api_url: str, item_id: str, user_token: str | None = None)
Bases:
TileServerUse for linking visualization with remote tiles API (DSA server)
- class fusion_tools.tileserver.LocalTileServer(local_image_path: str | list | None = [], local_image_annotations: str | list = [], tile_server_port: int = 8050, host: str = 'localhost')
Bases:
TileServerTile server from image saved locally. Uses large-image to read and parse image formats (default: [common])
- add_new_image(new_image_path: str, new_annotations: str | list | dict | None, new_metadata: dict | None = None)
- get_annotations(image: int)
- get_metadata(image: int)
Getting large-image metadata for image
- Returns:
Dictionary containing metadata for local image
- Return type:
Response
- get_name_annotations_url(name)
- get_name_metadata_url(name)
- get_name_regions_url(name)
- get_name_tiles_url(name)
- get_names()
- get_region(image: int, top: int, left: int, bottom: int, right: int, style: str = '')
Grabbing a specific region in the image based on bounding box coordinates
- get_thumbnail(image: int)
Grabbing an image thumbnail
- Parameters:
image (int) – _description_
- get_tile(image: int, z: int, x: int, y: int, style: str = '')
Tiles endpoint, returns an image tyle based on provided coordinates
- Parameters:
z (int) – Zoom level for tile
x (int) – X tile coordinate
y (int) – Y tile coordinate
style (dict, optional) – Additional style arguments to pass to large-image, defaults to {}
- Returns:
Image tile containing bytes encoded pixel information
- Return type:
Response
- load_annotations()
- root()
- start()
Starting tile server instance on a provided port
- Parameters:
port (str, optional) – Tile server port from which tiles are accessed, defaults to ‘8050’
- class fusion_tools.tileserver.TileServer
Bases:
objectComponents which pull information from a slide(s)
fusion_tools.dataset module
Dataset sub-module for fusion-tools
- class fusion_tools.dataset.ClassificationDataset(slides: list = [], annotations: list | dict | None = None, label_property: list | str | None = None, transforms: None | Callable = None, label_transforms: None | Callable = None, patch_size: list = [256, 256], patch_mode: str = 'bbox', patch_region: str | list | dict = 'all', spatial_filters: list | None = None, property_filters: list | None = None, use_structures: str | list = 'all', use_cache: bool = True, shuffle: bool = True, seed_val: int = 1701, verbose: bool = False, use_parallel: bool = True, n_jobs: int = 1)
Bases:
object- export_configs(save_path: str)
- gen_slide_patches()
- get_next_image(idx: int)
- make_image_and_label(bbox: list, slide_idx: int, features: list)
- make_patch(bbox: list, slide_idx: int, annotations: GeoDataFrame)
- plant_seed(seed_val)
- process_annotations()
- class fusion_tools.dataset.FUSIONDataset(slides: list = [], annotations: list | dict | None = None, image_transforms: Callable | None = None, target_transforms: Callable | None = None, patch_size: list = [256, 256], patch_mode: str = 'bbox', patch_region: str | list | dict = 'all', overlap: float | None = None, spatial_filters: list | None = None, property_filters: list | None = None, use_cache: bool = False, shuffle: bool = True, seed_val: int = 1701, verbose: bool = False, use_parallel: bool = True, n_jobs: int = 1)
Bases:
object- find_tissue()
- gen_slide_patches()
- plant_seed(seed_val)
- process_annotations()
- class fusion_tools.dataset.SegmentationDataset(slides: list = [], annotations: list | dict | None = None, transforms: None | Callable = None, target_transforms: None | Callable = None, mask_key: dict | None = None, patch_size: list = [256, 256], patch_mode: str = 'bbox', patch_region: str | list | dict = 'all', spatial_filters: list | None = None, property_filters: list | None = None, use_structures: str | list = 'all', use_cache: bool = True, shuffle: bool = True, seed_val: int = 1701, verbose: bool = False, use_parallel: bool = True, n_jobs: int = 1)
Bases:
object- export_configs(save_path: str)
- find_tissue(slide_tile_source, slide_metadata)
- gen_slide_patches()
- get_next_image(idx: int)
- make_image_and_mask(bbox: list, slide_idx: int, features: list)
- make_patch(bbox: list, slide_idx: int, annotations: GeoDataFrame)
- plant_seed(seed_val)
- process_annotations()
fusion_tools.feature_extraction module
Feature extraction functions
- class fusion_tools.feature_extraction.ParallelFeatureExtractor(image_source: str | TileServer = None, feature_list: list = [], preprocess: Callable | None = None, sub_mask: Callable | None = None, mask_names: list | None = None, channel_names: list | None = None, n_jobs: None = None, verbose: bool = False)
Bases:
objectThis class is for extracting multiple types of features at the same time using joblib
- extract_features(region: dict) dict
- get_bbox(coords: list) list
- make_mask(coords: list) ndarray
- merge_dict(a: dict, b: dict, path=[])
- read_image_region(coords: list) ndarray
- start(region_list: list) DataFrame
- update_dict_keys(input_dict: dict)
- fusion_tools.feature_extraction.color_features(image: ndarray, mask: ndarray, coords: list) dict
Calculate “color” features for each label in mask within image (color defined as channel statistics)
- Parameters:
image (np.ndarray) – Input image region
mask (np.ndarray) – Mask of regions to include in the feature calculation (0=background)
coords (list) – Coordinates of this specific image (not used)
- Returns:
Dictionary containing key/value pairs for each feature extracted (Mean, Median, Maximum, Std)
- Return type:
dict
- fusion_tools.feature_extraction.distance_transform_features(image: ndarray, mask: ndarray, coords: list) dict
Function to calculate distance transform features for each label in “mask”
- Parameters:
image (np.ndarray) – Input image region (not used)
mask (np.ndarray) – Mask of regions to include in the feature calculation (0=background)
coords (list) – Coordinates of this specific image (not used)
- Returns:
Dictionary containing key/value pairs for each feature extracted (Mean, Median, Maximum, Sum)
- Return type:
dict
- fusion_tools.feature_extraction.morphological_features(image: ndarray, mask: ndarray, coords: list) dict
Calculate morphological features for each label in mask within image.
- Parameters:
image (np.ndarray) – Input image region (not used)
mask (np.ndarray) – Mask of regions to include in the feature calculation (0=background)
coords (list) – Coordinates of this specific image (not used)
- Returns:
Dictionary containing key/value pairs for each feature extracted (Contrast, Homogeneity, Correlation, Energy)
- Return type:
dict
- fusion_tools.feature_extraction.relative_distance(input_shapes: dict, other_shapes: dict | list) list
Calculate relative distance statistics between each Feature in “input_shapes” (GeoJSON FeatureCollection) and each Feature in each FeatureCollection in “other_shapes”
- Parameters:
input_shapes (dict) – FeatureCollection containing Features to calculate relative distance statistics for each FeatureCollection in other_shapes
other_shapes (Union[dict,list]) – List of multiple FeatureCollections or single FeatureCollection where relative distance statistics are calculated off of for input_shapes
- fusion_tools.feature_extraction.texture_features(image: ndarray, mask: ndarray, coords: list) dict
Calculate texture features for each label in mask within image.
- Parameters:
image (np.ndarray) – Input image region
mask (np.ndarray) – Mask of regions to include in the feature calculation (0=background)
coords (list) – Coordinates of this specific image (not used)
- Returns:
Dictionary containing key/value pairs for each feature extracted (Contrast, Homogeneity, Correlation, Energy)
- Return type:
dict
- fusion_tools.feature_extraction.threshold_channels(input_image: ndarray, threshold_method: str | None = None) ndarray
Example preprocessing function that thresholds each channel in the input image according to some method
- Parameters:
input_image (np.ndarray) – Input image region (Y,X,C)
threshold_method (Union[str,None], optional) – Method to use for thresholding (None is set to Otsu’s), defaults to None
- Returns:
Returns image with each channel thresholded independently
- Return type:
np.ndarray