Skip to content

Commit ccb71b6

Browse files
authored
Merge pull request #536 from JuliaHealth/fix-motion-bugs
Fix motion bugs and add `colorscale` keyword in `plot_image`
2 parents 64efca0 + adce005 commit ccb71b6

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

KomaMRIBase/src/motion/Action.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
abstract type AbstractAction{T<:Real} end
22

33
Base.:()(a1::AbstractAction, a2::AbstractAction) = (typeof(a1) == typeof(a2)) & reduce(&, [getfield(a1, field) getfield(a2, field) for field in fieldnames(typeof(a1))])
4-
is_composable(m::AbstractAction) = false
4+
is_composable(m::AbstractAction) = true
55

66
# Simple actions
77
include("actions/SimpleAction.jl")

KomaMRIBase/src/motion/TimeCurve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ julia> periodic = Periodic(period=1.0, asymmetry=0.2)
107107
```
108108
![Periodic](../assets/periodic.svg)
109109
"""
110-
Periodic(period::T, asymmetry::T) where T = TimeCurve(t=[zero(T), period*asymmetry, period], t_unit=[zero(T), oneunit(T), zero(T)])
110+
Periodic(period::T, asymmetry::T) where T = TimeCurve(t=[zero(T), period*asymmetry, period], t_unit=[zero(T), oneunit(T), zero(T)], periodic=true)
111111
Periodic(; period=1.0, asymmetry=0.5) = Periodic(period, asymmetry)
112112

113113
""" Compare two TimeCurves """

KomaMRIBase/src/motion/actions/simpleactions/HeartBeat.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ julia> heartbeat = HeartBeat(circumferential_strain=-0.3, radial_strain=-0.2, lo
2323
longitudinal_strain :: T
2424
end
2525

26-
is_composable(action::HeartBeat) = true
27-
2826
function displacement_x!(ux, action::HeartBeat, x, y, z, t)
2927
r = sqrt.(x .^ 2 + y .^ 2)
3028
θ = atan.(y, x)

KomaMRIBase/src/motion/actions/simpleactions/Rotate.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ RotateX(pitch::T) where {T<:Real} = Rotate(pitch, zero(T), zero(T))
6060
RotateY(roll::T) where {T<:Real} = Rotate(zero(T), roll, zero(T))
6161
RotateZ(yaw::T) where {T<:Real} = Rotate(zero(T), zero(T), yaw)
6262

63-
is_composable(action::Rotate) = true
64-
6563
function displacement_x!(ux, action::Rotate, x, y, z, t)
6664
# Not using sind and cosd functions until bug with oneAPI is solved:
6765
# https://github.com/JuliaGPU/oneAPI.jl/issues/65

KomaMRIBase/src/motion/actions/simpleactions/Translate.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ TranslateX(dx::T) where {T<:Real} = Translate(dx, zero(T), zero(T))
2727
TranslateY(dy::T) where {T<:Real} = Translate(zero(T), dy, zero(T))
2828
TranslateZ(dz::T) where {T<:Real} = Translate(zero(T), zero(T), dz)
2929

30+
is_composable(m::Translate) = false
31+
3032
function displacement_x!(ux, action::Translate, x, y, z, t)
3133
ux .= t.* action.dx
3234
return nothing

KomaMRIPlots/src/ui/DisplayFunctions.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ function plot_image(
796796
zmax=maximum(image[:]),
797797
darkmode=false,
798798
title="",
799+
colorscale="Greys"
799800
)
800801
#Layout
801802
bgcolor, text_color, plot_bgcolor, grid_color, sep_color = theme_chooser(darkmode)
@@ -825,7 +826,7 @@ function plot_image(
825826
l.width = width
826827
end
827828
#Plot
828-
p = heatmap(; z=image, transpose=false, zmin=zmin, zmax=zmax, colorscale="Greys")
829+
p = heatmap(; z=image, transpose=false, zmin=zmin, zmax=zmax, colorscale=colorscale)
829830
config = PlotConfig(;
830831
displaylogo=false,
831832
toImageButtonOptions=attr(;

0 commit comments

Comments
 (0)