Package: ascnii
ascniiIf you always wanted to plot NIfTI images in terminal using ASCII characters,
you can do so now using the command line toolascnii.However, for now,ascniiassumes 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 ascniiYou may or may not want to set up a virtual environment.python3-mvenv.examplevenvsource.examplevenv/bin/activate
pipinstall-UpipAlternatively, 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:Runascnii --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,ascniiwill simply plot the mean image.Adjust the resolution with the--columnsoption:By default,ascniiwill 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
runascnii 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 exampleascnii example_img.nii.gz --columns 700 -o example_html.htmlresults in the imagehere.Change colormap and background color:In order to change the colormap choose any of thematplotlib colormapsand hand them over as strings to the--colormapoption. At the same time you can
also change the background color by handing any of the values listed for the--backgroundoption. Runascnii example_img.nii.gz -m plasma -b white: