Skip to content

Commit

Permalink
Use Type not DataType (#83)
Browse files Browse the repository at this point in the history
* Use Type not DataType

* Julia 1.10
  • Loading branch information
JeffFessler authored Apr 8, 2024
1 parent ae19e2b commit 33181fe
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"

[compat]
LazyGrids = "0.4, 0.5"
LazyGrids = "0.5"
SpecialFunctions = "1.8, 2"
julia = "1.9"
julia = "1.10"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ellipsoids/spheres, cuboids/cubes, gaussians, cylinders, cones.

### Compatibility

Tested with Julia ≥ 1.9.
Tested with Julia ≥ 1.10.

<!-- URLs -->
[action-img]: https://github.com/JuliaImageRecon/ImagePhantoms.jl/workflows/CI/badge.svg
Expand Down
4 changes: 2 additions & 2 deletions src/mri-sense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ leading to better boundary behavior than the DFT frequencies `k/N`.
* `kmax::Int = 5` default frequency index -kmax:kmax in all dimensions
* `kfun::Function = (k,N) -> k / (2N)` # DCT-II frequency
* `deltas::NTuple{D,<:Number} = ones(D)` pixel sizes
(For additional options `kmaxs`, `kt`, `ki`, see code.)
(For additional options `kmaxs`, `kt`, `ki`, `T`, see code.)
# Output
* `(; B, ν)` where `B` is basis matrix of size `count(mask) × nk`
Expand All @@ -47,7 +47,7 @@ function mri_smap_basis(
kfun::Function = (k,N) -> k / (2N), # DCT-II frequency
nfun::Function = (N) -> -(N÷2):(N÷2)-1,
basis::Function = (k,N) -> cispi.(2 * nfun(N) * kfun(k,N)), # 1D basis
T::DataType = ComplexF32,
T::Type{<:Complex{<:AbstractFloat}} = ComplexF32,
) where D
B = zeros(T, count(mask), length(ki))
for (i, k) in enumerate(ki)
Expand Down
2 changes: 1 addition & 1 deletion src/object2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function phantom(
y::AbstractVector,
oa::Array{<:Object2d},
oversample::Int ;
T::DataType = typeof(1f0 * oneunit(promote_type(eltype.(oa)...))),
T::Type{<:Number} = typeof(1f0 * oneunit(promote_type(eltype.(oa)...))),
)

oversample < 1 && throw(ArgumentError("oversample $oversample"))
Expand Down
2 changes: 1 addition & 1 deletion src/object3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function phantom(
z::AbstractVector,
oa::Array{<:Object3d{S,V}},
oversample::Int;
T::DataType = typeof(oneunit(V) * 1f0), # at least Float32
T::Type{<:Number} = typeof(oneunit(V) * 1f0), # at least Float32
) where {S, V <: Number}

oversample < 1 && throw(ArgumentError("oversample $oversample"))
Expand Down
4 changes: 2 additions & 2 deletions src/shepplogan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Convenience method for generating `M×N` samples of Shepp-Logan phantoms.
# Options
* `oversample::Int = 3` (usually)
* `yflip::Bool = true` (reverse `y` samples for convenience.)
* `T::DataType` default `Float32` (except `Int` for `BrainWeb` version)
* `T::Type{<:Number}` default `Float32` (except `Int` for `BrainWeb` version)
* `kwargs...` remaining options passed to `ellipse_parameters` for parameters.
# Out
Expand All @@ -107,7 +107,7 @@ function shepp_logan(
case::EllipsePhantomVersion ;
oversample::Int = 3,
yflip::Bool = true,
T::DataType = Float32,
T::Type{<:Number} = Float32,
kwargs...
)
ob = shepp_logan(case ; kwargs...)
Expand Down

0 comments on commit 33181fe

Please sign in to comment.