Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b8be67b
added KnnMSE
aniraman1 Mar 26, 2026
044a022
KnnMSE edits
aniraman1 Mar 26, 2026
7180e45
bug fixes
aniraman1 Mar 30, 2026
9c068a3
gcn bug fix, mesh_utils changed attr setting, added mesh losses
aniraman1 Apr 1, 2026
23b026c
added aspect ratio loss
aniraman1 Apr 1, 2026
cd03961
bug fix in get_structure_ids
aniraman1 Apr 1, 2026
fbb4e0f
fixed bug in facenorm loss
aniraman1 Apr 1, 2026
b2cf7a1
to device bugfixes
aniraman1 Apr 1, 2026
55aa210
inversion param correction
aniraman1 Apr 1, 2026
41d1181
made graph res bug fix
aniraman1 Apr 2, 2026
1ac61e3
made changes to graphresblock and convresblock to match image2flow
aniraman1 Apr 8, 2026
bc1f6c7
changes to graphres and imgeres to stop spikiness
aniraman1 Apr 13, 2026
0027b49
added tf-style projection layer
aniraman1 Apr 21, 2026
18dd1b3
made aspect and dev edge supervised
aniraman1 Apr 27, 2026
3183229
bug fixes
aniraman1 Apr 27, 2026
464a3cd
squared mesh losses
aniraman1 Apr 28, 2026
b9c43f1
fixed edge dev loss
aniraman1 Apr 28, 2026
0758977
actually fixed dev edge
aniraman1 Apr 28, 2026
e964e65
fixed edge length computation
aniraman1 Apr 28, 2026
eb7b5f3
added dropout and Image2Mesh config
aniraman1 Apr 28, 2026
f28c8ef
removed extra dropout
aniraman1 Apr 29, 2026
fb4cfd3
fixed graph norm
aniraman1 Apr 30, 2026
ed519c0
added surface edge index util
aniraman1 Jun 11, 2026
fbc670a
Added meshgraphnets, dice loss, and fixed edge_index
aniraman1 Jun 26, 2026
5e6f158
added norm_mode and title to PointCloudPlot
aniraman1 Jul 10, 2026
d6d4437
changes to mesh utils and transforms
aniraman1 Jul 15, 2026
f5b3428
added tests
aniraman1 Jul 27, 2026
527c57a
amended tests
aniraman1 Jul 27, 2026
d97d9cf
fixed linting issues
aniraman1 Jul 27, 2026
dadf49b
fixed lints and test pipeline
aniraman1 Jul 27, 2026
12d7ec4
some corrections
aniraman1 Jul 27, 2026
be9a2fe
added tests for data ops
aniraman1 Jul 28, 2026
62cedd2
fixed lints
aniraman1 Jul 28, 2026
1a697af
added hypothesis to dev installs
aniraman1 Jul 28, 2026
a414662
added hypothesis
aniraman1 Jul 28, 2026
6d844e5
added tests for layers
aniraman1 Jul 29, 2026
c430dff
fixed python version issues
aniraman1 Jul 29, 2026
6f1027d
changed default graphconv args
aniraman1 Aug 4, 2026
960f6b2
changed py version in toml
aniraman1 Aug 4, 2026
6cf3195
added dataloaders to util exports
aniraman1 Aug 4, 2026
bc2fad9
removed print statements
aniraman1 Aug 4, 2026
53acc97
halfunet stuff
aniraman1 Aug 4, 2026
c349479
added docs for github pages
aniraman1 Aug 10, 2026
b2a4f99
removed some git actions
aniraman1 Aug 10, 2026
ff9dad5
fixed build_package.yml
aniraman1 Aug 10, 2026
c3a0547
fixed build_package.yml2
aniraman1 Aug 10, 2026
077cccc
updated toml
aniraman1 Aug 10, 2026
508f18d
updated toml2
aniraman1 Aug 10, 2026
40d0d41
updated toml3
aniraman1 Aug 10, 2026
043d08d
Merge origin/main and resolve conflicts
Copilot Aug 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file modified .DS_Store
Binary file not shown.
58 changes: 58 additions & 0 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Package

on:
push:
pull_request:

jobs:
build_docs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[docs]"

- name: Build API
run: |
python tools/build/create_api.py

- name: Build Docs
run: |
cd tools/docs
make clean
python create_templates.py
python create_documents.py
make dirhtml

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: tools/docs/_build/dirhtml

deploy_docs:
needs: build_docs
runs-on: ubuntu-latest

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ venv/

# OS files
.DS_Store
Thumbs.db
Thumbs.db

# pytest
.pytest_cache/

# dev tests
*.ipynb
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.0 # use the latest Ruff version you prefer
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
41 changes: 41 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
im2sim
======

``im2sim`` is a library designed to simplify the development of ML-accelerated
digital twins based on medical images.

This includes two main components:

1. Deep Learning (DL) frameworks based on
`PyTorch <https://pytorch.org>`_ and
`PyTorch Geometric <https://pytorch-geometric.readthedocs.io/en/latest/>`_

2. Mesh processing frameworks based on
`VTK <https://vtk.org>`_ and
`PyVista <https://docs.pyvista.org/index.html>`_

Features
--------

* Image and Mesh Data Processing
* DL models for medical imaging applications
* DL models for digital twin applications
* Hybrid DL models for simulation outputs directly from images
* Building blocks for custom DL models
* Visualisation utilities

Installation
------------

1. Install the CUDA dependencies:

.. code-block:: bash

pip install torch-scatter torch-cluster \
-f https://data.pydata.org/whl/torch-2.3.1+cu121.html

2. Install the repository:

.. code-block:: bash

pip install git+https://github.com/mrphys/im2sim.git
38 changes: 38 additions & 0 deletions im2sim/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2026 University College London. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""About IM2SIM"""

__all__ = [
"__title__",
"__summary__",
"__uri__",
"__version__",
"__author__",
"__email__",
"__license__",
"__copyright__",
]

__title__ = "im2sim"
__summary__ = "A library to accelerate the development of deep learning models for medical image analysis and simulation."
__uri__ = "https://github.com/mrphys/im2sim"

__version__ = "0.1.0"

__author__ = "Anirudh Raman, Vivek Muthurangu, Javier Montalt-Tordera"
__email__ = "v.muthurangu@ucl.ac.uk"

__license__ = "Apache 2.0"
__copyright__ = "2026 University College London"
29 changes: 28 additions & 1 deletion im2sim/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
from . import callbacks, data, layers, losses, metrics, models, utils
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""IM2SIM."""
import os as _os
import sys as _sys

from im2sim.__about__ import *

# Import submodules.
from im2sim._api import data
from im2sim._api import layers
from im2sim._api import configs
from im2sim._api import ops
from im2sim._api import losses
from im2sim._api import models
from im2sim._api import plot

# Make sure directory containing top level submodules is in
# the __path__ so that "from tensorflow_mri.foo import bar" works.
# We're using callbacks, but there's nothing special about that.
_API_MODULE = _sys.modules[__name__].layers
_im2sim_api_dir = _os.path.dirname(_os.path.dirname(_API_MODULE.__file__))
_current_module = _sys.modules[__name__]

if not hasattr(_current_module, '__path__'):
__path__ = [_im2sim_api_dir]
elif _im2sim_api_dir not in __path__:
__path__.append(_im2sim_api_dir)
6 changes: 6 additions & 0 deletions im2sim/_api/configs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Configuration classes for model and training settings."""

from im2sim.src.layers.image_conv_blocks import ImageConvBlockConfig as ImageConvBlockConfig
from im2sim.src.layers.halfunet import HalfUNetConfig as HalfUNetConfig
5 changes: 5 additions & 0 deletions im2sim/_api/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Data loading and preprocessing utilities."""


15 changes: 15 additions & 0 deletions im2sim/_api/layers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Custom layers for building deep learning models."""

from im2sim.src.layers.graph_blocks import DefaultGraphNorm as DefaultGraphNorm
from im2sim.src.layers.graph_blocks import GraphConvBlock as GraphConvBlock
from im2sim.src.layers.graph_blocks import GraphConvResBlock as GraphConvResBlock
from im2sim.src.layers.graph_blocks import GraphResDecoderBlock as GraphResDecoderBlock
from im2sim.src.layers.custom_image_layers import DepthwiseConv as DepthwiseConv
from im2sim.src.layers.custom_image_layers import DepthwiseSeparableConv as DepthwiseSeparableConv
from im2sim.src.layers.custom_image_layers import GhostConv as GhostConv
from im2sim.src.layers.custom_image_layers import EfficientChannelAttn as EfficientChannelAttn
from im2sim.src.layers.custom_image_layers import SqueezeExcite as SqueezeExcite
from im2sim.src.layers.custom_image_layers import ConditionedSqueezeExcite as ConditionedSqueezeExcite
from im2sim.src.layers.image_conv_blocks import ImageConvBlock as ImageConvBlock
5 changes: 5 additions & 0 deletions im2sim/_api/losses/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Custom loss functions for training deep learning models."""


5 changes: 5 additions & 0 deletions im2sim/_api/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Predefined deep learning models for various tasks."""

from im2sim.src.layers.halfunet import HalfUNet as HalfUNet
5 changes: 5 additions & 0 deletions im2sim/_api/ops/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Custom operations for deep learning models."""

from im2sim.src.data.ops import normtorange as normtorange
5 changes: 5 additions & 0 deletions im2sim/_api/plot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was automatically generated by tools/build/create_api.py.
# Do not edit.
"""Utilities for visualizing data and model outputs."""


2 changes: 0 additions & 2 deletions im2sim/callbacks/contents.md

This file was deleted.

2 changes: 0 additions & 2 deletions im2sim/data/__init__.py

This file was deleted.

77 changes: 0 additions & 77 deletions im2sim/data/mesh_utils.py

This file was deleted.

52 changes: 0 additions & 52 deletions im2sim/data/transforms.py

This file was deleted.

5 changes: 0 additions & 5 deletions im2sim/layers/__init__.py

This file was deleted.

Loading