Skip to content

Releases: slideflow/slideflow

Version 3.0.2

18 Oct 17:36
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 3.0 release notes for details about the latest major release.

Minor features

  • Update cuCIM micron-per-pixel detection. When detecting MPP from TIFF metadata, recognize the singular form of units (centimeter, millimeter, micrometer) in addition to plural form [#420]
  • Add show_progress keyword argument for the feature extractor tfrecord_inference() method, for optionally displaying a progress bar.
  • Add new run_batched_inference() method to pytorch feature extractors, used for generating features from a large tensor dataset of images.
  • When generating features (using a feature extractor) from a loaded pytorch tensor of images, add a new batch_size argument that runs batch inference, decreasing memory requirements:
    ctranspath = sf.build_feature_extractor('ctranspath')
    images = torch.load(...)
    features = ctranspath(images, batch_size=32)
    

Fixes

  • Skip disk logs if Slideflow is in a read-only directory
  • Fix rare TypeError: 'NoneType' object is not subscriptable error when attempting to get an image tile from a slide via indexing and the image tile is invalid (e.g. out of bounds; corrupted; etc)
  • Minor fix to progress bar accuracy during bag generation
  • Fix/remove lifelines requirement [#414]
  • Add numpy 2.0 compatibility to PyTorch dataloaders
  • Require spacy<3.8 to prevent numpy version incompatibility with FastAI
  • Add pyarrow to requirements (required for parquet reading/writing)
  • Fix dataset splitting for survival models
  • Various unit test updates

Version 3.0.1

06 Sep 18:24
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 3.0 release notes for details about the latest major release.

Changes

  • Fix inability to use ImageNet-pretrained feature extractors for generating feature bags [#412]
  • Fix crash in Slideflow Studio when expanding the slide list in the Project widget [#413]
  • Fix rare cupy_backends.cuda.api.runtime.CUDARuntimeError when extracting edge tiles in cuCIM backend
  • Handle ValueError encountered when an out-of-bounds tile cannot be extracted in cuCIM
  • Improve ROI filtering accuracy for whole-slide images when use_edge_tiles=True
  • Add disable_grid argument to sf.WSI, for disabling grid-based extraction (useful for high-magnification cell segmentation extraction)
  • Fix 'outlines_list' not found error with cell segmentation
  • Add missing Studio segmentation sidebar button

Version 3.0.0

17 Aug 03:22
Compare
Choose a tag to compare

Highlights

We are very excited to announce the release of Slideflow 3.0, a pivotal update that not only introduces powerful new features and models but also marks a significant shift in our licensing structure to better support the needs of our community. This release includes three new foundation models, expanded MIL capabilities, faster tissue segmentation, and an improved toolset for Slideflow Studio. Slideflow 3.0 also introduces plugin support for seamless integration of custom tools and models, along with a number of other new features and optimizations.

Table of Contents

  1. Open-Source License
  2. Slideflow Studio Updates
    • New ROI Annotation Tools
    • Tissue Segmentation
    • Improved MIL Support
  3. New Foundation Models
    • Virchow
    • UNI
    • GigaPath
  4. MIL Updates
    • Continuous Outcomes
    • BYOM (Bring Your Own Model)
    • Improved API
  5. Plugin Support
  6. Other New Features
  7. Dependencies

Open-Source License

apache-header

With the release of Slideflow 3.0, we've made significant changes to our licensing structure to better support open-source collaboration and accommodate a broader range of users, from academic researchers to industry professionals. These changes reflect our ongoing commitment to supporting open science while respecting the legal considerations of the third-party tools we integrate.

Core Package: Apache-2.0 License

The core Slideflow package is now licensed under the Apache-2.0 license. This permissive license allows users to freely use, modify, and distribute Slideflow, whether in commercial or non-commercial settings.

Note

While the Apache-2.0 license allows for commercial use, it’s important to remember that Slideflow remains a research-focused tool, developed by a small academic team. We encourage users, especially those considering commercial applications, to thoroughly test and validate the software within their specific environments.

Extensions: Tailored Licensing

To respect the original licenses of various third-party tools integrated into Slideflow, we've created separate extensions with tailored licenses:

  • Slideflow-NonCommercial: Licensed under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0). This package includes advanced tools and models available for non-commercial use only, such as StyleGAN3, BISCUIT, and the newly introduced UNI and GigaPath models.
  • Slideflow-GPL: Licensed under GPL-3.0. This package includes tools that are distributed under the GPL-3.0 license, such as RetCCL, CTransPath, and CLAM models. Users are free to use, modify, and distribute these tools under the same GPL-3.0 license, which requires that derivative works also be open-sourced under the same license. Please note that the authors of these tools have requested that use be restricted to academic, non-commercial purposes.

While all of these tools are accessible for academic, non-commercial use, please be aware that respecting these licenses is important when using Slideflow in a commercial environment to avoid potential legal issues.

How to Install

Installing Slideflow and its extensions is straightforward:

  • Core Slideflow: pip install slideflow
  • Non-Commercial Tools: pip install slideflow-noncommercial
  • GPL-3 Licensed Tools: pip install slideflow-gpl

Slideflow Studio Updates

Version 3.0 brings improved functionality to Slideflow Studio, with more advanced ROI annotation tools, a new tissue segmentation widget, and other performance and quality of life enhancements designed to save you time and effort.

New ROI Tools

Studio now includes two tools for annotating ROIs: a lasso tool and polygon tool. The new polygon tool enables users to more precisely outline tricky features and comes with a new ability to manually edit ROIs that have been created. Although Slideflow Studio does not yet contain a full arsenal of ROI tools you might find in other software, these new additions will make it easier to make minor adjustments directly within Slideflow, decreasing the need to edit ROIs in other software.

Edit_ROIs.mp4

ROIs are now displayed as filled by default, making it easier to both see and interact with slide annotations.

Tissue Segmentation Widget

Tissue segmentation models can now be trained within Slideflow Studio, using ROI annotations also created in Studio. This exciting new functionality means that you can execute a full segmentation experiment - from training to deployment - directly within the UI. For example, you can now annotate tissues with labeled ROIs, train segmentation models, and deploy these models to new slides, all within the same user interface.

Train_Segmentation.mp4

Improved MIL Support

MIL model compatibility for Slideflow Studio has been further expanded. All MIL model architectures, including both classification and regression MIL models, as well as multi-attention and multi-magnification MIL models, can be used for live predictions in Studio.

CLAM_MB.webm

Other Studio Updates

The project pane now contains a tool for filtering a slide list:

Slide_Filter.mp4

New Foundation Models

Slideflow 3.0 includes support for three new foundation models, which serve as excellent feature extractors for downstream classification with multiple-instance learning. These new models include:

  • Virchow: A DINOv2 model from Paige trained on 1.5M WSIs (HuggingFace | Paper)
  • UNI: A DINOv2 model from Mahmood Lab trained on 100K WSIs (GitHub | Paper)
  • Gigapath: A DINOv2 model from Microsoft/Providence trained on 170K WSIs. Includes a slide-level encoder. (GitHub | Paper)

The models can be used the same way all other feature extractors are used. These will require access approval via Hugging Face. Once approved, you can login to your Hugging Face account via huggingfacehub-cli and the weights will be auto-downloaded upon first use. Local weights can also be provided; see our documentation for more information.

GigaPath

GigaPath is unique in offering two stages: a tile encoder and a slide-level encoder. The tile encoder functions like other feature extractors in Slideflow. However, the slide-level encoder provides a unique capability: it takes the tile-level vectors as input and returns a single embedding for the whole-slide image. This feature is especially useful for experiments that require reducing a whole-slide image to a single representation, such as in joint multimodal analysis. GigaPath is described in more detail in the documentation.

MIL Updates

Slideflow 3.0 includes a number of improvements for MIL training, including support for training models with continuous outcomes, an improved API, and better stability & integration with Slideflow Studio.

Continuous Outcomes

MIL models can now be trained with continuous outcomes. In your MIL model configuration, simply set loss to a regression loss function (e.g. mean squared error, or "mse") and ensure that "outcome" refers to a column in your annotations file containing numerical data. You can train with a single continuous outcome or multiple. For example:

import slideflow as sf
from slideflow.mil import mil_config

mil_config = mil_config('attention_mil', loss='mse')
sf.mil.train_mil(..., outcomes=['time_to_event', 'gene_expression'])

When training regression models, Slideflow will report both MSE and Pearson's R on the validation data, rather than AUROC, during training.

BYOM (Bring Your Own Model)

MIL models can now be integrated into Slideflow with new registration functions. With simple model registration and a straightforward interface for creating plugins (as discussed below), you can now easily create and distribute new MIL architectures for the Slideflow ecosystem. See our documentation for more information on MIL model registration and plugin development.

Improved API

Slideflow now includes a more functional API for building and using MIL models in slideflow.mil. See our documentation for instructions on use and a description of the API, which provides access to both high-level and low-level functionality.

Plugin Support

Slideflow now support external plugins via standard Python entry points, allowing you to publish your own package that integrates with Slideflow. By combining plugin support with the capability to register custom MIL models and feature extractors, you can now easily integrate a new foundation model or MIL architecture and make it widely available for people to use with Slideflow.

Please see our documentation for a description of how to design a plugin compatible with Slideflow. We look forward to seeing your contributions!

Other New Features

Slideflow 3.0 brings a number of other new features and enhancements, including:

Feature extractor preprocessing update

Previous...

Read more

Version 2.3.2

09 Aug 18:37
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 2.3 release notes for details about the latest major release.

Changes

  • Improve compatibility checks in Studio for MIL models trained by magnification ("10x") rather than micron size [#365] - thank you @jziggles
  • Fix inability to load multi-class CLAM models in Studio
  • Fix bug where outdir could not be set for Project.train_mil()
  • AUROC plots generated when training an MIL model are now saved in the MIL output directory instead of current working directory
  • Fix "unsupported operand type(s)" error when loading some GANs in Studio
  • Fix bug where Otsu thresholding ignored roi_method='ignore'
  • Fix export of MIL attention heatmaps for multi-dimensional attention models (e.g. CLAM_MB) [#360] - thank you @jziggles
  • Fix sf.mil.get_mil_tile_predictions for CLAM models [#401] = thank you @sz3029
  • Fix bug where slide view in Slideflow Studio would gradually drift / zoom out at some window sizes
  • Improve compatibility with Neptune 2.2.0 [#338] - thank you @luiscarm9
  • Compatibility update for timm >= 1.0 (ctranspath) [#381] - thank you @maxxfarma
  • Loosen seaborn requirements [#373] - thank you @johnurbanik
  • Reduce incidence of Tcl_AsyncDelete: async handler deleted by the wrong thread errors when training MIL models in a loop

Version 2.3.1

11 Jan 18:04
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 2.3 release notes for details about the latest major release.

Changes

  • Fix TypeError when attempting to generate MIL predictions in Studio with a stain normalizer [#346] - thanks @siddhir
  • Fix generation of MIL heatmaps during training & evaluation when using a stride > 1 [#331] - thanks @sz3029

Version 2.3.0

21 Dec 19:17
Compare
Choose a tag to compare

Highlights

We are very happy to release Slideflow 2.3, the highlight of which is the introduction of whole-slide tissue segmentation. Both binary and multiclass tissue segmentation models can be trained from labeled ROIs and deployed for slide QC or used to generate ROIs. This release also adds CycleGAN-based stain normalization, as well as several smaller features and optimizations.

Table of Contents

  1. Tissue Segmentation
    a. Training segmentation models
    b. Using models for QC
    c. Generating ROIs
    d. Deploying in Studio
  2. CycleGAN Stain Normalization
  3. Other New Features
  4. Dependencies
  5. Known Issues

Tissue segmentation

tissue_seg-3.mp4

Slideflow now supports training and deploying tissue segmentation models, both via the programmatic interface as well as in Slideflow Studio. Tissue segmentation models can be trained in binary, multiclass, or multilabel mode using labeled ROIs. Tissue segmentation is performed at the whole-slide level, trained on randomly cropped sections of the slide thumbnail at a specified resolution.

Training segmentation models

Segmentation models are configured using SegmentConfig, which determines the segmentation architecture (U-Net, FPN, DeepLabV3, etc), image resolution for segmentation in microns-per-pixel (MPP), and other training parameters.

from slideflow import segment

# Create a config object
config = segment.SegmentConfig(mpp=20, mode='binary', arch='Unet')

Models can be trained with slideflow.segment.train(). Models will be saved in the given destination directory as model.pth, with an auto-generated segment_config.json file describing the architecture and parameters.

...

# Load a dataset
project = sf.Project(...)
dataset = project.dataset(...)

# Train the model
segment.train(config, dataset, dest='path/to/output')

Once trained, tissue segmentation models can either be used for slide-level QC or to generate ROIs.

Using models for QC

The new slideflow.slide.qc.Segment class provides an easy interface for generating QC masks from a segmentation model (e.g., for a model trained to identify tumor regions, pen marks, etc). This class takes a path to a trained segmentation model as an argument, and otherwise can be used for QC as outlined in the documentation.

import slideflow as sf
from slideflow.slide import qc

# Load the slide
wsi = sf.WSI('/path/to/slide', ...)

# Create the QC algorithm
segmenter = qc.Segment('/path/to/model.pth')

# Apply QC
applied_mask = wsi.qc(segmenter)

For multiclass segmentation models, qc.Segment provides additional arguments to customize how the model should be used for QC.

Generating ROIs

The same qc.Segment class can also be used to generate regions of interest (ROIs). Use Segment.generate_rois() to generate and apply ROIs to a single slide:

...

# Create a QC mask
segmenter = qc.Segment('/path/to/model.pth')

# Generate and apply ROIs to a slide
roi_outlines = segmenter.generate_rois(wsi)

Or use Dataset.generate_rois() to create ROIs for an entire dataset:

import slideflow as sf

# Load a project and dataset.
project = sf.load_project('path/to/project')
dataset = project.dataset()

# Generate ROIs for all slides in the dataset.
dataset.generate_rois('path/to/model.pth')

Deploying in Studio

The slide widget in Studio now has a "Segment" section. A trained segmentation model can be loaded and used for either QC or to generate ROIs. Further details regarding use are available in the documentation.

CycleGAN Stain Normalization

Slideflow now includes a CycleGAN-based stain normalizer, 'cyclegan'. Our implementation is based off of the work by Zingman et al. The stain normalization algorithm is a two-step process utilizing two separate GANs. The H&E image to be transformed is first converted via GAN-1 into Masson's Trichrome (MT), and then converted back to H&E via GAN-2. By default, pretrained weights provided by Zingman will be used, although custom weights can also be provided.

At present, CycleGAN stain normalization requires PyTorch. If you would like us to port GAN normalizers to the Tensorflow backend, please head to our ongoing Discussion and let us know!

This method can be used like any other stain normalizer:

# Configure training parameters
# to use CycleGAN stain normalization
params = sf.ModelParams(..., normalizer='cyclegan')

Other New Features

  • Stain normalizers can now augment an image without also normalizing, using the new .augment() method.

    import slideflow as sf
    
    # Get a Macenko normalizer
    macenko = sf.norm.autoselect('macenko')
    
    # Perform stain augmentation
    img = macenko.augment(img)
  • Expanded support for more tile aggregation methods, for reducing tile-level predictions to slide- or patient-level predictions. The reduce_method argument to Project.train() and .evaluate() now supports 'median', 'sum', 'min', and 'max' (in addition to the previously supported 'average' and 'proportion'), as well as arbitrary callable functions. For example, to define slide-level predictions as the 75th percentile of tile-level predictions:

    Project.train(
        ...
        reduce_method=lambda x: np.percentile(x, 75)
    )
  • New utility function Dataset.get_unique_roi_labels() for getting a list of all unique ROI labels in a dataset.

  • Improve inference speed of PyTorch feature extractors when called on uint8 images.

  • Much faster generation of tile-level predictions for MIL models

  • Add function sf.mil.get_mil_tile_predictions(), which functions the same as sf.mil.save_mil_tile_predictions() but returns a pandas dataframe

  • Add ability to calculate tile-level uncertainty for MIL models trained with UQ, by passing uq=True to sf.mil.get_mil_tile_predictions()

Dependencies

Dependencies are largely unchanged. Updates include:

  • Tissue segmentation requires the segmentation-models-pytorch package.

Known Issues

  • Tissue segmentation is performed at the whole-slide level (based on cropped thumbnails), and performs best at lower magnifications (microns-per-pixel of 10 or greater). Attempting to train or deploy a tissue segmentation model at higher magnification may significantly increase memory requirements. Optimization work is ongoing to reduce memory requirements when training and deploying tissue segmentation models that operate at higher magnification.

Version 2.2.2

20 Dec 22:01
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 2.2 release notes for details about the latest major release.

Changes

  • Fix bug with GPU stain augmentation in PyTorch (ValueError: Stain augmentation (n) requires a stain normalizer, which was not provided)
  • Fix bug with generating intermediate layer activations from a pytorch model
  • Fix bug in Otsu's thresholding if roi_method == 'outside' (#340) - thanks @matte-esse
  • Improve handling of edge case where there is 1 tile in a slide
  • Fix rare "LiveError" when generating feature bags
  • Slideflow Studio: fix handling the case where there are no tiles in a slide (e.g. a JPEG image smaller than the tile size)
  • Slideflow Studio [Cellpose extension]: Fix inconsistent transparency for displayed masks when zooming out
  • Slideflow Studio [Cellpose extension]: Fix bug with whole-slide cell segmentation

Version 2.2.1

24 Nov 17:09
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 2.2 release notes for details about the latest major release.

Changes

  • Fix ballooning memory requirements when training MIL models on large datasets for many epochs
  • Fix documentation typo (#337) - thanks @luiscarm9
  • Fix stain augmentation string parsing in PyTorch (#335) - thanks @luiscarm9
  • Fix bug when specifying normalizer=None during feature bag generation
  • Fix bug where feature generation from a WSI would hang when using a PyTorch feature extractor and non-OpenCV stain normalizer
  • Fix slide thumbnail orientation when using a transformation (rotation)
  • Fix bug with WSI.align_tiles_to(..., align_by='tile')
  • Fix rendering of ALT hover and ROI labeling in Slideflow Studio on high-DPI devices
  • Add support for loading float16 bags for MIL models, auto-converting to float32
  • Improve check for empty arrays in DatasetFeatures (#332) - thanks @Mr-Milk
  • Add forward compatibility for upcoming MIL hyperparameters

Version 2.2.0

31 Oct 01:38
b756fc0
Compare
Choose a tag to compare

Highlights

Slideflow 2.2 further extends multiple-instance learning (MIL) capabilities, with the introduction of multi-magnification MIL, new models, experimental uncertainty quantification, and various other enhancements. This release also includes two new pretrained feature extractors - HistoSSL and PLIP - as well as support for the self-supervised learning framework, DINOv2. Slideflow Studio has been updated with several new features and quality of life improvements. Finally, the documentation has been enriched with Developer Notes and new tutorials, providing deeper insights on select topics.

Table of Contents

  1. Multi-Magnification MIL
  2. New Feature Extractors
    a. Pretrained
    b. DINOv2
  3. New MIL Features
  4. Slideflow Studio Updates
  5. Documentation Expansion
  6. Other New Features
  7. Version Requirements

Multi-Magnification MIL

Slideflow now supports multi-modal MIL, with feature bags generated from multiple feature extractors at different magnifications. Multi-magnification MIL offers potential advantages if there are valuable histologic features at both low and high magnification.

Working with multi-magnification MIL is easy - you can use the same training API as standard MIL models. Simply provide multiple bag paths (one for each magnification) and use the new "mm_attention_mil" model.

# Configure a multimodal MIL model.
config = mil_config('mm_attention_mil', lr=1e-4)

# Set the bags paths for each modality.
bags_10x = '/path/to/bags_10x'
bags_40x = '/path/to/bags_40x'

P.train_mil(
    config=config,
    outcomes='HPV_status',
    train_dataset=train,
    val_dataset=val,
    bags=[bags_10x, bags_40x]
)

Slideflow Studio also supports multi-magnification MIL models, allowing you to visualize attention and tile-level predictions from each mode separately.

New Feature Extractors

We've introduced support for two new pretrained feature extractors, as well as the self-supervised learning framework DINOv2.

Pretrained

The new pretrained feature extractors include:

  • HistoSSL: a pan-cancer, pretrained ViT-based iBOT model (iBOT[ViT-B]PanCancer). Paper
  • PLIP: feature encoder used for a CLIP model finetuned on pathology images and text descriptions. Paper

Licenses and citations are available for all feature extractors through the new .license and .citation attributes.

>>> ctranspath = sf.model.build_feature_extractor('ctranspath', tile_px=299)
>>> ctranspath.license
'GNU General Public License v3.0'
>>> print(ctranspath.citation)

@{wang2022,
  title={Transformer-based Unsupervised Contrastive Learning for Histopathological Image Classification},
  author={Wang, Xiyue and Yang, Sen and Zhang, Jun and Wang, Minghui and Zhang, Jing  and Yang, Wei and Huang, Junzhou  and Han, Xiao},
  journal={Medical Image Analysis},
  year={2022},
  publisher={Elsevier}
}

DINOv2

As with SimCLR, Slideflow now supports generating features from a trained DINOv2 model. Use the feature extractor 'dinov2', and pass the *.pth teacher weights to the argument weights, and the YAML configuration file to the argument cfg:

dinov2 = sf.model.build_feature_extractor(
  'dinov2',
  weights='/path/to/teacher_checkpoint.pth',
  cfg='/path/to/config.yaml'

We've also provided a modified version of DINOv2 that allows you to train the network using Slideflow projects and datasets. See our documentation for instructions on how to train and use DINOv2.

New MIL Features

Slideflow 2.2 includes a number of updates in MIL functionality, including:

  • A new fully-transformer model, "bistro.transformer" (from this paper)

  • New aggregation_level MIL config option. If any patients have multiple slides, use aggregation_level="patient". (#316)

  • MIL models can be further customized with a new argument mil_config(model_kwargs={...}). Use model_kwargs in the MIL configuration to pass through keyword arguments to the model initializer. This can be used, for example, to specify the softmax temperature and attention gating for the Attention_MIL model through the model keyword arguments temperature and attention_gate.

    from slideflow.mil import mil_config
    
    config = mil_config(
      'attention_mil',
      model_kwargs={'temperature': 0.3},
      ...
    )
  • New experimental uncertainty quantification support for MIL models. Enable uncertainty estimation with the argument uq=True to either P.train_mil or P.evaluate_mil. The model must support a uq argument in it's forward() function. At present, MIL UQ is only available for the Attention_MIL model.

  • New class initializer DatasetFeatures.from_bags(), for loading a DatasetFeatures objects from previously generated feature bags. This makes it easier to perform latent space exploration and visualization, using DatasetFeatures.map_activations() (see docs)

  • New sf.mil.MILFeatures class to assist with calculating and visualizing last-layer activations from MIL models, prior to final logits. This class is analogous to the DatasetFeatures interface, but for MIL model layer activations.

Slideflow Studio Updates

The latest version of Slideflow Studio includes a number of usability improvements and new features.

  • ROI labels: You can now assign labels to Regions of Interest (ROIs) in Studio. These labels can be used for downstream strongly-supervised training, where labels are determined from ROIs rather than inherited from the slide label.
  • ALT hover: Press Left ALT while hovering over a heatmap to show the raw prediction/attention values beneath your cursor.
  • Progress bars: A progress bar is now displayed when generating predictions for a slide.
  • Tile predictions with MIL: Show tile-level predictions and attention for MIL models by right-clicking anywhere on a slide
  • GAN seed tracking: Keep track of GAN seeds with easy saving and loading. Quickly scroll through seeds by pressing left/right on your keyboard.
  • Scale sidebar icons with font size
  • Improved low-memory mode for MIL models (supports devices with < 8 GB RAM)
  • Preserve ROIs and slide settings when changing models
  • Default to Otsu's thresholding instead of grayspace filtering, for improved efficiency
  • Various bug fixes and stability improvement

Documentation Expansion

Documentation at https://slideflow.dev has been further expanded, and a new Developer Notes section has been added. Developer Notes are intended to provide a deeper dive into selected topics of interest for developers or advanced users. Our first developer notes include:

  • TFRecords: Reading and Writing: a detailed description of our TFRecord data format, with examples of how to create, inspect, and read from these files.
  • Dataloaders: Sampling and Augmentation: descriptions of how to create PyTorch DataLoaders or Tensorflow tf.data.Datasets and apply custom image transformations, labeling, and sampling. Includes a detailed examination of our oversampling and undersampling methods.
  • Custom Feature Extractors: A look at how to construct custom feature extractors for MIL models.
  • Strong Supervision with Tile Labels: An example of how Region of Interest (ROI) labels can be leveraged for training strongly-supervised models.

In addition to these new Dev Notes, we've also added two tutorials (Tutorial 7: Training with Custom Augmentations and Tutorial 8: Multiple-Instance Learning), as well as expanded our Slideflow Studio docs to reflect the latest features.

Other New Features

  • Align two slides together using sf.WSI.align_to(). This coarse alignment is fast and effective for slides in the proper orientation, without distortion. Use the more accurate sf.WSI.align_tiles_to() method for a higher accuracy alignment, finetuned at each tile location.

  • Rotate a whole-slide image upon initial load using the new transforms argument [Libvips only]. This is particularly useful when attempting to align slides:

    wsi = sf.WSI(..., transforms=[sf.slide.ROTATE_90_CLOCKWISE])
  • Use OpenSlide bounding boxes, if present, with the new WSI argument use_bounds [Libvips only]. If True, will use existing OpenSlide bounding boxes. If a tuple, will crop the whole-slide image to the specified bounds. This is particularly useful when aligning slides.

    # Use OpenSlide bounds
    wsi = sf.WSI(..., use_bounds=True)
    
    # Manually define the bounding box
    wsi = sf.WSI(..., use_bounds=(41445, 112000, 48000, 70000))
  • New Indexable PyTorch dataset, for easier integration of Slideflow datasets into external projects

  • Improved progress bars during tfrecord interleaving

  • Add support for protobuf version 4

  • Train GANs at odd image sizes with the new resize argument (see docs)

  • Train a GAN conditioned on tile-level labels (see docs)

Version Requirements

Version requirements are largely unchanged. Notable differences include:

  • The new PLIP feature extractor requires the transformers package.
  • ...
Read more

Version 2.1.1

02 Oct 15:40
Compare
Choose a tag to compare

This is a minor, bug-fix release. See the Version 2.1 release notes for details about the latest major release.

Changes

  • Fix error when providing a feature extractor argument to sf.mil.predict_slide() [#310] (thanks @bplee)
  • Fix Neptune logging with latest API [#312, #313, #314] (thanks @luiscarm9)
  • Fix unknown argument save_checkpoints when performing SMAC hyperparameter search in PyTorch [#309]
  • Fix MIL inference support on MacOS (MPS) devices
  • Fix attention heatmap generation from MIL model TransMIL
  • Fix feature generation during MIL inference from finetuned SimCLR model
  • Opening a slide in Studio with WSI.view() will load the slide at the same tile_px/tile_um
  • Dataset.rebuild_index() will now remove old index files, fixing various allow_pickle errors when using old TFRecords
  • Fix minor inconsistency in masking algorithm with Reinhard between OpenCV/Numpy and Tensorflow/PyTorch implementations
  • Fix "Random pixel interpolation not implemented" error when using augment=True
  • Minor documentation typo fixes