Plotting

Plotting is provided by calling recipes to Makie.jl. Hence by loading CairoMakie or GLMakie or WGLMakie, you can use custom function to interact with FODF data. For this part, we use CairoMakie but the user is encouraged to use GLMakie instead.

Let us start by reading some nii data.

using Tractography
const TG = Tractography

model = TG.TMC(Δt = 0.125f0,
            odfdata = TG.ODFData((@__DIR__) * "/../../examples/fod-FC.nii.gz"),
            cone = TG.Cone(15f0),
            proba_min = 0.005f0,
            )
TMC with elype Float32
 ├─ Δt = 0.125
 ├─ minimal probability = 0.005
 ├─ cone                = Cone{Float32}(15.0f0)
 ├─ mollifier           = default_mollifier
 ├─ evaluation of SH    = Tractography.PreComputeAllODF()
 └─ data : ⋯

Plotting the FODFs

We rely on the function plot_odf! provides the information regarding the keyword arguments.

using CairoMakie
f, sc = TG.plot_odf(model; n_sphere = 1500, radius = 1., I = 29:31, J = 30:31, K = 2:2);
f
Example block output

Plotting the streamlines

We rely on the function plot_streamlines! provides the information regarding the keyword arguments.

# make some streamlines
streamlines = zeros(Float32, 6, 100, 20)
for n = 1:20
    v0 = rand(3)*15
    for nt = 1:100
        streamlines[1:3, nt, n] .= v0 + nt .* [1,1+0.1*rand(),0]
    end
end
# plot the streamlines and the glyph
f = Figure(backgroundcolor = :white)
lscene = LScene(f[1,1])
TG.plot_streamlines!(lscene.scene, streamlines[1:3, 1:1:end, :])
TG.plot_odf!(lscene, model; n_sphere = 1500, radius = 1.3, st = 4);
f
Example block output