dfsp-spirit / NeuroFormats.jl

Handling of structural neuroimaging file formats for Julia.
GNU General Public License v3.0
11 stars 1 forks source link

ERROR: UndefVarError: read_annot not defined #4

Closed aalfi closed 2 years ago

aalfi commented 2 years ago

I am new to Julia. I don't understand the problem.

dfsp-spirit commented 2 years ago

It is hard to tell what is going on without seeing your source code.

But my guess is that you did not (install and) load the neuroformats package before calling the read_annot function from the package.

If you did not install it yet, see the installation section on the repo website.

Once installed, load it first with:

using NeuroFormats

All usage examples in the API documentation assume that the package is installed and loaded.

aalfi commented 2 years ago

Thank you, Dr. Schäfer! NeuroFormats is really impressive work!

I did install the package, I am not sure what I have to correct. Plz refer to the code below and let me know if I have to change anything

(@v1.7) pkg> add NeuroFormats [ Info: Use ./NeuroFormats to add or develop the local directory at ~/NeuroFormats. Updating registry at ~/.julia/registries/General.toml Resolving package versions... No Changes to ~/.julia/environments/v1.7/Project.toml No Changes to ~/.julia/environments/v1.7/Manifest.toml

julia> using NeuroFormats

julia> using GLMakie

julia> fs_subject_dir = "/home/alfin/NeuroFormats.jl/test/brain.mgz" "/home/alfin/NeuroFormats.jl/test/brain.mgz"

julia> surf = read_surf(fs_subject_dir, "/home/alfin/NeuroFormats.jl/test/lh.white") ERROR: UndefVarError: read_surf not defined Stacktrace: [1] top-level scope @ REPL[11]:1

dfsp-spirit commented 2 years ago

I cannot reproduce the problem.

I just downloaded Julia 1.7.2, started a fresh session, and everything works as expected. Here are the commands I type, step by step, including Julia installation

First download Julia 1.7.2 (currently the latest version from the official Julia website), then from my system shell, I unpack and start Julia (my OS is 64 bit Linux, so the file I downloaded is called julia-1.7.2-linux-x86_64.tar.gz):

cd ~/Downloads/
tar xzf julia-1.7.2-linux-x86_64.tar.gz
cd julia-1.7.2/
./bin/julia

Then in the julia prompt, install packages:

using Pkg
Pkg.add("NeuroFormats")
Pkg.add("GLMakie")

takes a while and installs stuff. Then run the example:

using NeuroFormats
using GLMakie

mgh = read_mgh(joinpath(tdd(), "subjects_dir/subject1/mri/brain.mgz"))
volume = dropdims(mgh.data, dims = 4) # drop time dimension, we only have one frame here.

axis = range(0, stop = 1, length = size(volume, 1))
scene3d = contour(axis, axis, axis, volume, alpha = 0.1, levels = 6)

Takes a while to precompile the GLMakie package and dependencies, then shows the brain image from the website.

Could you try that? What OS are you on? Or did you download a checkout of the development repo and try to run from that, maybe? Can you install and use functions from any other package?

aalfi commented 2 years ago

I worked on LINUX. The result of the cortical thickness showed up! It appears that I am having a problem connecting my GUI to the server. Everything is fine with the package! Thank you for your assistance!

dfsp-spirit commented 2 years ago

Great to hear that!

And good luck with getting the visualization to show up on the server.

aalfi commented 2 years ago

The result was obtained. Thanks a lot!