NeuroAnalyzer tutorials: Download and install

Note: this toolbox is under active development and is subject to change.

First, download latest stable Julia version.

Multi-threading

Please note that Julia uses the JULIA_NUM_THREADS environmental variable to determine the number of threads available for the program.

For optimal performance this number should be > 1 and, depending upon your CPU number of cores, usually is equal or more than the number of cores.

For Unix-based systems (Linux, FreeBSD, MacOS) this may be set in the ~/.profile file or ~/.zshrc or ~/.bashrc (depending on your shell).

export JULIA_NUM_THREADS=12

The easiest way (which also works in Windows) it to set this variable in the Julia startup.jl file, located in ~/.julia/config directory:

ENV["JULIA_NUM_THREADS"] = 12
ENV["JULIA_NUM_PRECOMPILE_TASKS"] = 12

(!) Setting the JULIA_NUM_PRECOMPILE_TASKS variable speeds up packages precompilation process.

(!) Note that the 32-bit x86 architecture does not support threading due to lack of compiler runtime library support, so you may need to set JULIA_NUM_THREADS=0 and JULIA_NUM_PRECOMPILE_TASKS=0 if you’re on a 32-bit system.

(!) If you encounter the following error: dyld: Library not loaded: @rpath/libLLVM.dylib at pre-compilation, start Julia using:

julia --pkgimages=no

Installation using package manager

Since version 0.24.1, NeuroAnalyzer is registered in the Julia general registry. Therefore, the easiest way of installing the package is to use Pkg.add():

using Pkg
Pkg.add("NeuroAnalyzer")

You may also manually add NeuroAnalyzer using Julia package manager:

using Pkg
Pkg.update()
Pkg.add(url="https://codeberg.org/AdamWysokinski/NeuroAnalyzer.jl")
Pkg.resolve() # if necessary
Pkg.update()

Installation using environment

Another option is to initialize a new Julia environment for the package:

git clone https://codeberg.org/AdamWysokinski/NeuroAnalyzer.jl
cd NeuroAnalyzer.jl
julia --project
# or (in which case you may ignore the line `Pkg.activate(@__DIR__)` below)
julia

Activate the package in the Julia REPL:

using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
Pkg.resolve() # if necessary
Pkg.update()

Downloading zipped release

Alternatively, you may download NeuroAnalyzer latest release:

unzip NeuroAnalyzer-*.zip
cd NeuroAnalyzer-*
julia --project
# or (in which case you may ignore the line `Pkg.activate(@__DIR__)` below)
julia

Activate the package in the Julia REPL:

using Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
Pkg.resolve() # if necessary
Pkg.update()

Installation using LOAD_PATH variable

The third option is to extend the Julia LOAD_PATH variable in the ~/.julia/config/startup.jl with the NeuroAnalyzer folder (downloaded as cloned or zipped repository):

push!(LOAD_PATH, "path/to/NeuroAnalyzer/folder")

Running NeuroAnalyzer

Start Julia and in the Julia REPL do the following:

using NeuroAnalyzer

Due to the nature of Julia compiler, initial startup of NeuroAnalyzer takes several seconds. To speedup the process, creating a custom sysimage for reduced latency using PackageCompiler.jl is recommended. See this tutorial how to do it.

Show version and info (for reproducibility):

na_version()
"0.25.4"
na_info()
     NeuroAnalyzer: 0.25.4-dev
NeuroAnalyzer path: /home/eb/Documents/Code/NeuroAnalyzer.jl
     Julia version: 1.11.4
              CUDA: 12.6.0 (use_cuda = false)
      Plugins path: /home/eb/NeuroAnalyzer/plugins
    Resources path: /home/eb/.julia/artifacts/6f696f162cb48a93809736f4311ee729e58f4ee4/neuroanalyzer-resources
 Show progress bar: true
           Verbose: true
           Threads: 48 [set using `JULIA_NUM_THREADS` environment variable or Julia --threads command-line option]

For best performance, environment variable `JULIA_NUM_THREADS` (48) should be less than number of CPU threads (48)

Imported packages:
                   Cairo 1.1.1
            ColorSchemes 3.29.0
      ContinuousWavelets 1.1.2
                 Crayons 4.1.1
                     CSV 0.10.15
            CubicSplines 0.2.1
                    CUDA 5.7.0
              DataFrames 1.7.0
           Deconvolution 1.1.1
                   DICOM 0.11.0
               Distances 0.10.12
                     DSP 0.7.10
                    FFTW 1.8.1
                  FileIO 1.17.0
             FindPeaks1D 0.1.8
       FIRLSFilterDesign 0.1.0
            FourierTools 0.4.8
          GeometryBasics 0.5.5
                     Git 1.3.0
                     GLM 1.9.0
                     Gtk 1.3.0
         HypothesisTests 0.11.3
                  Images 0.26.2
       ImageBinarization 0.3.1
         ImageMorphology 0.4.5
     InformationMeasures 0.3.1
          Interpolations 0.14.0
                  Jacobi 0.7.0
                    JLD2 0.5.11
                    JSON 0.21.4
           LibSerialPort 0.5.2
          LinRegOutliers 0.11.5
                   Loess 0.6.4
                     MAT 0.10.7
                     MLJ 0.20.0
       MultivariateStats 0.10.3
              NeuroStats 0.2.2
                     NPZ 0.4.3
                  PiGPIO 0.2.1
                   Plots 1.40.7
             Polynomials 4.0.19
             Preferences 1.4.3
            PrettyTables 2.4.0
           ProgressMeter 1.10.2
           SavitzkyGolay 0.9.1
  ScatteredInterpolation 0.3.6
                 Simpson 1.0.1
               StatsFuns 1.3.2
                StatsKit 0.3.1
             StatsModels 0.7.4
              StatsPlots 0.15.7
               TimeZones 1.21.3
                    TOML 1.0.3
                     WAV 1.2.0
                Wavelets 0.9.5
             WaveletsExt 0.2.1
                     XDF 0.2.0

Get help:

?NeuroAnalyzer.plot

For interactive GUI, use Pluto and PlutoUI:

using Pkg
Pkg.add("Pluto")
Pkg.add("PlutoUI")
Pkg.add("Gtk")
using Pluto
Pluto.run()

Example Pluto notebook is located here.

For non-interactive GUI, use Jupyter:

using Pkg
Pkg.add("IJulia")
using IJulia
notebook()

Example Jupyter notebook is located here.

Docker image

NeuroAnalyzer is also available as the Docker image:

docker pull neuroanalyzer/neuroanalyzer:latest
xhost local:docker
docker run -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix -it neuroanalyzer