Skip to content

Commit 496d695

Browse files
committed
replaced images with ImageTransform
1 parent d512f47 commit 496d695

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ authors = ["Benedikt V. Ehinger", "Maanik Marathe"]
44
version = "0.2.0"
55

66
[deps]
7-
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
7+
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
88
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
99
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1010
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1111

1212
[compat]
13-
Images = "0.25"
13+
ImageMorphology = "0.4"
1414
Random = "1"
1515
SparseArrays = "1"
1616
StatsBase = "0.33, 0.34"

src/ClusterDepth.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module ClusterDepth
22

33
using Random
4-
using Images
4+
using ImageMorphology
55
using SparseArrays
66
#using ExtendableSparse
77
using StatsBase

src/cluster.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ clusterdepth(data::AbstractArray, args...; kwargs...) =
2424
function clusterdepth(
2525
rng,
2626
data::AbstractArray;
27-
τ = 2.3,
28-
stat_type = :onesample_ttest,
29-
perm_type = :sign,
30-
side_type = :abs,
31-
nperm = 5000,
32-
pval_type = :troendle,
33-
(statfun!) = nothing,
34-
statfun = nothing,
27+
τ=2.3,
28+
stat_type=:onesample_ttest,
29+
perm_type=:sign,
30+
side_type=:abs,
31+
nperm=5000,
32+
pval_type=:troendle,
33+
(statfun!)=nothing,
34+
statfun=nothing,
3535
)
3636
if stat_type == :onesample_ttest
3737
statfun! = studentt!
@@ -57,13 +57,13 @@ function clusterdepth(
5757
data,
5858
permfun,
5959
τ;
60-
nₚ = nperm,
61-
(statfun!) = statfun!,
62-
statfun = statfun,
63-
sidefun = sidefun,
60+
nₚ=nperm,
61+
(statfun!)=statfun!,
62+
statfun=statfun,
63+
sidefun=sidefun,
6464
)
6565

66-
return pvals(statfun(data), cdmTuple, τ; type = pval_type)
66+
return pvals(statfun(data), cdmTuple, τ; type=pval_type)
6767
end
6868

6969

@@ -74,10 +74,10 @@ function perm_clusterdepths_both(
7474
data,
7575
permfun,
7676
τ;
77-
statfun = nothing,
78-
(statfun!) = nothing,
79-
nₚ = 1000,
80-
sidefun = nothing,
77+
statfun=nothing,
78+
(statfun!)=nothing,
79+
nₚ=1000,
80+
sidefun=nothing,
8181
)
8282
@assert !(isnothing(statfun) && isnothing(statfun!)) "either statfun or statfun! has to be defined"
8383

@@ -218,7 +218,7 @@ if the first and last cluster start on the first/last sample, we dont know their
218218
Input is assumed to be a thresholded Array with only 0/1
219219
"""
220220
function cluster(data)
221-
label = label_components(data)
221+
label = label_components(Matrix(data))
222222
K = maximum(label)
223223
start = fill(0, K)
224224
stop = fill(0, K)

test/cluster.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@testset "cluster" begin
22
s, l = ClusterDepth.cluster(
3-
[4.0, 0.0, 10.0, 0.0, 3.0, 4.0, 0, 4.0, 4.0, 0.0, 0.0, 5.0] .> 0.9,
3+
[4.0 0.0 10.0 0.0 3.0 4.0 0 4.0 4.0 0.0 0.0 5.0] .> 0.9,
44
)
55
@test s == [3, 5, 8]
66
@test l == [0, 1, 1]
77

8-
s, l = ClusterDepth.cluster([0.0, 0.0, 0.0, 0.0] .> 0.9)
8+
s, l = ClusterDepth.cluster([0.0 0.0 0.0 0.0] .> 0.9)
99
@test s == []
1010
@test l == []
1111
end
@@ -17,5 +17,5 @@ end
1717

1818
@testset "Tests for 3D data" begin
1919
data = randn(StableRNG(1), 3, 20, 5)
20-
@show ClusterDepth.clusterdepth(data; τ = 0.4, nperm = 5)
20+
@show ClusterDepth.clusterdepth(data; τ=0.4, nperm=5)
2121
end

0 commit comments

Comments
 (0)