Skip to content

Commit

Permalink
Simplify decimate_uniform_phantom and use scattergl if NoMotion
Browse files Browse the repository at this point in the history
  • Loading branch information
pvillacorta committed Sep 27, 2024
1 parent 51f237b commit bfbf17c
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions KomaMRIPlots/src/ui/DisplayFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1062,16 +1062,8 @@ function plot_phantom_map(
end

function decimate_uniform_phantom(obj, num_points::Int)
dimx, dimy, dimz = KomaMRIBase.get_dims(obj)
ss = Int(ceil((length(obj) / num_points)^(1 / sum(KomaMRIBase.get_dims(obj)))))
ssx = dimx ? ss : 1
ssy = dimy ? ss : 1
ssz = dimz ? ss : 1
ix = sortperm(obj.x)[1:ssx:end]
iy = sortperm(obj.y)[1:ssy:end]
iz = sortperm(obj.z)[1:ssz:end]
idx = intersect(ix, iy, iz)
return obj[idx]
ss = Int(ceil(length(obj) / num_points))
return obj[1:ss:end]
end

if length(obj) > max_spins
Expand Down Expand Up @@ -1360,16 +1352,8 @@ function plot_phantom_map(
kwargs...,
)
function decimate_uniform_phantom(obj, num_points::Int)
dimx, dimy, dimz = KomaMRIBase.get_dims(obj)
ss = Int(ceil((length(obj) / num_points)^(1 / sum(KomaMRIBase.get_dims(obj)))))
ssx = dimx ? ss : 1
ssy = dimy ? ss : 1
ssz = dimz ? ss : 1
ix = sortperm(obj.x)[1:ssx:end]
iy = sortperm(obj.y)[1:ssy:end]
iz = sortperm(obj.z)[1:ssz:end]
idx = intersect(ix, iy, iz)
return obj[idx]
ss = Int(ceil(length(obj) / num_points))
return obj[1:ss:end]

Check warning on line 1356 in KomaMRIPlots/src/ui/DisplayFunctions.jl

View check run for this annotation

Codecov / codecov/patch

KomaMRIPlots/src/ui/DisplayFunctions.jl#L1355-L1356

Added lines #L1355 - L1356 were not covered by tests
end

if length(obj) > max_spins
Expand Down Expand Up @@ -1448,7 +1432,7 @@ function plot_phantom_map(
l.width = width
end
if view_2d
h = scatter(
h = scattergl(
x=obj.x*1e2,
y=obj.y*1e2,
mode="markers",
Expand Down

0 comments on commit bfbf17c

Please sign in to comment.