Skip to content

Commit b255cf7

Browse files
committed
forget api and remove channel dimension
1 parent 42a9cff commit b255cf7

File tree

6 files changed

+33
-32
lines changed

6 files changed

+33
-32
lines changed

docs/lit/examples/advanced_reco.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ d_under = reconstruction_MP2RAGE(path_bruker; mean_NR=true)
4747
begin
4848
f = Figure(size=(500,400))
4949
ax=Axis(f[1,1],title="TI₁ undersampled")
50-
h=heatmap!(ax,abs.(d_under["im_reco"][:,:,60,1,1,1]),colormap=:grays)
50+
h=heatmap!(ax,abs.(d_under["im_reco"][:,:,60,1,1]),colormap=:grays)
5151

5252
ax=Axis(f[1,2],title="TI₁ CS")
53-
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,1,1]),colormap=:grays)
53+
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,1]),colormap=:grays)
5454

5555

5656
ax=Axis(f[2,1],title="T₁ map undersampled")
57-
h=heatmap!(ax,d_under["T1map"][:,:,60,1,1],colorrange = (500,2000))
57+
h=heatmap!(ax,d_under["T1map"][:,:,60,1],colorrange = (500,2000))
5858

5959
ax=Axis(f[2,2],title="T₁ map CS")
60-
h=heatmap!(ax,d["T1map"][:,:,60,1,1],colorrange = (500,2000))
60+
h=heatmap!(ax,d["T1map"][:,:,60,1],colorrange = (500,2000))
6161

6262
for ax in f.content # hide decoration befor adding colorbar
6363
hidedecorations!(ax)

docs/lit/examples/simple_reco.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,32 @@ d = reconstruction_MP2RAGE(path_bruker; mean_NR=true)
2929

3030

3131
# the result is a dictionnary with the following fields :
32-
# - "im_reco" : (x,y,z,Number of Channel , Number of Repetition,TI) Complex
33-
# - "MP2RAGE" : (x,y,z,Number of Channel , Number of Repetition) Float
34-
# - "T1map" : (x,y,z,Number of Channel , Number of Repetition) Float
32+
# - "im_reco" : (x,y,z, Number of Repetition,TI) Complex
33+
# - "MP2RAGE" : (x,y,z , Number of Repetition) Float
34+
# - "T1map" : (x,y,z , Number of Repetition) Float
3535
# - "params_prot"
3636
# - "params_reco"
3737
# - "params_MP2RAGE"
3838
#
39-
# im_reco corresponds to the TI₁ and TI₂ images in the complex format with 6 dimensions :
40-
# (x,y,z, Number of Channel , Number of Repetition,TI)
39+
# im_reco corresponds to the TI₁ and TI₂ images in the complex format with 5 dimensions :
40+
# (x,y,z , Number of Repetition,TI). Channels are combined during the reconstruction
4141

4242

4343
# We can check the results
4444

4545
begin
4646
f = Figure(size=(500,400))
4747
ax=Axis(f[1,1],title="TI₁")
48-
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,1,1]),colormap=:grays)
48+
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,1]),colormap=:grays)
4949

5050
ax=Axis(f[1,2],title="TI₂")
51-
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,1,2]),colormap=:grays)
51+
h=heatmap!(ax,abs.(d["im_reco"][:,:,60,1,2]),colormap=:grays)
5252

5353
ax=Axis(f[2,1],title="UNIT1 / MP2RAGE")
54-
h=heatmap!(ax,d["MP2RAGE"][:,:,60,1,1],colormap=:grays)
54+
h=heatmap!(ax,d["MP2RAGE"][:,:,60,1],colormap=:grays)
5555

5656
ax=Axis(f[2,2],title="T₁ map")
57-
h=heatmap!(ax,d["T1map"][:,:,60,1,1],colorrange = (500,2000))
57+
h=heatmap!(ax,d["T1map"][:,:,60,1],colorrange = (500,2000))
5858

5959
for ax in f.content # hide decoration befor adding colorbar
6060
hidedecorations!(ax)

docs/src/api.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
```@autodocs
3+
Modules = [SEQ_BRUKER_a_MP2RAGE_CS_360]
4+
```

docs/src/index.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
CurrentModule = SEQ_BRUKER_a_MP2RAGE_CS_360
33
```
44

5-
# SEQ\_BRUKER\_a\_MP2RAGE\_CS\_360
5+
# SEQ\_BRUKER\_A\_MP2RAGE\_CS\_360
66

7-
Documentation for [SEQ_BRUKER_a_MP2RAGE_CS_360](https://github.com/aTrotier/SEQ_BRUKER_a_MP2RAGE_CS_360.jl).
7+
Documentation for [SEQ_BRUKER_a_MP2RAGE_CS_360](https://github.com/CRMSB/SEQ_BRUKER_a_MP2RAGE_CS_360.jl).
88

99
```@index
1010
```
11-
12-
```@autodocs
13-
Modules = [SEQ_BRUKER_a_MP2RAGE_CS_360]
14-
```

src/BIDS.jl

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ This function writes data from a dictionary (`d`) in BIDS (Brain Imaging Data St
88
**Arguments:**
99
1010
* `d` (Dict): A dictionary containing the data to be written. Expected key-value pairs:
11-
* `im_reco` (Array): 5D array containing the reconstructed images.
12-
* `MP2RAGE` (Array): Combined MP2RAGE image data.
13-
* `T1map` (Array): Calculated T1 map from MP2RAGE images.
11+
* `im_reco` (Array): 5D array containing the reconstructed images (x,y,z,NR,TI)
12+
* `MP2RAGE` (Array): Combined MP2RAGE image data. (x,y,z,NR)
13+
* `T1map` (Array): Calculated T1 map from MP2RAGE images. (x,y,z,NR)
1414
* `params_prot` (Dict): Protocol parameters extracted from the Bruker file.
1515
* `params_MP2RAGE` (Struct): Dictionary containing MP2RAGE specific parameters.
1616
@@ -52,12 +52,12 @@ function write_bids_MP2RAGE(d::Dict,subname::AbstractString,folder="")
5252
"_UNIT1",
5353
"_T1map"]
5454

55-
data_ = [ abs.(d["im_reco"][:,:,:,1,:,1]),
56-
angle.(d["im_reco"][:,:,:,1,:,1]),
57-
d["im_reco"][:,:,:,1,:,1],
58-
abs.(d["im_reco"][:,:,:,1,:,2]),
59-
angle.(d["im_reco"][:,:,:,1,:,2]),
60-
d["im_reco"][:,:,:,1,:,2],
55+
data_ = [ abs.(d["im_reco"][:,:,:,:,1]),
56+
angle.(d["im_reco"][:,:,:,:,1]),
57+
d["im_reco"][:,:,:,:,1],
58+
abs.(d["im_reco"][:,:,:,:,2]),
59+
angle.(d["im_reco"][:,:,:,:,2]),
60+
d["im_reco"][:,:,:,:,2],
6161
d["MP2RAGE"],
6262
d["T1map"]]
6363

src/reconstruction.jl

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Reconstructs MP2RAGE MRI data from a specified Bruker file path, returning image
1212
1313
# Returns
1414
A dictionary with the following key-value pairs:
15-
- `"im_reco"`: Reconstructed MP2RAGE image array, permuted to match the expected order.
15+
- `"im_reco"`: Reconstructed MP2RAGE image array, permuted to match the expected order (x,y,z,number of Channel, Number of repetition)
1616
- `"MP2RAGE"`: Combined MP2RAGE image data.
1717
- `"T1map"`: Calculated T1 map from MP2RAGE images.
1818
- `"params_reco"`: Dictionary of parameters used for reconstruction.
@@ -59,12 +59,13 @@ function reconstruction_MP2RAGE(path_bruker;mean_NR::Bool = false,paramsCS=Dict(
5959

6060
x_approx = reconstruction(acq, params).data
6161
if mean_NR
62-
x_approx = mean(x_approx,dims=6)
62+
x_approx = mean(x_approx,dims=6) # average accross repetition
6363
end
64-
x_approx = permutedims(x_approx,(1,2,3,5,6,4))
64+
x_approx = permutedims(x_approx,(1,2,3,5,6,4)) # permute to put contrast in last dimension
65+
x_approx = x_approx[:,:,:,1,:,:] # remove coil dimension
6566

6667
## process data to extract T1 maps
67-
MP2 = mp2rage_comb(x_approx[:,:,:,:,:,:])
68+
MP2 = mp2rage_comb(x_approx)
6869

6970
p = params_from_seq(b)
7071

0 commit comments

Comments
 (0)