Skip to main content

Making screenshots for presentations and manuscripts.

Project description

Figure Generator

PyPi Build & Tests Codacy Badge Codacy Badge Code style

This project helps create high quality figures for medical images for use in presentations and/or manuscripts.

Installation

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:

pip install FigureGenerator

Usage

python ./figure_generator -h
usage: FigureGenerator [-h] -images IMAGES [-masks MASKS] [-opacity OPACITY]
                       [-ylabels YLABELS] -output OUTPUT [-axisrow AXISROW]
                       [-boundimg BOUNDIMG] [-boundmask BOUNDMASK]
                       [-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
  -boundimg BOUNDIMG    Construct bounding box around non-zero pixels of input images
  -boundmask BOUNDMASK  Construct bounding box around binarized ground truth
  -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:

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:

Horizontal screenshot of multiple images without bounding:

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:

Horizontal screenshot of multiple images with image-based bounding:

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 \
-bounded True \
-output C:/input/fig.png 

Gives the following output:

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:

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 \
-boundmask True \
-borderpc 0.001 \
-output C:/input/fig.png 

Gives the following output:

Note: This can be used with vertical orientation as well, by passing -axisrow False to the command.

Feedback

Please post on GitHub Discussions or post an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FigureGenerator-0.0.2.tar.gz (12.9 kB view details)

Uploaded Source

File details

Details for the file FigureGenerator-0.0.2.tar.gz.

File metadata

  • Download URL: FigureGenerator-0.0.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.7.10

File hashes

Hashes for FigureGenerator-0.0.2.tar.gz
Algorithm Hash digest
SHA256 14c74f76e8c0acfad16e0b7447ed1f5d43344ef22268e04adbb9d4490eda27ba
MD5 9a430e08b06a667e29f15398ce108bb8
BLAKE2b-256 4fc9fb95013e54dd0dce195395818a75289205fbbe0f126393f4588d0b4cec02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page