Skip to content

Commit

Permalink
add tips
Browse files Browse the repository at this point in the history
  • Loading branch information
aTrotier committed Nov 29, 2024
1 parent a137bf6 commit 59c4bdb
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
Manifest.toml
/docs/Manifest.toml
/docs/build/
/docs/.CondaPkg/
83 changes: 83 additions & 0 deletions docs/src/clip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Important tips

The relaxationColorMap() function selects the appropriate color-map (in this case, Lipari for T1) and applies logarithm-processing on that color map. The resulting colormap is returned.
The "imclip" image should retain the distinction between the "invalid" value of 0 (which is to be displayed as black) and "valid" values that are below loLev (these should be shown in a dark shade of blue). Depending on the calibration of your screen, you may or may not see that distinction.

A simplified processing can be done by

```julia
using qMRIColors
cmap = relaxationColorMap("T1")
VIEW(x,c=cmap) # Do not use range limits here!
```
Again, "VIEW" refers to your favorite viewing software.

If the simplified processing is invoked WITH use of range limits, then the
distinction is lost between invalid values and low-but-valid values. See second image in the
example below: it represents a circular object with a T1 value that is gradually increasing
from top to bottom, but only valid within a circular "object", the outside thereof representing
unknown T1 values.

Let's build an example to see the effect.

## Create a Synthetic phantom

```@example clip
using qMRIColors
using CairoMakie
# ----- Make test object: gradually increasing T1, but invalid outside a circle
size = 256; center = size÷2+1; radius = 100; origin = CartesianIndex(center,center)
d(x::CartesianIndex, y::CartesianIndex) = √( (x[1]-y[1])^2 + (x[2]-y[2])^2 )
row = [10*i for i in 1:size]
testT1= zeros(size,size)
testT1 .= row
# Set invalid values to 0
allidx = CartesianIndices(testT1)
invalid = allidx[ d.(origin, allidx) .> radius];
testT1[invalid] .= 0
nothing
```
## Display the example in 3 ways

```@example clip
# -------------------- Display test object the correct and the wrong way
loLev = 700
upLev = 2000
begin
f=CairoMakie.Figure()
ax=Axis(f[1,1],aspect = DataAspect(),title = "Using imClip")
cmap,imClip = relaxationColorMap("T1",testT1,loLev,upLev)
h=heatmap!(ax,rotr90(imClip),colormap=cmap,colorrange=(loLev,upLev))
Colorbar(f[1,2],h)
hidedecorations!(ax)
ax=Axis(f[2,1],aspect = DataAspect(),title = "wrong: simplified, \n with range")
cmap = relaxationColorMap("T1")
h=heatmap!(ax,rotr90(testT1),colormap=cmap,colorrange=(loLev,upLev))
Colorbar(f[2,2],h)
hidedecorations!(ax)
ax=Axis(f[3,1],aspect = DataAspect(),title = "OK: simplified, \n no range")
cmap = relaxationColorMap("T1")
h=heatmap!(ax,rotr90(testT1),colormap=cmap)
Colorbar(f[3,2],h)
hidedecorations!(ax)
# clean up plot
colsize!(f.layout, 1, Aspect(1,1))
resize_to_layout!(f)
f
end
```

## Conclusion


Use the clip version of the images + colormap + the color range

```julia
cmap,imClip = relaxationColorMap("T1",testT1,loLev,upLev)
heatmap(rotr90(imClip),colormap=cmap,colorrange=(loLev,upLev))
```
54 changes: 54 additions & 0 deletions docs/src/colormaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

# Colormaps available

```@example 1
using qMRIColors
using CairoMakie
```

## Lipari

This colormap is used for :
- T1

```@example 1
cmap = relaxationColorMap("T1")
cgrad(cmap)
```

## Navia

This colormap is used for :
- T2
- T2*
- T1rho
- T1ρ

```@example 1
cmap = relaxationColorMap("T2")
cgrad(cmap)
```

## Reverse lipari

This colormap is used for :
- R1

```@example 1
cmap = relaxationColorMap("R1")
cgrad(cmap)
```


## Reverse navia

This colormap is used for :
- R2
- R2*
- R1rho
- R1ρ
-
```@example 1
cmap = relaxationColorMap("R2")
cgrad(cmap)
```

0 comments on commit 59c4bdb

Please sign in to comment.