diff --git a/ext/ConnectomesMakieExt.jl b/ext/ConnectomesMakieExt.jl index ad999ae..0c6742d 100644 --- a/ext/ConnectomesMakieExt.jl +++ b/ext/ConnectomesMakieExt.jl @@ -2,18 +2,13 @@ module ConnectomesMakieExt using Artifacts using Connectomes +import Connectomes: RegionDict, View, meshpath using Makie using ColorSchemes using Colors using MeshIO, FileIO -const meshpath = artifact"DKTMeshes" -mni_cortex() = joinpath(meshpath, "meshes/cortex/connectome-cortex.obj") -fs_cortex() = joinpath(meshpath, "meshes/cortex/fs-cortex.obj") -rh_cortex() = joinpath(meshpath, "meshes/cortex/rh-cortex.obj") -lh_cortex() = joinpath(meshpath, "meshes/cortex/lh-cortex.obj") - -function set_fig(;resolution::Tuple{Int64, Int64}=(1600,900), view=:front) +function Connectomes.set_fig(;resolution::Tuple{Int64, Int64}=(1600,900), view=:front) f = Figure(resolution = resolution) ax = Axis3(f[1,1], aspect = :data, azimuth = View[view]pi, elevation=0.0pi) hidedecorations!(ax) @@ -21,10 +16,6 @@ function set_fig(;resolution::Tuple{Int64, Int64}=(1600,900), view=:front) f end -RegionDict = Dict(zip([:left, :right, :all, :connectome], [lh_cortex(), rh_cortex(), fs_cortex(), mni_cortex()])) - -View = Dict(zip([:right, :front, :left, :back], [0.0, 0.5, 1.0, 1.5])) - function Connectomes.plot_cortex!(region::Symbol=:all; color=(:grey,0.05), transparency::Bool=true, kwargs...) mesh!(load(RegionDict[region]), color=color, transparency=transparency, kwargs...) end diff --git a/src/Connectomes.jl b/src/Connectomes.jl index 049bf5f..7e1345e 100644 --- a/src/Connectomes.jl +++ b/src/Connectomes.jl @@ -52,5 +52,6 @@ export plot_vertices export plot_vertex! export plot_connectome export plot_connectome! +export set_fig end diff --git a/src/plotting.jl b/src/plotting.jl index 38d22cb..dc23ebe 100644 --- a/src/plotting.jl +++ b/src/plotting.jl @@ -9,6 +9,7 @@ function plot_vertices end function plot_vertex! end function plot_connectome end function plot_connectome! end +function set_fig end const meshpath = artifact"DKTMeshes" mni_cortex() = joinpath(meshpath, "meshes/cortex/connectome-cortex.obj") @@ -16,14 +17,6 @@ fs_cortex() = joinpath(meshpath, "meshes/cortex/fs-cortex.obj") rh_cortex() = joinpath(meshpath, "meshes/cortex/rh-cortex.obj") lh_cortex() = joinpath(meshpath, "meshes/cortex/lh-cortex.obj") -function set_fig(;resolution::Tuple{Int64, Int64}=(1600,900), view=:front) - f = Figure(resolution = resolution) - ax = Axis3(f[1,1], aspect = :data, azimuth = View[view]pi, elevation=0.0pi) - hidedecorations!(ax) - hidespines!(ax) - f -end - RegionDict = Dict(zip([:left, :right, :all, :connectome], [lh_cortex(), rh_cortex(), fs_cortex(), mni_cortex()])) View = Dict(zip([:right, :front, :left, :back], [0.0, 0.5, 1.0, 1.5])) diff --git a/test/Project.toml b/test/Project.toml index 06ffbd1..87ac422 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,8 +1,9 @@ [deps] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" +GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" \ No newline at end of file +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/graphtest.jl b/test/graphtest.jl index 4255908..e1a6656 100644 --- a/test/graphtest.jl +++ b/test/graphtest.jl @@ -48,3 +48,10 @@ @test diffusive_weights == weighted_connectome_A == reweighted_connectome_A end + +@testset "Makie" begin + using GLMakie + + f = plot_cortex() + @test f isa Figure +end \ No newline at end of file