eReg


NameeReg JSON
Version 0.0.10 PyPI version JSON
download
home_pagehttps://github.com/BrainLesion/eReg
Summaryefficient, pythonic cross-platform image registrations
upload_time2024-04-16 21:09:49
maintainerNone
docs_urlNone
authorSarthak Pati
requires_python<4.0,>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version preprocessing](https://badge.fury.io/py/eReg.svg)](https://pypi.python.org/pypi/eReg/)
[![Documentation Status](https://readthedocs.org/projects/ereg/badge/?version=latest)](http://ereg.readthedocs.io/?badge=latest)
[![tests](https://github.com/BrainLesion/eReg/actions/workflows/tests.yml/badge.svg)](https://github.com/BrainLesion/eReg/actions/workflows/tests.yml)

# eReg - A Simple Registration Tool
**eReg** is a robust, fast and user-friendly registration tool that can be used in clinical environments without the need for virtualization or containerization technologies. It supports most platforms across various hardware configurations.

## Need
Because of security concerns, users in clinical environments do not have access to virtualization and containerization technologies such as Docker and Singularity. This becomes a problem, because most research code (especially for image registration) is built around the need to have access to these technologies. Alternatively, some tools only work on a Linux environment, or they need specific hardware resources (such as a DL accelerator card), which are not always available in clinical settings.



## Installation

With a Python 3.8+ environment, you can install **eReg** from [pypi.org](https://pypi.org/project/eReg/).

1. Create a virtual environment

```sh
python3 -m venv venv_ereg ## using native python venv
# conda create -n venv_ereg python=3.8 ## using conda
```

2. Activate the virtual environment

```sh
source venv_ereg/bin/activate ## using native python venv
# conda activate venv_ereg ## using conda
```

3. Install eReg

```sh
pip install ereg
```

## Usage

**eReg** can be used via the command line or as a Python package. 

### Command Line Interface

The command line interface is available via the `ereg` command:

```sh
(venv_ereg) ~> ereg -h
usage: eReg version0.0.4.post76.dev0+0d89ce7 [-h] -m  -t  -o  -c  [-tff] [-lf] [-gt]

Simple registration.

options:
  -h, --help           show this help message and exit
  -m , --movingImg     The moving image to register. Can be comma-separated list of images or directory of images.
  -t , --targetImg     The target image to register to.
  -o , --output        The output. Can be single file or a directory.
  -c , --config        The configuration file to use.
  -tff , --transfile   Registration transform file; if provided, will use this transform instead of computing a new one or will save. Defaults to None.
  -lf , --log_file     The log file to write to. Defaults to None.
  -gt , --gt           The ground truth image.
```

### Pythonic Interface
The `ereg` package provides two Python interfaces, an object-oriented interface, as well as convenience functions. A [Jupyter notebook tutorial](https://github.com/BrainLesion/tutorials/tree/main/eReg) is available to illustrate usage of the Python API.

#### Object-Oriented Interface

The `register` method represents the core-of the object-oriented interface:

```python
from ereg.registration import RegistrationClass

registration_obj = RegistrationClass(configuration_file) # the configuration file to use to customize the registration, and is optional
registration_obj.register(
    target_image=target_image_file, # the target image, which can be either a file or SimpleITK.Image object
    moving_image=moving_image_file, # the moving image, which can be either a file or SimpleITK.Image object
    output_image=output_file, # the output image to save the registered image to
    transform_file=transform_file, # the transform file to save the transform to; if already present, will use this transform instead of computing a new one
    log_file=log_file, # the log file to write to
)
```

Further, a resample method is available to use previously computed transforms to resample a moving image:

```python
registration_obj.resample_image(
    target_image=target_image_file,
    moving_image=moving_image_file,
    output_image=output_file,
    transform_file=transform_file,
    log_file=log_file,
)
```


#### Functional Interface

Additionally, **eReg** provides functional wrappers for convenience.

```python
from ereg import registration_function

ssim = registration_function(
    target_image=target_image_file, # the target image, which can be either a file or SimpleITK.Image object
    moving_image=moving_image_file, # the moving image, which can be either a file or SimpleITK.Image object
    output_image=output_file, # the output image to save the registered image to
    transform_file=transform_file, # the transform file to save the transform to; if already present, will use this transform instead of computing a new one
    log_file=log_file, # the log file to write to
    configuration=configuration_file, # the configuration file to use to customize the registration, and is optional
)
```

## Customization

eReg's registration and transformation parameters can be customized using a configuration file. The configuration file is a YAML file that contains the parameters for the registration. The default configuration file is present [here](https://github.com/BrainLesion/eReg/blob/main/ereg/configurations/sample_config.yaml). More details on the parameters and their options can be found in the configuration file itself.


## Extending eReg

To extend eReg, you first need to install **eReg** from source. Clone the repository and install the package:

```sh
git clone https://github.com/BrainLesion/eReg.git
cd eReg
pip install -e .
```

<!-- ## Citation TODO -->


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/BrainLesion/eReg",
    "name": "eReg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Sarthak Pati",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "[![PyPI version preprocessing](https://badge.fury.io/py/eReg.svg)](https://pypi.python.org/pypi/eReg/)\n[![Documentation Status](https://readthedocs.org/projects/ereg/badge/?version=latest)](http://ereg.readthedocs.io/?badge=latest)\n[![tests](https://github.com/BrainLesion/eReg/actions/workflows/tests.yml/badge.svg)](https://github.com/BrainLesion/eReg/actions/workflows/tests.yml)\n\n# eReg - A Simple Registration Tool\n**eReg** is a robust, fast and user-friendly registration tool that can be used in clinical environments without the need for virtualization or containerization technologies. It supports most platforms across various hardware configurations.\n\n## Need\nBecause of security concerns, users in clinical environments do not have access to virtualization and containerization technologies such as Docker and Singularity. This becomes a problem, because most research code (especially for image registration) is built around the need to have access to these technologies. Alternatively, some tools only work on a Linux environment, or they need specific hardware resources (such as a DL accelerator card), which are not always available in clinical settings.\n\n\n\n## Installation\n\nWith a Python 3.8+ environment, you can install **eReg** from [pypi.org](https://pypi.org/project/eReg/).\n\n1. Create a virtual environment\n\n```sh\npython3 -m venv venv_ereg ## using native python venv\n# conda create -n venv_ereg python=3.8 ## using conda\n```\n\n2. Activate the virtual environment\n\n```sh\nsource venv_ereg/bin/activate ## using native python venv\n# conda activate venv_ereg ## using conda\n```\n\n3. Install eReg\n\n```sh\npip install ereg\n```\n\n## Usage\n\n**eReg** can be used via the command line or as a Python package. \n\n### Command Line Interface\n\nThe command line interface is available via the `ereg` command:\n\n```sh\n(venv_ereg) ~> ereg -h\nusage: eReg version0.0.4.post76.dev0+0d89ce7 [-h] -m  -t  -o  -c  [-tff] [-lf] [-gt]\n\nSimple registration.\n\noptions:\n  -h, --help           show this help message and exit\n  -m , --movingImg     The moving image to register. Can be comma-separated list of images or directory of images.\n  -t , --targetImg     The target image to register to.\n  -o , --output        The output. Can be single file or a directory.\n  -c , --config        The configuration file to use.\n  -tff , --transfile   Registration transform file; if provided, will use this transform instead of computing a new one or will save. Defaults to None.\n  -lf , --log_file     The log file to write to. Defaults to None.\n  -gt , --gt           The ground truth image.\n```\n\n### Pythonic Interface\nThe `ereg` package provides two Python interfaces, an object-oriented interface, as well as convenience functions. A [Jupyter notebook tutorial](https://github.com/BrainLesion/tutorials/tree/main/eReg) is available to illustrate usage of the Python API.\n\n#### Object-Oriented Interface\n\nThe `register` method represents the core-of the object-oriented interface:\n\n```python\nfrom ereg.registration import RegistrationClass\n\nregistration_obj = RegistrationClass(configuration_file) # the configuration file to use to customize the registration, and is optional\nregistration_obj.register(\n    target_image=target_image_file, # the target image, which can be either a file or SimpleITK.Image object\n    moving_image=moving_image_file, # the moving image, which can be either a file or SimpleITK.Image object\n    output_image=output_file, # the output image to save the registered image to\n    transform_file=transform_file, # the transform file to save the transform to; if already present, will use this transform instead of computing a new one\n    log_file=log_file, # the log file to write to\n)\n```\n\nFurther, a resample method is available to use previously computed transforms to resample a moving image:\n\n```python\nregistration_obj.resample_image(\n    target_image=target_image_file,\n    moving_image=moving_image_file,\n    output_image=output_file,\n    transform_file=transform_file,\n    log_file=log_file,\n)\n```\n\n\n#### Functional Interface\n\nAdditionally, **eReg** provides functional wrappers for convenience.\n\n```python\nfrom ereg import registration_function\n\nssim = registration_function(\n    target_image=target_image_file, # the target image, which can be either a file or SimpleITK.Image object\n    moving_image=moving_image_file, # the moving image, which can be either a file or SimpleITK.Image object\n    output_image=output_file, # the output image to save the registered image to\n    transform_file=transform_file, # the transform file to save the transform to; if already present, will use this transform instead of computing a new one\n    log_file=log_file, # the log file to write to\n    configuration=configuration_file, # the configuration file to use to customize the registration, and is optional\n)\n```\n\n## Customization\n\neReg's registration and transformation parameters can be customized using a configuration file. The configuration file is a YAML file that contains the parameters for the registration. The default configuration file is present [here](https://github.com/BrainLesion/eReg/blob/main/ereg/configurations/sample_config.yaml). More details on the parameters and their options can be found in the configuration file itself.\n\n\n## Extending eReg\n\nTo extend eReg, you first need to install **eReg** from source. Clone the repository and install the package:\n\n```sh\ngit clone https://github.com/BrainLesion/eReg.git\ncd eReg\npip install -e .\n```\n\n<!-- ## Citation TODO -->\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "efficient, pythonic cross-platform image registrations",
    "version": "0.0.10",
    "project_urls": {
        "Documentation": "https://eReg.readthedocs.io/",
        "Homepage": "https://github.com/BrainLesion/eReg",
        "Repository": "https://github.com/BrainLesion/eReg"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70b79814ee6bb0207a26179f4667d69f98b6c3d04091d65ace98a42f8924bd69",
                "md5": "7f6506babe9c618cbb25f33a1ec9d828",
                "sha256": "b0894a9398d9f16b870eaf29d1b81ab3bcb10e2c8d7aea2489b9312f5834bbcc"
            },
            "downloads": -1,
            "filename": "ereg-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f6506babe9c618cbb25f33a1ec9d828",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 21731,
            "upload_time": "2024-04-16T21:09:49",
            "upload_time_iso_8601": "2024-04-16T21:09:49.848365Z",
            "url": "https://files.pythonhosted.org/packages/70/b7/9814ee6bb0207a26179f4667d69f98b6c3d04091d65ace98a42f8924bd69/ereg-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 21:09:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BrainLesion",
    "github_project": "eReg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ereg"
}
        
Elapsed time: 9.41958s