This release is a pre-release and may not be stable for production use.
ascnii
If you always wanted to plot NIfTI images in terminal using ASCII characters,
you can do so now using the command line tool ascnii.
However, for now, ascnii assumes that the image is in MNI space, and will
likely not work for other kinds of inputs (at the moment)!
Set up:
You can simply install from PyPI:
pip install ascnii
You may or may not want to set up a virtual environment.
python3 -m venv .examplevenv
source .examplevenv/bin/activate
pip install -U pip
Alternatively, you can install from github. Clone the repository to where you would like to install it.
git clone https://github.com/LeSasse/ascnii.git
cd ascnii
pip install -e .
How to use:
Run ascnii --help:
usage: ascnii [-h] [-o OUTPUT] [-H] [-C COLUMNS] [-c] [-m COLORMAP]
[-b {black,red,red,green,yellow,blue,magenta,cyan,white}]
[-t THRESHOLD] [-cc CUT_COORDS CUT_COORDS CUT_COORDS] [-a] [-d]
nifti
View NIfTI images in terminal using ASCII characters.
positional arguments:
nifti Path to the NIfTI file.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
How to output the brain image. By default, prints to
{'terminal'}. Otherwise, accepts a path to a html file or a
txt file.
-H, --header If activated, print out the image header as well.
-C COLUMNS, --columns COLUMNS
Number of character columns (in terminal) to use for
plotting.
-c, --colorbar If activated, a colorbar is plotted with the brain images.
-m COLORMAP, --colormap COLORMAP
Choose a colormap for the image.
-b {black,red,red,green,yellow,blue,magenta,cyan,white}, --background {black,red,red,green,yellow,blue,magenta,cyan,white}
Choose a terminal color for the background.
-t THRESHOLD, --threshold THRESHOLD
Threshold the given image below this value.
-cc CUT_COORDS CUT_COORDS CUT_COORDS, --cut_coords CUT_COORDS CUT_COORDS CUT_COORDS
MNI coordinates at which to plot the image.
-a, --annotate If activated, positions and left/right annotation are
added.
-d, --draw_cross If activated, a cross is drawn on the plot to indicate the
cut position.
Examples:
Simple default plot of an anatomical image (3D) on a small terminal window:
ascnii example_img.nii.gz:
You can also plot 4D NIfTI images, ascnii will simply plot the mean image.
Adjust the resolution with the --columns option:
By default, ascnii will use the complete width of the terminal, but you may want
to adjust width manually.
Make sure to zoom out a bit, so your terminal has enough space and
run ascnii example_img.nii.gz --columns 600:
This is also useful if you want to output the ASCII image as an html to achieve higher
resolution. For example ascnii example_img.nii.gz --columns 700 -o example_html.html
results in the image here.
Change colormap and background color:
In order to change the colormap choose any of the matplotlib colormaps
and hand them over as strings to the --colormap option. At the same time you can
also change the background color by handing any of the values listed for the
--background option. Run ascnii example_img.nii.gz -m plasma -b white:
Metadata
Release files for ascnii 0.0.1.dev21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ascnii-0.0.1.dev21.tar.gz | 2.0 MB | Without provenance | Details for ascnii-0.0.1.dev21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ascnii-0.0.1.dev21-py3-none-any.whl | Python 3 | none | any | Details for ascnii-0.0.1.dev21-py3-none-any.whl |
Total release size: 2.0 MB
Release files / ascnii-0.0.1.dev21.tar.gz
| Download URL | ascnii-0.0.1.dev21.tar.gz |
|---|---|
| Size | 2.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c08f6ba02fa4b703730188bda046482094752598aca5e2f0d04e7c375e0b505
|
|
BLAKE2b-256 checksum How to use checksums |
841ec1e17281529bf6fe2adba7aa5e497ab73d70e28a6d8a44839430351f539b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / ascnii-0.0.1.dev21-py3-none-any.whl
| Download URL | ascnii-0.0.1.dev21-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d506874a3950436ee06d2c2afc0d84ae198006eeb611e469dd1164795b095224
|
|
BLAKE2b-256 checksum How to use checksums |
35689ff323574c3df1fedab69a520480ccd7c9637cf5a5b35920100b2fa04abb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Security for ascnii 0.0.1.dev21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.