From df05e28cc886d3bf9a6b0b5f9861afdb41b01131 Mon Sep 17 00:00:00 2001 From: Stockless Date: Mon, 23 Dec 2024 15:37:08 -0300 Subject: [PATCH] Change colormap from ".mat" file to QMRIColors.jl --- KomaMRIPlots/src/ui/DisplayFunctions.jl | 34 +++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/KomaMRIPlots/src/ui/DisplayFunctions.jl b/KomaMRIPlots/src/ui/DisplayFunctions.jl index d4e2e83ad..0f28ad4f3 100644 --- a/KomaMRIPlots/src/ui/DisplayFunctions.jl +++ b/KomaMRIPlots/src/ui/DisplayFunctions.jl @@ -1080,12 +1080,42 @@ function plot_phantom_map( unit = " ms" if key == :T1 cmax_key = 2500 / factor - colormap = relaxationColorMap("T1") + colors = relaxationColorMap("T1") + N = length(colors) + idx = range(0, 1; length=N) + + # Create the colormap + colormap = [ + ( + idx[n], + string("rgb(", + floor(Int, colors[n].r * 255), ",", + floor(Int, colors[n].g * 255), ",", + floor(Int, colors[n].b * 255), ")" + ) + ) + for n in 1:N + ] elseif key == :T2 || key == :T2s if key == :T2 cmax_key = 250 / factor end - colormap = relaxationColorMap("T2") + colors = relaxationColorMap("T2") + N = length(colors) + idx = range(0, 1; length=N) + + # Create the colormap + colormap = [ + ( + idx[n], + string("rgb(", + floor(Int, colors[n].r * 255), ",", + floor(Int, colors[n].g * 255), ",", + floor(Int, colors[n].b * 255), ")" + ) + ) + for n in 1:N + ] end elseif key == :x || key == :y || key == :z factor = 1e2