# Figure Generator
[![PyPi](https://img.shields.io/pypi/v/FigureGenerator)](https://pypi.org/project/FigureGenerator/)
[![Conda](https://anaconda.org/conda-forge/figuregenerator/badges/version.svg)](https://anaconda.org/conda-forge/figuregenerator)
[![Build & Tests](https://github.com/CBICA/FigureGenerator/actions/workflows/python-package.yml/badge.svg)](https://github.com/CBICA/FigureGenerator/actions/workflows/python-package.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/608de602c1bd4bec810efb0d08f269e6)](https://www.codacy.com/gh/CBICA/FigureGenerator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CBICA/FigureGenerator&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/608de602c1bd4bec810efb0d08f269e6)](https://www.codacy.com/gh/CBICA/FigureGenerator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CBICA/FigureGenerator&utm_campaign=Badge_Coverage)
[![Code style](https://img.shields.io/badge/Code%20Style-black-000000.svg)](https://github.com/psf/black)
This project helps create high quality figures for medical images for use in presentations and/or manuscripts.
## Installation
```powershell
git clone https://github.com/CBICA/FigureGenerator.git
cd screenshot_maker
conda create -n venv_screenshot python=3.7 -y
conda activate venv_screenshot
pip install -e .
```
OR directly via Pip:
```powershell
pip install FigureGenerator
```
## Usage
```
python ./figure_generator -h
usage: FigureGenerator [-h] -images IMAGES [-masks MASKS] [-opacity OPACITY]
[-ylabels YLABELS] -output OUTPUT [-axisrow AXISROW]
[-boundtype BOUNDTYPE] [-fontsize FONTSIZE]
[-borderpc BORDERPC] [-v]
Constructing screenshots from medical images.
Contact: software@cbica.upenn.edu
This program is NOT FDA/CE approved and NOT intended for clinical use.
Copyright (c) 2021 University of Pennsylvania. All rights reserved.
optional arguments:
-h, --help show this help message and exit
-images IMAGES Input image files (comma-separated without any spaces in path and co-registered)
-masks MASKS Mask files (comma-separated without any spaces in path and co-registered with images); if multiple files are passed, first is ground truth
-opacity OPACITY Mask opacity between 0-1
-ylabels YLABELS The comma-separated ylabels that will be displayed on the subplots' y-axis
-output OUTPUT Output screenshot file
-axisrow AXISROW Put all axes views across each column and stack images and blends in rows, defaults to False
-boundtype BOUNDTYPE Construct bounding box around specified region; can be 'none, image or mask'
-fontsize FONTSIZE Font size for all text on the figure
-borderpc BORDERPC Percentage of size to use as border around bounding box (used only when mask and bounded are defined)
-v, --version Show program's version number and exit.
```
## Examples
### **Vertical** screenshot of multiple images **without** bounding:
```powershell
python ./figure_generator \
-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \
-masks C:/input/subject_001_seg.nii.gz \
-axisrow False \
-output C:/input/fig.png
```
Gives the following output:
<p align="center">
<img width="450" src="images/fig_axisrowfalse.png">
</p>
<!-- full-size image
[<img src="images/fig_axisrowfalse.png" width="450"/>](axisrow_false)
![axisrow_false](images/fig_axisrowfalse.png)
-->
### **Horizontal** screenshot of multiple images **without** bounding:
```powershell
python ./figure_generator \
-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \
-masks C:/input/subject_001_seg.nii.gz \
-axisrow True \
-output C:/input/fig.png
```
Gives the following output:
[<img src="images/fig_axisrowtrue.png" width="900"/>](axisrow_true)
<!-- full-size image
![axisrow_true](images/fig_axisrowtrue.png)
-->
### Horizontal screenshot of multiple images with **image-based bounding**:
```powershell
python ./figure_generator \
-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \
-masks C:/input/subject_001_seg.nii.gz \
-axisrow True \
-boundtype image \
-output C:/input/fig.png
```
Gives the following output:
[<img src="images/fig_axisrowtrue_boundedimage.png" width="900"/>](axistrue_boundedimage)
<!-- full-size image
![axisrow_true](images/fig_axisrowtrue_boundedimage.png)
-->
**Note**: This can be used with vertical orientation as well, by passing `-axisrow False` to the command.
### Horizontal screenshot of multiple images with **mask-based bounding**:
```powershell
python ./figure_generator \
-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \
-masks C:/input/subject_001_seg.nii.gz \
-axisrow True \
-boundtype mask \
-borderpc 0.001 \
-output C:/input/fig.png
```
Gives the following output:
[<img src="images/fig_axisrowtrue_boundedmask.png" width="900"/>](axistrue_boundedmask)
<!-- full-size image
![axisrow_true](images/fig_axisrowtrue_boundedmask.png)
-->
**Note**: This can be used with vertical orientation as well, by passing `-axisrow False` to the command.
## Feedback
Please post on GitHub [Discussions](https://github.com/CBICA/FigureGenerator/discussions) or post an [issue](https://github.com/CBICA/FigureGenerator/issues/new/choose).
Raw data
{
"_id": null,
"home_page": "",
"name": "FigureGenerator",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "medical-imaging,screenshot,figure-generator,publication",
"author": "Sarthak Pati",
"author_email": "software@cbica.upenn.edu",
"download_url": "https://files.pythonhosted.org/packages/cc/a4/5a670d207a6b5a60c4316e3d50743053bf074d44b6a9d04d7cae559fe976/FigureGenerator-0.0.4.tar.gz",
"platform": null,
"description": "# Figure Generator\n\n[![PyPi](https://img.shields.io/pypi/v/FigureGenerator)](https://pypi.org/project/FigureGenerator/)\n[![Conda](https://anaconda.org/conda-forge/figuregenerator/badges/version.svg)](https://anaconda.org/conda-forge/figuregenerator)\n[![Build & Tests](https://github.com/CBICA/FigureGenerator/actions/workflows/python-package.yml/badge.svg)](https://github.com/CBICA/FigureGenerator/actions/workflows/python-package.yml)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/608de602c1bd4bec810efb0d08f269e6)](https://www.codacy.com/gh/CBICA/FigureGenerator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CBICA/FigureGenerator&utm_campaign=Badge_Grade)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/608de602c1bd4bec810efb0d08f269e6)](https://www.codacy.com/gh/CBICA/FigureGenerator/dashboard?utm_source=github.com&utm_medium=referral&utm_content=CBICA/FigureGenerator&utm_campaign=Badge_Coverage)\n[![Code style](https://img.shields.io/badge/Code%20Style-black-000000.svg)](https://github.com/psf/black)\n\nThis project helps create high quality figures for medical images for use in presentations and/or manuscripts.\n\n## Installation\n\n```powershell\ngit clone https://github.com/CBICA/FigureGenerator.git\ncd screenshot_maker\nconda create -n venv_screenshot python=3.7 -y\nconda activate venv_screenshot\npip install -e .\n```\n\nOR directly via Pip:\n\n```powershell\npip install FigureGenerator\n```\n\n## Usage\n\n```\npython ./figure_generator -h\nusage: FigureGenerator [-h] -images IMAGES [-masks MASKS] [-opacity OPACITY]\n [-ylabels YLABELS] -output OUTPUT [-axisrow AXISROW]\n [-boundtype BOUNDTYPE] [-fontsize FONTSIZE]\n [-borderpc BORDERPC] [-v]\n\nConstructing screenshots from medical images.\n\nContact: software@cbica.upenn.edu\n\nThis program is NOT FDA/CE approved and NOT intended for clinical use.\nCopyright (c) 2021 University of Pennsylvania. All rights reserved.\n\noptional arguments:\n -h, --help show this help message and exit\n -images IMAGES Input image files (comma-separated without any spaces in path and co-registered)\n -masks MASKS Mask files (comma-separated without any spaces in path and co-registered with images); if multiple files are passed, first is ground truth\n -opacity OPACITY Mask opacity between 0-1\n -ylabels YLABELS The comma-separated ylabels that will be displayed on the subplots' y-axis\n -output OUTPUT Output screenshot file\n -axisrow AXISROW Put all axes views across each column and stack images and blends in rows, defaults to False\n -boundtype BOUNDTYPE Construct bounding box around specified region; can be 'none, image or mask'\n -fontsize FONTSIZE Font size for all text on the figure\n -borderpc BORDERPC Percentage of size to use as border around bounding box (used only when mask and bounded are defined)\n -v, --version Show program's version number and exit.\n```\n\n## Examples\n\n### **Vertical** screenshot of multiple images **without** bounding:\n```powershell\npython ./figure_generator \\\n-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \\\n-masks C:/input/subject_001_seg.nii.gz \\\n-axisrow False \\\n-output C:/input/fig.png \n```\nGives the following output:\n\n<p align=\"center\">\n <img width=\"450\" src=\"images/fig_axisrowfalse.png\">\n</p>\n<!-- full-size image\n[<img src=\"images/fig_axisrowfalse.png\" width=\"450\"/>](axisrow_false)\n![axisrow_false](images/fig_axisrowfalse.png)\n -->\n\n### **Horizontal** screenshot of multiple images **without** bounding:\n```powershell\npython ./figure_generator \\\n-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \\\n-masks C:/input/subject_001_seg.nii.gz \\\n-axisrow True \\\n-output C:/input/fig.png \n```\nGives the following output:\n\n[<img src=\"images/fig_axisrowtrue.png\" width=\"900\"/>](axisrow_true)\n<!-- full-size image\n![axisrow_true](images/fig_axisrowtrue.png)\n -->\n\n### Horizontal screenshot of multiple images with **image-based bounding**:\n```powershell\npython ./figure_generator \\\n-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \\\n-masks C:/input/subject_001_seg.nii.gz \\\n-axisrow True \\\n-boundtype image \\\n-output C:/input/fig.png \n```\nGives the following output:\n\n[<img src=\"images/fig_axisrowtrue_boundedimage.png\" width=\"900\"/>](axistrue_boundedimage)\n<!-- full-size image\n![axisrow_true](images/fig_axisrowtrue_boundedimage.png)\n -->\n\n**Note**: This can be used with vertical orientation as well, by passing `-axisrow False` to the command.\n\n### Horizontal screenshot of multiple images with **mask-based bounding**:\n```powershell\npython ./figure_generator \\\n-images C:/input/subject_001_flair.nii.gz,C:/input/subject_001_t1ce.nii.gz,C:/input/subject_001_t1.nii.gz,C:/input/subject_001_t2.nii.gz \\\n-masks C:/input/subject_001_seg.nii.gz \\\n-axisrow True \\\n-boundtype mask \\\n-borderpc 0.001 \\\n-output C:/input/fig.png \n```\nGives the following output:\n\n[<img src=\"images/fig_axisrowtrue_boundedmask.png\" width=\"900\"/>](axistrue_boundedmask)\n<!-- full-size image\n![axisrow_true](images/fig_axisrowtrue_boundedmask.png)\n -->\n\n**Note**: This can be used with vertical orientation as well, by passing `-axisrow False` to the command.\n\n## Feedback\n\nPlease post on GitHub [Discussions](https://github.com/CBICA/FigureGenerator/discussions) or post an [issue](https://github.com/CBICA/FigureGenerator/issues/new/choose).\n",
"bugtrack_url": null,
"license": "BSD-3-Clause License",
"summary": "Making screenshots for presentations and manuscripts.",
"version": "0.0.4",
"project_urls": null,
"split_keywords": [
"medical-imaging",
"screenshot",
"figure-generator",
"publication"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4fd665dc83597d99c8c153918efd662993ca2287ab6302e41ae4626b2b17e5fa",
"md5": "6de69058e60c29aaba7dda50e3e728f0",
"sha256": "6ab88cd97471925ab21ac73e7671dc5b8ffb93288fc67378217ee628a4bf0539"
},
"downloads": -1,
"filename": "FigureGenerator-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6de69058e60c29aaba7dda50e3e728f0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 12842,
"upload_time": "2023-07-11T13:55:48",
"upload_time_iso_8601": "2023-07-11T13:55:48.483180Z",
"url": "https://files.pythonhosted.org/packages/4f/d6/65dc83597d99c8c153918efd662993ca2287ab6302e41ae4626b2b17e5fa/FigureGenerator-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cca45a670d207a6b5a60c4316e3d50743053bf074d44b6a9d04d7cae559fe976",
"md5": "e248dec27033802cd6fc7d53cc28f8f1",
"sha256": "96322e6a616d5697bd8ae1ab080d1cb4b3a4bb4720ce6343f576d37b74d1ac4d"
},
"downloads": -1,
"filename": "FigureGenerator-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "e248dec27033802cd6fc7d53cc28f8f1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 14022,
"upload_time": "2023-07-11T13:55:51",
"upload_time_iso_8601": "2023-07-11T13:55:51.531464Z",
"url": "https://files.pythonhosted.org/packages/cc/a4/5a670d207a6b5a60c4316e3d50743053bf074d44b6a9d04d7cae559fe976/FigureGenerator-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-11 13:55:51",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "figuregenerator"
}