Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: ['3.10', '3.11']
os: [
ubuntu-latest,
windows-latest,
Expand All @@ -36,17 +36,17 @@ jobs:
run: |
pytest --cov-report xml --cov=mmv_im2im mmv_im2im/tests/
- name: Upload codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4

lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9.15
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -68,7 +68,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9, '3.10', 3.11]
python-version: ['3.10', '3.11']
os: [
ubuntu-latest,
windows-latest,
Expand All @@ -28,17 +28,17 @@ jobs:
run: |
pytest mmv_im2im/tests/
- name: Upload codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4

lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9.15
python-version: 3.11
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ The overall package is designed with a generic image-to-image transformation fra

## Installation

Before starting, we recommend to [create a new conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) or [a virtual environment](https://docs.python.org/3/library/venv.html) with Python 3.9+.
Before starting, we recommend to [create a new conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands) or [a virtual environment](https://docs.python.org/3/library/venv.html) with Python 3.10+.

```bash
conda create -y -n im2im -c conda-forge python=3.11
conda activate im2im
```

Please note that the proper setup of hardware is beyond the scope of this pacakge. This package was tested with GPU/CPU on Linux/Windows and CPU on MacOS. [Special note for MacOS users: Directly pip install in MacOS may need [additional setup of xcode](https://developer.apple.com/forums/thread/673827).]

### Install MONAI

To reproduce our results, we need to install MONAI's code version of a specific commit. To do this:
```
```bash
git clone https://github.com/Project-MONAI/MONAI.git
cd ./MONAI
git checkout 37b58fcec48f3ec1f84d7cabe9c7ad08a93882c0
Expand All @@ -49,7 +54,7 @@ For MacOS users, additional ' ' marks are need when using installation tags in z
### Install MMV_Im2Im for customization or extension:


```
```bash
git clone https://github.com/MMV-Lab/mmv_im2im.git
cd mmv_im2im
pip install -e .[all]
Expand All @@ -71,10 +76,10 @@ You can try out on a simple example following [the quick start guide](tutorials/

Basically, you can specify your training configuration in a yaml file and run training with `run_im2im --config /path/to/train_config.yaml`. Then, you can specify the inference configuration in another yaml file and run inference with `run_im2im --config /path/to/inference_config.yaml`. You can also run the inference as a function with the provided API. This will be useful if you want to run the inference within another python script or workflow. Here is an example:

```
```python
from pathlib import Path
from aicsimageio import AICSImage
from aicsimageio.writers import OmeTiffWriter
from bioio import BioImage
from bioio.writers import OmeTiffWriter
from mmv_im2im.configs.config_base import ProgramConfig, parse_adaptor, configuration_validation
from mmv_im2im import ProjectTester

Expand All @@ -89,9 +94,9 @@ executor.setup_data_processing()

# get the data, run inference, and save the result
fn = Path("./data/img_00_IM.tiff")
img = AICSImage(fn).get_image_data("YX", Z=0, C=0, T=0)
img = BioImage(fn).get_image_data("YX", Z=0, C=0, T=0)
# or using delayed loading if the data is large
# img = AICSImage(fn).get_image_dask_data("YX", Z=0, C=0, T=0)
# img = BioImage(fn).get_image_dask_data("YX", Z=0, C=0, T=0)
seg = executor.process_one_image(img)
OmeTiffWriter.save(seg, "output.tiff", dim_orders="YX")
```
Expand Down
Empty file modified docs/conf.py
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions mmv_im2im/configs/config_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ def configuration_validation(cfg):
cfg.data.dataloader.train.dataset_params["cache_dir"]
!= cfg.data.dataloader.val.dataset_params["cache_dir"]
):
cfg.data.dataloader.val.dataset_params[
"cache_dir"
] = cfg.data.dataloader.train.dataset_params["cache_dir"]
cfg.data.dataloader.val.dataset_params["cache_dir"] = (
cfg.data.dataloader.train.dataset_params["cache_dir"]
)
warnings.warn(
UserWarning(
"The cache dir of PersistentDataset for validation was"
Expand Down
8 changes: 4 additions & 4 deletions mmv_im2im/data_modules/data_loader_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def train_dataloader(self):
train_dataset = train_dataset_func(
data=train_data,
transform=self.transform,
**train_loader_info.dataset_params
**train_loader_info.dataset_params,
)
else:
train_dataset = train_dataset_func(
Expand All @@ -117,7 +117,7 @@ def train_dataloader(self):
train_dataset,
shuffle=True,
collate_fn=list_data_collate,
**train_loader_info.dataloader_params
**train_loader_info.dataloader_params,
)
return train_dataloader

Expand All @@ -130,14 +130,14 @@ def val_dataloader(self):
val_dataset = val_dataset_func(
data=self.val_data,
transform=self.preproc,
**val_loader_info.dataset_params
**val_loader_info.dataset_params,
)
else:
val_dataset = val_dataset_func(data=self.val_data, transform=self.preproc)
val_dataloader = DataLoader(
val_dataset,
shuffle=False,
collate_fn=list_data_collate,
**val_loader_info.dataloader_params
**val_loader_info.dataloader_params,
)
return val_dataloader
3 changes: 2 additions & 1 deletion mmv_im2im/models/nets/BranchedERFNet_2d.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Author: Davy Neven
Licensed under the CC BY-NC 4.0 license
Licensed under the CC BY-NC 4.0 license
(https://creativecommons.org/licenses/by-nc/4.0/)
https://github.com/davyneven/SpatialEmbeddings
"""

import torch
import torch.nn as nn
import mmv_im2im.models.nets.erfnet as erfnet
Expand Down
Loading