Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Basic Info
  • Host: GitHub
  • Owner: BioIntelligence-Lab
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 1.46 MB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created over 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

MedSimilarity

DOI

What is MedSimilarity?

MedSimilarity is an open source Python to compare 2D medical images.

Citation

If you use this software in your publication, please cite it using:

text @software{medsimilarity, title={MedSimilarity}, author={Kulkarni, Pranav}, month={May}, year={2023}, url={https://github.com/UM2ii/MedSimilarity}, doi={10.5281/zenodo.7937894} }

Getting Started

You can install MedSimilarity through pip or you can manually install it from source.

bash pip install MedSimilarity

Manual Installation

You can manually install MedSimilarity as follows:

bash git clone https://github.com/UM2ii/MedSimilarity pip install -e MedSimilarity/

Example Notebook

We have provided an example notebook in this repository, along with 100 test images to experiment with. You can find the example notebook here.

Feature Roadmap

  • [ ] End-to-end similarity pipeline
  • [ ] Add support for DICOM and NII formats
  • [ ] Extend functionality to 3D volumes

Documentation

medsimilarity.structural_similarity

Computes the mean structural similarity index measure (SSIM) between two images. This implementation is an extension of skimage.metrics.structural_similarity (https://scikit-image.org/docs/stable/api/skimage.metrics.html#skimage.metrics.structural_similarity) with preprocessing steps for medical images.

Arguments:

img1, img2: PIL.Image Input images

Returns:

score: float The mean structural similarity index measure over the image grad: ndarray The gradient of the structural similarity between img1 and img2 diff: ndarray The full SSIM image

Notes:

  • Structural similarity is not invariant to transformations

medsimilarity.structural_comparison

Computes the pairwise structural similarity index measure (SSIM) between an image and a dataset and returns the top K matches.

Arguments:

img: str Path to image dataset: list List containing paths to each image in dataset topk: int, optional Number of best matches for img in dataset usemultiprocessing: bool, optional Enables spawning of multiple processes to speed up pairwise SSIM calculation

Returns:

score: ndarray The top_k matches for img in dataset with SSIM score

medsimilarity.dense_vector_comparison

Computes the cosine similarity scores using dense vector representations (DVRS) between an image and dataset and returns the top K matches. This method uses SentenceTransformers ViT-B transformer for computation.

Arguments:

img: str Path to image dataset: list List containing paths to each image in dataset topk: int, optional Number of best matches for img in dataset usemultiprocessing: bool, optional Enables encoding images into embeddings using multiprocessing. If device is 'cuda', images are encoded using multiple GPUs. If device is 'cpu', multiple CPUs are used device: str, optional Specifies device to move all resources to. Use 'cuda' to enable GPU acceleration. If left blank, by default 'cuda' is used if available. If not, 'cpu' is used

Returns:

score: ndarray The top_k matches for img in dataset with DVRS score

medsimilarity.combined_score

Experimental!

Computes the combined score from structural similarity index measure (SSIM) and dense vector representations (DVRS) scores for a pair of images using the formula:

text x_combined = sqrt(x_ssim)*(x_dvrs)^2

Arguments:

xssim: float The SSIM score for pair of images xdvrs: float The DVRS score for pair of images

Returns:

x_combined: float Combined score for pair of images

Notes:

  • This worked well in my testing but please take this with a grain of salt!

Owner

  • Name: BioIntelligence-Lab
  • Login: BioIntelligence-Lab
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: MedSimilarity
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Pranav
    family-names: Kulkarni
    orcid: 'https://orcid.org/0000-0001-5291-2202'
identifiers:
  - type: doi
    value: 10.5281/zenodo.7937894
repository-code: 'https://github.com/UM2ii/MedSimilarity'
abstract: >-
  MedSimilarity is an open source Python to compare 2D
  medical images.
license: Apache-2.0

GitHub Events

Total
Last Year