Name | ascnii JSON |
Version |
0.0.1.dev21
JSON |
| download |
home_page | None |
Summary | View brain images in terminal using ASCII characters |
upload_time | 2024-04-23 13:34:05 |
maintainer | None |
docs_url | None |
author | Leonard Sasse |
requires_python | >=3.7 |
license | None |
keywords |
neuroimaging
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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.
```sh
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`:
![plot](./examples/example_default.png)
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`:
![plot](./examples/example_columns.png)
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](https://raw.githack.com/LeSasse/ascnii/main/examples/example_html.html).
## Change colormap and background color:
In order to change the colormap choose any of the [matplotlib colormaps](https://matplotlib.org/stable/tutorials/colors/colormaps.html)
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`:
![plot](./examples/example_color.png)
Raw data
{
"_id": null,
"home_page": null,
"name": "ascnii",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "neuroimaging",
"author": "Leonard Sasse",
"author_email": "l.sasse@fz-juelich.de",
"download_url": "https://files.pythonhosted.org/packages/84/1e/c1e17281529bf6fe2adba7aa5e497ab73d70e28a6d8a44839430351f539b/ascnii-0.0.1.dev21.tar.gz",
"platform": null,
"description": "# ascnii\n\nIf you always wanted to plot NIfTI images in terminal using ASCII characters,\nyou can do so now using the command line tool `ascnii`.\n\nHowever, for now, `ascnii` assumes that the image is in MNI space, and will\nlikely not work for other kinds of inputs (at the moment)!\n\n# Set up:\n\nYou can simply install from PyPI:\n\n`pip install ascnii`\n\nYou may or may not want to set up a virtual environment.\n\n```sh\npython3 -m venv .examplevenv\nsource .examplevenv/bin/activate\npip install -U pip\n```\n\nAlternatively, you can install from github.\nClone the repository to where you would like to install it.\n\n```\ngit clone https://github.com/LeSasse/ascnii.git\ncd ascnii\npip install -e .\n```\n\n# How to use:\n\nRun `ascnii --help`:\n\n```\nusage: ascnii [-h] [-o OUTPUT] [-H] [-C COLUMNS] [-c] [-m COLORMAP]\n [-b {black,red,red,green,yellow,blue,magenta,cyan,white}]\n [-t THRESHOLD] [-cc CUT_COORDS CUT_COORDS CUT_COORDS] [-a] [-d]\n nifti\n\nView NIfTI images in terminal using ASCII characters.\n\npositional arguments:\n nifti Path to the NIfTI file.\n\noptional arguments:\n -h, --help show this help message and exit\n -o OUTPUT, --output OUTPUT\n How to output the brain image. By default, prints to\n {'terminal'}. Otherwise, accepts a path to a html file or a\n txt file.\n -H, --header If activated, print out the image header as well.\n -C COLUMNS, --columns COLUMNS\n Number of character columns (in terminal) to use for\n plotting.\n -c, --colorbar If activated, a colorbar is plotted with the brain images.\n -m COLORMAP, --colormap COLORMAP\n Choose a colormap for the image.\n -b {black,red,red,green,yellow,blue,magenta,cyan,white}, --background {black,red,red,green,yellow,blue,magenta,cyan,white}\n Choose a terminal color for the background.\n -t THRESHOLD, --threshold THRESHOLD\n Threshold the given image below this value.\n -cc CUT_COORDS CUT_COORDS CUT_COORDS, --cut_coords CUT_COORDS CUT_COORDS CUT_COORDS\n MNI coordinates at which to plot the image.\n -a, --annotate If activated, positions and left/right annotation are\n added.\n -d, --draw_cross If activated, a cross is drawn on the plot to indicate the\n cut position.\n```\n\n# Examples:\n\n## Simple default plot of an anatomical image (3D) on a small terminal window:\n\n`ascnii example_img.nii.gz`:\n\n![plot](./examples/example_default.png)\n\nYou can also plot 4D NIfTI images, `ascnii` will simply plot the mean image.\n\n## Adjust the resolution with the `--columns` option:\n\nBy default, `ascnii` will use the complete width of the terminal, but you may want\nto adjust width manually.\nMake sure to zoom out a bit, so your terminal has enough space and\nrun `ascnii example_img.nii.gz --columns 600`:\n\n![plot](./examples/example_columns.png)\n\nThis is also useful if you want to output the ASCII image as an html to achieve higher\nresolution. For example `ascnii example_img.nii.gz --columns 700 -o example_html.html`\nresults in the image [here](https://raw.githack.com/LeSasse/ascnii/main/examples/example_html.html).\n\n## Change colormap and background color:\n\nIn order to change the colormap choose any of the [matplotlib colormaps](https://matplotlib.org/stable/tutorials/colors/colormaps.html)\nand hand them over as strings to the `--colormap` option. At the same time you can\nalso change the background color by handing any of the values listed for the\n`--background` option. Run `ascnii example_img.nii.gz -m plasma -b white`:\n\n![plot](./examples/example_color.png)\n",
"bugtrack_url": null,
"license": null,
"summary": "View brain images in terminal using ASCII characters",
"version": "0.0.1.dev21",
"project_urls": {
"repository": "https://github.com/LeSasse/ascnii"
},
"split_keywords": [
"neuroimaging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "35689ff323574c3df1fedab69a520480ccd7c9637cf5a5b35920100b2fa04abb",
"md5": "926affc74f9b17cc7faa2faf978e27e6",
"sha256": "d506874a3950436ee06d2c2afc0d84ae198006eeb611e469dd1164795b095224"
},
"downloads": -1,
"filename": "ascnii-0.0.1.dev21-py3-none-any.whl",
"has_sig": false,
"md5_digest": "926affc74f9b17cc7faa2faf978e27e6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 18261,
"upload_time": "2024-04-23T13:34:02",
"upload_time_iso_8601": "2024-04-23T13:34:02.655463Z",
"url": "https://files.pythonhosted.org/packages/35/68/9ff323574c3df1fedab69a520480ccd7c9637cf5a5b35920100b2fa04abb/ascnii-0.0.1.dev21-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "841ec1e17281529bf6fe2adba7aa5e497ab73d70e28a6d8a44839430351f539b",
"md5": "3d7807f05a0f56429e3043781d930fc3",
"sha256": "2c08f6ba02fa4b703730188bda046482094752598aca5e2f0d04e7c375e0b505"
},
"downloads": -1,
"filename": "ascnii-0.0.1.dev21.tar.gz",
"has_sig": false,
"md5_digest": "3d7807f05a0f56429e3043781d930fc3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2022410,
"upload_time": "2024-04-23T13:34:05",
"upload_time_iso_8601": "2024-04-23T13:34:05.305052Z",
"url": "https://files.pythonhosted.org/packages/84/1e/c1e17281529bf6fe2adba7aa5e497ab73d70e28a6d8a44839430351f539b/ascnii-0.0.1.dev21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-23 13:34:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LeSasse",
"github_project": "ascnii",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ascnii"
}