Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Codespell configuration is within pyproject.toml
---
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2
20 changes: 10 additions & 10 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Version 1.0.3 (January 25, 2024)
#. Setting :code:`colormap=None` to the various save functions will not add any color channels, and so the slide viewer's default colormaps will be used.
#. Updated :code:`slide_io.get_slide_reader` to give preference to reading images with libvips/openslide. Should be faster since image will not need to be constructed from tiles.
#. JVM will only be initialized if bioformats is needed to read the image.
#. Updated :code:`slide_io.VipsSlideReader` to use the ome-types pacakge to extract metadata, instead of Bio-formats. Should avoid having to launch JVM unless Bio-formats is really needed.
#. Updated :code:`slide_io.VipsSlideReader` to use the ome-types package to extract metadata, instead of Bio-formats. Should avoid having to launch JVM unless Bio-formats is really needed.
#. Added checks to ensure that channels in merged image are in the correct order when :code:`imgs_ordered=True`, addressing the comment `github issue 56 <https://github.com/MathOnco/valis/issues/56#issuecomment-1821050877>`_ .
#. Added tests for images with minimal ome-xml (i.e. no channel names, units, etc...)
#. Removed usage of :code:`imghdr`, which is being deprecated
Expand Down Expand Up @@ -88,11 +88,11 @@ Version 1.0.0rc15 (May 10, 2023)
Version 1.0.0rc14 (April 24, 2023)
-------------------------------------
#. Added :code:`max_ratio` as an argument for :code:`feature_matcher.match_desc_and_kp` (github issue 36).
#. Added :code:`CziJpgxrReader` to read CZI images that have JPGXR compression but can't be opened with Bioformats. It's very limited and experimental (only tested with single scence RGB), but may be an issue specific to Apple silcon?
#. Added :code:`CziJpgxrReader` to read CZI images that have JPGXR compression but can't be opened with Bioformats. It's very limited and experimental (only tested with single scene RGB), but may be an issue specific to Apple silcon?
#. Supports scenario where images might be assigned the same name (e.g. same file names, but different directories).
#. Support tiling for initial non-rigid registration, making it possible to perform non-rigid on much larger images
#. Skips empty images (github issue 44).
#. Can now specify an :code:`ImageProcesser` for each image by passing a dicitonary to the :code:`processor_dict` argrument of :code:`Valis.register`. Keys should be the filename of the image, and values a list, where the first element is the :code:`ImageProcesser` to use, and the second element is a dictionary of keyword argruments passed to :code:`ImageProcesser.process_image`. This should make it easier to register different image modalities.
#. Can now specify an :code:`ImageProcesser` for each image by passing a dictionary to the :code:`processor_dict` argrument of :code:`Valis.register`. Keys should be the filename of the image, and values a list, where the first element is the :code:`ImageProcesser` to use, and the second element is a dictionary of keyword argruments passed to :code:`ImageProcesser.process_image`. This should make it easier to register different image modalities.
#. Added an H&E color deconvolution :code:`ImageProcesser` using the method described in M. Macenko et al., ISBI 2009. Generously provided by Github user aelskens (Arthur Elskenson) (PR 42).
#. Small improvements in :code:`valtils` functions, provided by Github user ajinkya-kulkarni (Ajinkya Kulkarni) (PR 46).
#. Docker Images bundled with bioformats jar file, so does not require internet connection or Maven. Also now checks for bioformats jar in valis folder
Expand All @@ -109,7 +109,7 @@ Version 1.0.0rc13 (January 31, 2023)
#. Fixed bug reported in `github issue 33 <https://github.com/MathOnco/valis/issues/33>`_
#. Default is to not compose non-rigid transformations, reducing accumulation of unwanted distortions, especially in 3D.
#. The :code:`scale_factor` parameter for :code:`feature_detectors.VggFD` is now set to 5.0, as per the OpenCV documentation
#. Installlation now uses `poetry <https://python-poetry.org/>`_ via the pyproject.toml file. Includes a poetry.lock file, but it can be deleted before installation if so desired.
#. Installation now uses `poetry <https://python-poetry.org/>`_ via the pyproject.toml file. Includes a poetry.lock file, but it can be deleted before installation if so desired.
#. Removed bioformats_jar as a dependency
#. Added a datasets page
#. Moved examples to separate page
Expand All @@ -120,7 +120,7 @@ Version 1.0.0rc12 (November 7, 2022)
#. Fixed bug where would get out of bounds errors when cropping with user provided transformations (github issue 14 https://github.com/MathOnco/valis/issues/14)
#. Fixed bug where feature matches not drawn in correct location in :code:`src_img` in :code:`viz.draw_matches`.
#. Can now check if refelcting/mirroring/flipping images improves alignment by setting :code:`check_for_reflections=True` when initializing the :code:`Valis` object. Addresses githib issue 22 (https://github.com/MathOnco/valis/issues/22)
#. Channel colors now transfered to registered image (github issue 23 https://github.com/MathOnco/valis/issues/23). Also option to provide a colormap when saving the slides. This replaces the :code:`perceputally_uniform_channel_colors` argument
#. Channel colors now transferred to registered image (github issue 23 https://github.com/MathOnco/valis/issues/23). Also option to provide a colormap when saving the slides. This replaces the :code:`perceputally_uniform_channel_colors` argument


Version 1.0.0rc11 (August 26, 2022)
Expand Down Expand Up @@ -151,13 +151,13 @@ Version 1.0.0rc8 (July 1, 2022)

Version 1.0.0rc7 (June 27, 2022)
--------------------------------
#. Can set size of image to be used for non-rigid registration, which may help improve aligment of micro-architectural structures. However this will increase the amount of time it takes to perform non-rigid registration, and will increase amount of memory used during registration, and the size of the pickled :code: `Valis` object. To change this value, set the :code:`max_non_rigid_registartion_dim_px` parameter when initializing the :code:`Valis` object.
#. Can now do a second non-rigid registartion on higher resolution images, including the full resolution one. This can be done with the :code:`Valis.register_micro`. If the images are large, they will be sliced into tiles, and then each tile registered with one another. The deformation fields will be saved separately as .vips images within the data folder.
#. Can set size of image to be used for non-rigid registration, which may help improve alignment of micro-architectural structures. However this will increase the amount of time it takes to perform non-rigid registration, and will increase amount of memory used during registration, and the size of the pickled :code: `Valis` object. To change this value, set the :code:`max_non_rigid_registartion_dim_px` parameter when initializing the :code:`Valis` object.
#. Can now do a second non-rigid registration on higher resolution images, including the full resolution one. This can be done with the :code:`Valis.register_micro`. If the images are large, they will be sliced into tiles, and then each tile registered with one another. The deformation fields will be saved separately as .vips images within the data folder.
#. Added :code:`registration.load_registrar` function to open a :code:`Valis` object. This should be used instead of `pickle.load`.
#. Creating and applying tissue masks before registration. This improves image normalization, reduces the number of poor feature matches, and helps remove unwanted non-rigid deformations (especially around the image edges), all of which improve alignment accuracy. This step can be skipped by setting :code:`create_masks` to `False` when initializing the :code:`Valis` object.
#. Now possible to directly non-rigidly align to the reference image specified by :code:`reference_img_f`. This can be done by setting :code:`align_to_reference` to `True` when initializing the :code:`Valis` object. The default is `False`, which means images will be aligned serially towards the reference image. This option is also available with :code:`Valis.register_micro`, meaning that one could do a second alignment, but aligning all directly to a reference image.
#. RANSAC filtered matches found for rigid registration undergo second round of filtering, this time using Tukey's method to remove matches whose distance after being warped would be considered outliers.
#. Now have option off whether or not to compose non-rigid transformations. This can be set specifying the :code:`compose_non_rigid` argument when initialzing the `Valis` object.
#. Now have option off whether or not to compose non-rigid transformations. This can be set specifying the :code:`compose_non_rigid` argument when initializing the `Valis` object.
#. Can provide rigid transformation matrices by passing in a dictionary to the :code:`do_rigid` parameter when initializing the :code:`Valis` object. Setting :code:`do_rigid` to `False` will completely skip the rigid registration step. See the documentation for initializing the `Valis` object for more details.
#. Added examples of how to read slides and use custom transforms
#. Benchmarked using ANHIR Grand Challenge dataset and posted results on leaderboard.
Expand All @@ -175,12 +175,12 @@ Version 1.0.0rc5 (April 5, 2022)
---------------------------------
#. Can provide a reference image that the others will be aligned towards. To do this, when initializinig the Valis object, set the :code:`reference_img_f` argument to be the file name of the reference image. If not set by the user, the reference image will be set as the one at the center of the ordered image stack
#. Both non-rigid and rigid now align *towards* a reference image, meaning that reference image will have neither rigid nor non-rigid transformations applied to it.
#. Two cropping methods. First option is to crop seach registered slides to contain only the areas where all registered images overlap. The second option is to crop the registered slide to contain only the area that intersects with the reference image. It is also possible to not crop an image/slide.
#. Two cropping methods. First option is to crop each registered slides to contain only the areas where all registered images overlap. The second option is to crop the registered slide to contain only the area that intersects with the reference image. It is also possible to not crop an image/slide.
#. Images are now cropped during the warp, not after, and so is now faster and requires less memory. For example, on a 2018 MacBook Pro with a 2.6 GHz Intel Core i7 processor, it takes 2-3 minutes to warp and save a 41399 x 43479 RGB image.
#. Warping of images and slides done using the same function, built around pyvips. Faster, more consistent, and should prevent excessive memory usage.
#. Fixed bug that caused a crash when warping large ome.tiff images.
#. Read slides and images using pyvips whenever possible.
#. Background color now automatically set to be same as the brightest (IHC) or darkest (IF) pixel in the image. Because of this, the "bg_color" argument in the slide warping functions was removed.
#. Reduced accumulation of unwanted non-rigid deformations
#. Displacement fields drawn on top of non-rigid registered image to help determine where the deformations occured.
#. Displacement fields drawn on top of non-rigid registered image to help determine where the deformations occurred.
#. If a slide has multiple series, and a series is not specficed, the slide reader will read the series containing the largest image.
2 changes: 1 addition & 1 deletion docs/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ As ACROBAT measures error in μm, and VALIS estimates error based on matched fea
Kartasalo et al 2018
=====================

Another potential use of image registration is to construct a 3D tissue from serial slices. In 2018, `Kartasalo et al. (2018) <https://academic.oup.com/bioinformatics/article/34/17/3013/4978049>`_ performed a study in which they compared several different frameworks for constructing 3D images, using both free and commercial software. They peformed the analysis using two datasets: one murine prostate to be reconstructed from 260 serially sliced 20x H&E images (0.46μm/pixel, 5μm in depth), and one murine liver to be reconstructed from 47 serial slices (0.46μm/pixel, 5μm in depth). Accuracy of the alignment of the liver can be determined using the positions of laser cut holes that pass through the whole tissue, and should in theory form a straight line. In the case of the prostate, for each pair of images, human operators determined the location of structures visible on both slices, preferably nuclei split by the sectioning blade. The authors refer to these landmarks as "fiducial points".
Another potential use of image registration is to construct a 3D tissue from serial slices. In 2018, `Kartasalo et al. (2018) <https://academic.oup.com/bioinformatics/article/34/17/3013/4978049>`_ performed a study in which they compared several different frameworks for constructing 3D images, using both free and commercial software. They performed the analysis using two datasets: one murine prostate to be reconstructed from 260 serially sliced 20x H&E images (0.46μm/pixel, 5μm in depth), and one murine liver to be reconstructed from 47 serial slices (0.46μm/pixel, 5μm in depth). Accuracy of the alignment of the liver can be determined using the positions of laser cut holes that pass through the whole tissue, and should in theory form a straight line. In the case of the prostate, for each pair of images, human operators determined the location of structures visible on both slices, preferably nuclei split by the sectioning blade. The authors refer to these landmarks as "fiducial points".

VALIS was used to register both datasets, and error was measured as the physical distance (μm), i.e. TRE, between the fiducial points. These values can then be compared to those presented in Tables 1 and 2 of the manuscript, which provide the mean TRE using observer 1's landmarks (i.e. the "TRE μ" column). Benchmarking using the liver dataset indicates that VALIS produces a mean TRE of 52.98, compared to the compared to the baseline reference value of 27.3 (LS 1). In the case of prostate, VALIS scored 11.41, compared to the baseline reference value of 15.6 (LS 1). According to the authors, methods with scores approaching the LS 1 value can be considered "highly accurate", indicating that VALIS is suitable for 3D reconstruction. Below is a picture of the prostate tumor reconstructed from all 260 serial slices.

Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Slide registration
.. image:: https://github.com/MathOnco/valis/raw/main/docs/_images/challenging_dataset_adincar33.png

.. important::
One of the most important parameters used to initialize a Valis object is :code:`max_processed_image_dim_px`, which determines the size of the image used to find the rigid registration parameters. The default value is 850, but if registration fails or is poor, try adjusting that value. Generally speaking, values between 500-2000 work well. In cases where there is little empty space, around the tissue, smaller values may be better. However, if there is a large amount of empty space/slide (as in the images above), larger values may be needed so that the tissue is at a high enough resolution. To imporove alingment of the finer details in the images, larger images can be used in the non-rigid or micro-registration steps (set via the :code:`max_non_rigid_registration_dim_px` parameter).
One of the most important parameters used to initialize a Valis object is :code:`max_processed_image_dim_px`, which determines the size of the image used to find the rigid registration parameters. The default value is 850, but if registration fails or is poor, try adjusting that value. Generally speaking, values between 500-2000 work well. In cases where there is little empty space, around the tissue, smaller values may be better. However, if there is a large amount of empty space/slide (as in the images above), larger values may be needed so that the tissue is at a high enough resolution. To improve alignment of the finer details in the images, larger images can be used in the non-rigid or micro-registration steps (set via the :code:`max_non_rigid_registration_dim_px` parameter).


.. important::
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VALIS

.. include:: README.rst

Docmentation
Documentation
============

.. toctree::
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ VALIS uses Bioformats to read many slide formats. Bioformats is written in Java,
Install
~~~~~~~

Once the above prerequisites have been satistifed, valis can be installed using pip, idealy within a virtual environment
Once the above prerequisites have been satistifed, valis can be installed using pip, ideally within a virtual environment

.. code-block:: bash

Expand Down
2 changes: 1 addition & 1 deletion examples/EXAMPLES_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The `register_ihc.py` example registers the slides in `examples/example_datasets
These can be used to get a better sense of how the
images were altered by non-rigid warping

6. *processed* shows thumnails of the processed images.
6. *processed* shows thumbnails of the processed images.
This are thumbnails of the images that are actually
used to perform the registration. The pre-processing
and normalization methods should try to make these
Expand Down
Loading