A flexible ML framework built to simplify medical image reconstruction and analysis experimentation.

Overview

meddlr

Getting Started

Meddlr is a config-driven ML framework built to simplify medical image reconstruction and analysis problems.

Installation

To avoid cuda-related issues, downloading torch, torchvision, and cupy (optional) must be done prior to downloading other requirements.

# Create and activate the environment.
conda create -n meddlr_env python=3.7
conda activate meddlr_env

# Install cuda-dependant libraries. Change cuda version as needed.
# Below we show examples for cuda-10.1
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
pip install cupy-cuda101

# Install as package in virtual environment (recommended):
git clone https://github.com/ad12/meddlr.git
cd dl-ss-recon && python -m pip install -e '.[dev]'

# For all contributors, install development packages.
make dev

Contributing

See CONTRIBUTING.md for more information.

Acknowledgements

Meddlr's design for rapid experimentation and benchmarking is inspired by detectron2.

About

If you use Meddlr for your work, please consider citing the following work:

@article{desai2021noise2recon,
  title={Noise2Recon: A Semi-Supervised Framework for Joint MRI Reconstruction and Denoising},
  author={Desai, Arjun D and Ozturkler, Batu M and Sandino, Christopher M and Vasanawala, Shreyas and Hargreaves, Brian A and Re, Christopher M and Pauly, John M and Chaudhari, Akshay S},
  journal={arXiv preprint arXiv:2110.00075},
  year={2021}
}
Comments
  • prelimary monai support

    prelimary monai support

    This PR enables building MONAI models from the config with meddlr.modeling.build_model

    Example Usage

    MONAI V-Net model

    config.yaml

    MODEL:
      MONAI:
        VNet:
          in_channels: 1
          out_channels: 1
          spatial_dims: 2
          dropout_dim: 2
    
    opened by ad12 1
  • Add utilities for dynamic edge mask computation

    Add utilities for dynamic edge mask computation

    Edge k-space is defined as the k-space along the edges of the matrix that is not sampled. An example of edge k-space for the Poisson Disc undersampling pattern with crop_corners=True is shown below

    image

    We often want to know the edge k-space for certain methods (SSDU, hard data consistency postprocessing, etc.). This PR provides utilities for dynamically computing the edge k-space based on the type of undersampling pattern used.

    opened by ad12 1
  • Invalid Version when Using Self-Compiled/Beta PyTorch

    Invalid Version when Using Self-Compiled/Beta PyTorch

    I encountered an exception when running import meddlr.ops as oF in an NGC PyTorch container.

    The exception says,

    >>> import meddlr.ops as oF
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/workspace/meddlr/meddlr/__init__.py", line 3, in <module>
        from meddlr.engine.model_zoo import get_model_from_zoo
      File "/workspace/meddlr/meddlr/engine/__init__.py", line 10, in <module>
        from .hooks import *  # noqa
      File "/workspace/meddlr/meddlr/engine/hooks.py", line 19, in <module>
        from meddlr.evaluation.testing import flatten_results_dict
      File "/workspace/meddlr/meddlr/evaluation/__init__.py", line 2, in <module>
        from .recon_evaluation import ReconEvaluator  # noqa: F401
      File "/workspace/meddlr/meddlr/evaluation/recon_evaluation.py", line 16, in <module>
        from meddlr.data.transforms.transform import build_normalizer
      File "/workspace/meddlr/meddlr/data/__init__.py", line 1, in <module>
        from meddlr.data import build, catalog, collate, data_utils, slice_dataset
      File "/workspace/meddlr/meddlr/data/build.py", line 13, in <module>
        from meddlr.data.slice_dataset import SliceData
      File "/workspace/meddlr/meddlr/data/slice_dataset.py", line 10, in <module>
        from meddlr.data.transforms.transform import DataTransform
      File "/workspace/meddlr/meddlr/data/transforms/transform.py", line 9, in <module>
        from meddlr.forward import SenseModel
      File "/workspace/meddlr/meddlr/forward/__init__.py", line 1, in <module>
        from meddlr.forward import mri
      File "/workspace/meddlr/meddlr/forward/mri.py", line 4, in <module>
        import meddlr.ops as oF
      File "/workspace/meddlr/meddlr/ops/__init__.py", line 1, in <module>
        from meddlr.ops import categorical, complex, fft, utils  # noqa: F401
      File "/workspace/meddlr/meddlr/ops/fft.py", line 10, in <module>
        if env.pt_version() >= [1, 6]:
      File "/workspace/meddlr/meddlr/utils/env.py", line 314, in pt_version
        version = [dtype(x) for x in version]
      File "/workspace/meddlr/meddlr/utils/env.py", line 314, in <listcomp>
        version = [dtype(x) for x in version]
    ValueError: invalid literal for int() with base 10: '0a0'
    

    I checked the related lines, the code assumes the PyTorch is using stable versions and installed from binary packs.

    https://github.com/ad12/meddlr/blob/b2f055b482c534a2a6eb161c19e6abb6ea94c196/meddlr/utils/env.py#L314

    However, the PyTorch in the NGC container is self-complied, and the version string contains a commit ID. It looks like this,

    >>> import torch
    >>> torch.__version__
    '1.13.0a0+08820cb'
    

    I suspect that's why it triggered the exception.

    Would you please kindly modify the function to accept the version strings like this?

    bug 
    opened by billzhonggz 1
  • refactor conv block and generalized unet to use LayerInfo abstraction

    refactor conv block and generalized unet to use LayerInfo abstraction

    This PR refactors SimpleConvBlockNd block and GeneralizedUNet to use the LayerInfo abstraction.

    NOTE: there is one implementation breaking PR. GeneralizedUNet's upsampling block will order the norm/activation based on the order in the original block. Previously the order was always convtranspose -> act -> norm. Order of act and norm will be determined by which comes first in the block_order

    opened by ad12 1
  • deprecate 3.6 support in CI

    deprecate 3.6 support in CI

    • deprecate 3.6 support in CI - seeing C407 errors in Py3.6 linting which are not supported in later versions
    • tifffile<=2022.5.4 - tifffile==2022.7.28 causing issues with skimage data loading during testing
    opened by ad12 1
  • add LayerInfo

    add LayerInfo

    LayerInfo is a dataclass that allows for more modular control of the layers being built. This class provides two key functions:

    • format: Creates a LayerInfo object from raw python types which are typically read from files (e.g. yaml/json)
    • build: Builds the layer given the layer's init_kwargs
    opened by ad12 1
  • Not compatible with gdown==4.6.0

    Not compatible with gdown==4.6.0

    FAILED tests/utils/test_path.py::test_gdrive_handler - ImportError: cannot import name 'client' from 'gdown.download_folder' (/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/gdown/download_folder.py)

    opened by ad12 0
  • Maybe add singlecoil support?

    Maybe add singlecoil support?

    Hello, I am new to MRI reconstruction and plan to learn to use fastMRI with singlecoil dataset and using meddlr to reproduce the VORTEX work. I just read the "VORTEX" paper and I think it was a great work. However, I go through the code and found most functions, such as meddlr.utils.transforms or datasets/format_fastmri.py is mainly used for multicoil data. Could you please consider adding singlecoil support?

    Lookingforward to your reply. Thank you very much!

    opened by YuyangXueEd 1
  • Dataset file 'b7d435a1-2421-48d2-946c-d1b3372f7c60.h5' not found

    Dataset file 'b7d435a1-2421-48d2-946c-d1b3372f7c60.h5' not found

    ****On attempting to format mri data the scan 'b7d435a1-2421-48d2-946c-d1b3372f7c60.h5' is not found in the directory 'datasets/mridata_knee_2019/raw/ismrmrd/' and the issue is reported as 'file signature not found'.

    opened by Sarah-2021-scu 0
  • Handle arbitrary dimensional inputs into nn.Modules

    Handle arbitrary dimensional inputs into nn.Modules

    Medical images have a heterogenous number of dimensions. For example, MRI volumes can be treated as 2D slices, 3D volumes, or nD tensors (e.g. multi-echo, time, etc.). It is important to have built-in modules be able to handle tensors of arbitrary dimensions with some (but little) opinion about the behavior of the model across these different dimensions.

    Proposal

    Currently, frameworks require the user to keep track of the order of dimensions for tensors. We may be able to simplify this by having a tensor dim_order value that is managed and manipulated by the meddlr ecosystem.

    TODOs

    • [ ] Update forward.mri.SenseModel as a sample use case for managing multiple dimensions
    opened by ad12 0
  • sigpy.mri.poisson hangs while internal copy of function does not

    sigpy.mri.poisson hangs while internal copy of function does not

    Calling sigpy.mri.poisson hangs during the data loading process, but copying the function seems to be running fine.

    Things to check:

    • [ ] Implementation differences between current sigpy implementation and internal copy
    • [ ] Speed difference / hang time
    opened by ad12 1
  • Add Noise2Recon and VORTEX tutorials

    Add Noise2Recon and VORTEX tutorials

    Noise2Recon:

    • [ ] Add experimental configs and pre-trained weights to google drive
    • [ ] Colab tutorial for running experiments

    VORTEX:

    • [ ] Add experimental configs and pre-trained weights to google drive
    • [ ] Colab tutorial for running experiments
    opened by ad12 0
Owner
Arjun Desai
Arjun Desai
Pytorch Code for "Medical Transformer: Gated Axial-Attention for Medical Image Segmentation"

Medical-Transformer Pytorch Code for the paper "Medical Transformer: Gated Axial-Attention for Medical Image Segmentation" About this repo: This repo

Jeya Maria Jose 615 Dec 25, 2022
Medical image analysis framework merging ANTsPy and deep learning

ANTsPyNet A collection of deep learning architectures and applications ported to the python language and tools for basic medical image processing. Bas

Advanced Normalization Tools Ecosystem 118 Dec 24, 2022
ivadomed is an integrated framework for medical image analysis with deep learning.

Repository on the collaborative IVADO medical imaging project between the Mila and NeuroPoly labs.

null 144 Dec 19, 2022
A Planar RGB-D SLAM which utilizes Manhattan World structure to provide optimal camera pose trajectory while also providing a sparse reconstruction containing points, lines and planes, and a dense surfel-based reconstruction.

ManhattanSLAM Authors: Raza Yunus, Yanyan Li and Federico Tombari ManhattanSLAM is a real-time SLAM library for RGB-D cameras that computes the camera

null 117 Dec 28, 2022
Build a medical knowledge graph based on Unified Language Medical System (UMLS)

UMLS-Graph Build a medical knowledge graph based on Unified Language Medical System (UMLS) Requisite Install MySQL Server 5.6 and import UMLS data int

Donghua Chen 6 Dec 25, 2022
Lightweight, Python library for fast and reproducible experimentation :microscope:

Steppy What is Steppy? Steppy is a lightweight, open-source, Python 3 library for fast and reproducible experimentation. Steppy lets data scientist fo

minerva.ml 134 Jul 10, 2022
"MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction" (CVPRW 2022) & (Winner of NTIRE 2022 Challenge on Spectral Reconstruction from RGB)

MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction (CVPRW 2022) Yuanhao Cai, Jing Lin, Zudi Lin, Haoqian Wang, Yulun Z

Yuanhao Cai 274 Jan 5, 2023
A pytorch-based deep learning framework for multi-modal 2D/3D medical image segmentation

A 3D multi-modal medical image segmentation library in PyTorch We strongly believe in open and reproducible deep learning research. Our goal is to imp

Adaloglou Nikolas 1.2k Dec 27, 2022
Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation

Multi-atlas segmentation (MAS) is a promising framework for medical image segmentation. Generally, MAS methods register multiple atlases, i.e., medical images with corresponding labels, to a target image;

NanYoMy 13 Oct 9, 2022
Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of images as "pixels"

picinpics Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of

RodrigoCMoraes 1 Oct 24, 2021
Breaking the Dilemma of Medical Image-to-image Translation

Breaking the Dilemma of Medical Image-to-image Translation Supervised Pix2Pix and unsupervised Cycle-consistency are two modes that dominate the field

Kid Liet 86 Dec 21, 2022
Copy Paste positive polyp using poisson image blending for medical image segmentation

Copy Paste positive polyp using poisson image blending for medical image segmentation According poisson image blending I've completely used it for bio

Phạm Vũ Hùng 2 Oct 19, 2021
PyMove is a Python library to simplify queries and visualization of trajectories and other spatial-temporal data

Use PyMove and go much further Information Package Status License Python Version Platforms Build Status PyPi version PyPi Downloads Conda version Cond

Insight Data Science Lab 64 Nov 15, 2022
Official implementation of "SinIR: Efficient General Image Manipulation with Single Image Reconstruction" (ICML 2021)

SinIR (Official Implementation) Requirements To install requirements: pip install -r requirements.txt We used Python 3.7.4 and f-strings which are in

null 47 Oct 11, 2022
Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set (CVPRW 2019). A PyTorch implementation.

Accurate 3D Face Reconstruction with Weakly-Supervised Learning: From Single Image to Image Set —— PyTorch implementation This is an unofficial offici

Sicheng Xu 833 Dec 28, 2022
Code for our CVPR 2022 Paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection"

GEN-VLKT Code for our CVPR 2022 paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection". Contributed by Yue Lia

Yue Liao 47 Dec 4, 2022
UMT is a unified and flexible framework which can handle different input modality combinations, and output video moment retrieval and/or highlight detection results.

Unified Multi-modal Transformers This repository maintains the official implementation of the paper UMT: Unified Multi-modal Transformers for Joint Vi

Applied Research Center (ARC), Tencent PCG 84 Jan 4, 2023