Skip to content

Commit

Permalink
Performance: Limit number of colors defining T1/T2 colormaps to 35
Browse files Browse the repository at this point in the history
  • Loading branch information
cncastillo committed Sep 27, 2024
1 parent 51ea9df commit 790e1f2
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions KomaMRIPlots/src/ui/DisplayFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ function plot_phantom_map(
max_spins=20_000,
intermediate_time_samples=0,
max_time_samples=100,
frame_duration_ms=250,
kwargs...,
)
function interpolate_times(motion)
Expand Down Expand Up @@ -1073,27 +1072,37 @@ function plot_phantom_map(
unit = " ms"
if key == :T1
cmax_key = 2500 / factor
colors = MAT.matread(path * "/assets/T1cm.mat")["T1colormap"]
colors = MAT.matread(path * "/assets/T1cm.mat")["T1colormap"][1:70:end, :]
N, _ = size(colors)
idx = range(0, 1; length=N) #range(0,T,N) works in Julia 1.7
colormap = [
[
(
idx[n],
"rgb($(floor(Int,colors[n,1]*255)),$(floor(Int,colors[n,2]*255)),$(floor(Int,colors[n,3]*255)))",
] for n in 1:N
string("rgb(",
floor(Int, colors[n,1] * 255), ",",
floor(Int, colors[n,2] * 255), ",",
floor(Int, colors[n,3] * 255), ")"
)
)
for n in 1:N
]
elseif key == :T2 || key == :T2s
if key == :T2
cmax_key = 250 / factor
end
colors = MAT.matread(path * "/assets/T2cm.mat")["T2colormap"]
colors = MAT.matread(path * "/assets/T2cm.mat")["T2colormap"][1:70:end, :]
N, _ = size(colors)
idx = range(0, 1; length=N) #range(0,T,N) works in Julia 1.7
colormap = [
[
(
idx[n],
"rgb($(floor(Int,colors[n,1]*255)),$(floor(Int,colors[n,2]*255)),$(floor(Int,colors[n,3]*255)))",
] for n in 1:N
string("rgb(",
floor(Int, colors[n,1] * 255), ",",
floor(Int, colors[n,2] * 255), ",",
floor(Int, colors[n,3] * 255), ")"
)
)
for n in 1:N
]
end
elseif key == :x || key == :y || key == :z
Expand Down

0 comments on commit 790e1f2

Please sign in to comment.