-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test case with 3d data was added in testAcqData.jl
- Loading branch information
Showing
3 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
using .Utils: get_default_cartesian_raw_acq_data | ||
using .Utils: get_default_cartesian_raw_acq_data_2d, get_default_cartesian_raw_acq_data_3d | ||
|
||
|
||
@testset "kDataCart restores the order when profiles are shuffled" begin | ||
n_profiles = 10 | ||
n_samples_per_profile = 12 | ||
data = rand(ComplexF32, n_samples_per_profile, n_profiles) | ||
f = get_default_cartesian_raw_acq_data(n_profiles, n_samples_per_profile, data) | ||
f = get_default_cartesian_raw_acq_data_2d(n_profiles, n_samples_per_profile, data) | ||
f.profiles = shuffle(f.profiles) | ||
acq = AcquisitionData(f) | ||
kdata = kDataCart(acq)[:, :, 1, 1, 1, 1] | ||
@test isapprox(kdata, data) | ||
end | ||
|
||
|
||
@testset "kDataCart restores the order when profiles are shuffled for 3D data" begin | ||
n_profiles = 10 | ||
n_samples_per_profile = 12 | ||
n_slices = 3 | ||
data = rand(ComplexF32, n_samples_per_profile, n_profiles, n_slices) | ||
elipsoid_mask = zeros(Bool, 1, n_profiles, n_slices) | ||
for i in 1:n_profiles | ||
for j in 1:n_slices | ||
elipsoid_mask[1, i, j] = (i-5)^2/25 + (j-2)^2/4 < 0.5 | ||
end | ||
end | ||
data .*= elipsoid_mask | ||
f = get_default_cartesian_raw_acq_data_3d(n_slices, n_profiles, n_samples_per_profile, data, elipsoid_mask) | ||
f.profiles = shuffle(f.profiles) | ||
acq = AcquisitionData(f) | ||
kdata = kDataCart(acq)[:, :, :, 1, 1, 1] | ||
|
||
@test isapprox(kdata, data) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
using Random | ||
using MRIBase | ||
using .Utils: get_default_cartesian_raw_acq_data | ||
using .Utils: get_default_cartesian_raw_acq_data_2d | ||
|
||
|
||
@testset "MRIBase.rawdata with dense 2D cartesian data" begin | ||
n_profiles = 10 | ||
n_samples_per_profile = 12 | ||
data = rand(ComplexF32, n_samples_per_profile, n_profiles) | ||
f = get_default_cartesian_raw_acq_data(n_profiles, n_samples_per_profile, data) | ||
f = get_default_cartesian_raw_acq_data_2d(n_profiles, n_samples_per_profile, data) | ||
kdata = MRIBase.rawdata(f) | ||
kdata = reshape(kdata, n_samples_per_profile, n_profiles) | ||
@test isapprox(kdata, data) | ||
end | ||
|
||
|
||
@testset "MRIBase.rawdata is not supposed to handle shuffles profiles" begin | ||
n_profiles = 10 | ||
n_samples_per_profile = 12 | ||
data = rand(ComplexF32, n_samples_per_profile, n_profiles) | ||
f = get_default_cartesian_raw_acq_data_2d(n_profiles, n_samples_per_profile, data) | ||
shuffle!(f.profiles) | ||
kdata = MRIBase.rawdata(f) | ||
kdata = reshape(kdata, n_samples_per_profile, n_profiles) | ||
@test !isapprox(kdata, data) | ||
end |