Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D recon #324

Draft
wants to merge 55 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
36408a2
3D_recon work in progress.
curtcorum Mar 13, 2024
674c0f2
Line 123 setup_raw() needs modifications for 3D?
curtcorum Mar 13, 2024
d3ff944
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Mar 24, 2024
826fa5e
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Mar 27, 2024
6368e89
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Mar 30, 2024
be10215
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Apr 5, 2024
b1ce21c
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Apr 8, 2024
a7fd74e
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Apr 8, 2024
c6c9e21
Merge branch 'master' into 3D_recon
cncastillo May 15, 2024
8eb57a9
Merge branch 'master' into 3D_recon
curtcorum Jun 4, 2024
f7a7c0b
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 5, 2024
440402d
Doctring updated for Sequence().
curtcorum Jun 6, 2024
971bca4
Fixed typo in Sequence() docstring.
curtcorum Jun 6, 2024
43f01dd
Now exporting default_sim_params.
curtcorum Jun 6, 2024
c669ecc
Changes to signal_to_raw_data, now separate counters for z and slices.
curtcorum Jun 7, 2024
032c3f2
Fixed counter calculation for nz and ns for signal_to_raw_data.
curtcorum Jun 7, 2024
38fd47a
Debugging counters for signal_to_raw_data. No need to reset the scan_…
curtcorum Jun 7, 2024
aa37f37
Counters fixed. Needs some more testing. Ready to try 3D recon with M…
curtcorum Jun 7, 2024
410c403
Fixing 2D vs 3D in progress, 2D currently broken in KomaUI()!!
curtcorum Jun 8, 2024
b5fc898
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 8, 2024
eb3e450
Still debugging...
curtcorum Jun 8, 2024
bbaa408
Merge branch '3D_recon' of github.com:curtcorum/KomaMRI.jl into 3D_recon
curtcorum Jun 8, 2024
c82a735
Still forces 2D recons someplace...???!!!
curtcorum Jun 8, 2024
570bde7
Debugging reconstruction calls from KomaUI().
curtcorum Jun 8, 2024
3bd4209
Debug raw data conversion for ge3d_cac.seq, something funny...!!!
curtcorum Jun 8, 2024
d977f25
A fair amount of work to estimate proper 3D recon parameters from seq…
curtcorum Jun 10, 2024
a4c387c
Update ISMRMRD.jl
curtcorum Jun 12, 2024
dacc56d
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 12, 2024
bd51a01
Update ISMRMRD.jl
curtcorum Jun 12, 2024
9aac620
Update ISMRMRD.jl
curtcorum Jun 12, 2024
05d862a
Update ISMRMRD.jl
curtcorum Jun 12, 2024
8719f0a
Update ISMRMRD.jl
curtcorum Jun 12, 2024
acc981d
Update ISMRMRD.jl
curtcorum Jun 12, 2024
eb9b789
Debugging signal_to_raw_data
curtcorum Jun 12, 2024
9f25e24
Check on Ny, Ns, Nz == 0 for scan counters.
curtcorum Jun 12, 2024
26c6c1b
Defaulting to `use_ndseq=true` for `signal_to_raw_data`.
curtcorum Jun 13, 2024
32b5dfd
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 17, 2024
8b46d5c
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 18, 2024
df5aff8
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 19, 2024
aba7452
Merge branch 'master' into 3D_recon
curtcorum Jun 20, 2024
8f3fc9f
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jun 24, 2024
6eb7702
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jul 8, 2024
585304f
Working on central recon parameter estimation in KomaMRICore/src/rawd…
curtcorum Jul 9, 2024
ffea298
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jul 15, 2024
af870bd
Working on estimate_seq_recon_dimension, working for 2d multislice, n…
curtcorum Jul 16, 2024
c8e76fb
Merge branch 'master' into 3D_recon
curtcorum Jul 16, 2024
12e0d63
Fixing merge.
curtcorum Jul 17, 2024
b101fe1
Whitespace formatting.
curtcorum Jul 17, 2024
c98d92b
Forced type of Nx, Ny, Nz, Ns read from seq.DEF to be Int64.
curtcorum Jul 17, 2024
18539d1
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Jul 17, 2024
0f317cb
LiearAlgebra added to Project. Check for radial sampling.
curtcorum Jul 18, 2024
3d5c2cc
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Aug 5, 2024
af4f6da
Merge branch 'master_merge' into 3D_recon_merge
curtcorum Sep 1, 2024
5bcff4f
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Sep 27, 2024
f393f4a
Merge branch 'JuliaHealth:master' into 3D_recon
curtcorum Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions KomaMRICore/src/rawdata/ISMRMRD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,24 @@ function signal_to_raw_data(
mink = minimum(ktraj, dims=1)
maxk = maximum(ktraj, dims=1)
Wk = maxk .- mink
Δx = 1 ./ Wk[1:2] #[m] Only x-y
Δx = 1 ./ Wk[1:3] #[m] Only x-y
Nx = get(seq.DEF, "Nx", 1)
Ny = get(seq.DEF, "Ny", 1)
Nz = get(seq.DEF, "Nz", 1)
Nd_seq = (Nx > 1) + (Ny > 1) + (Nz > 1)
if ndims != Nd_seq; @warn("Seqfile is $Nd_seq dimensional but recon is $ndims."); end
if haskey(seq.DEF, "FOV")
FOVx, FOVy, _ = seq.DEF["FOV"] #[m]
FOVx, FOVy, FOVz = seq.DEF["FOV"] #[m]
if FOVx > 1 FOVx *= 1e-3 end #mm to m, older versions of Pulseq saved FOV in mm
if FOVy > 1 FOVy *= 1e-3 end #mm to m, older versions of Pulseq saved FOV in mm
if FOVz > 1 FOVz *= 1e-3 end #mm to m, older versions of Pulseq saved FOV in mm
Nx = round(Int64, FOVx / Δx[1])
Ny = round(Int64, FOVy / Δx[2])
Nz = round(Int64, FOVy / Δx[3])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Ci gives an error saying that NadcsPerImage = floor(Int, Nadcs / Nz) => Nz = 0. This line could be the problem.

Suggested change
Nz = round(Int64, FOVy / Δx[3])
Nz = round(Int64, FOVz / Δx[3])

I wonder if Δx[3] is Inf.

else
FOVx = Nx * Δx[1]
FOVy = Ny * Δx[2]
FOVz = Nz * Δx[3]
end
#It needs to be transposed for the raw data
ktraj = maximum(2*abs.(ktraj[:])) == 0 ? transpose(ktraj) : transpose(ktraj)./ maximum(2*abs.(ktraj[:]))
Expand Down Expand Up @@ -125,15 +130,15 @@ function signal_to_raw_data(
# "trajectoryDescription" => Dict{String, Any}("comment"=>""), #You can put wathever you want here: comment, bandwidth, MaxGradient_G_per_cm, MaxSlewRate_G_per_cm_per_s, interleaves, etc
#encoding
# encodedSpace
"encodedSize" => [Nx, Ny, 1], #encodedSpace>matrixSize
"encodedFOV" => Float32.([FOVx, FOVy, 1e-3]*1e3), #encodedSpace>fieldOfView_mm
"encodedSize" => [Nx, Ny, Nz], #encodedSpace>matrixSize
"encodedFOV" => Float32.([FOVx, FOVy, FOVz]*1e3), #encodedSpace>fieldOfView_mm
# reconSpace
"reconSize" => [Nx+Nx%2, Ny+Ny%2, 1], #reconSpace>matrixSize
"reconFOV" => Float32.([FOVx, FOVy, 1e-3]*1e3), #reconSpace>fieldOfView_mm
"reconSize" => [Nx+Nx%2, Ny+Ny%2, Nz+Nz%2], #reconSpace>matrixSize
"reconFOV" => Float32.([FOVx, FOVy, FOVz]*1e3), #reconSpace>fieldOfView_mm
#encodingLimits
"enc_lim_kspace_encoding_step_0" => Limit(0, Nx-1, ceil(Int, Nx / 2)), #min, max, center, e.g. phase encoding line number
"enc_lim_kspace_encoding_step_1" => Limit(0, Ny-1, ceil(Int, Ny / 2)), #min, max, center, e.g. partition encoding number
"enc_lim_kspace_encoding_step_2" => Limit(0, 0, 0), #min, max, center, e.g. partition encoding number
"enc_lim_kspace_encoding_step_2" => Limit(0, Nz-1, ceil(Int, Nz / 2)), #min, max, center, e.g. partition encoding number
"enc_lim_average" => Limit(0, 0, 0), #min, max, center, e.g. signal average number
"enc_lim_slice" => Limit(0, 0, 0), #min, max, center, e.g. imaging slice number
"enc_lim_contrast" => Limit(0, 0, 0), #min, max, center, e.g. echo number in multi-echo
Expand Down
4 changes: 2 additions & 2 deletions src/KomaUI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ function KomaUI(; darkmode=true, frame=true, phantom_mode="2D", sim=Dict{String,
acq_data = AcquisitionData(raw_aux)
acq_data.traj[1].circular = false #Removing circular window
acq_data.traj[1].nodes = acq_data.traj[1].nodes[1:2,:] ./ maximum(2*abs.(acq_data.traj[1].nodes[:])) #Normalize k-space to -.5 to .5 for NUFFT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this line is generating problems.

Suggested change
acq_data.traj[1].nodes = acq_data.traj[1].nodes[1:2,:] ./ maximum(2*abs.(acq_data.traj[1].nodes[:])) #Normalize k-space to -.5 to .5 for NUFFT
acq_data.traj[1].nodes = acq_data.traj[1].nodes[1:3,:] ./ maximum(2*abs.(acq_data.traj[1].nodes[:])) #Normalize k-space to -.5 to .5 for NUFFT

Nx, Ny = raw_aux.params["reconSize"][1:2]
rec_params[:reconSize] = (Nx, Ny)
Nx, Ny, Nz = raw_aux.params["reconSize"][1:3]
rec_params[:reconSize] = (Nx, Ny, Nz)
rec_params[:densityWeighting] = true

# Perform reconstruction
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ExportUIFunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ end
"""
Returns the default raw signal used by the UI.
"""
function setup_raw()
function setup_raw() # needs modifications for 3D?

# Define the default RawAcquisitionData struct
raw = RawAcquisitionData(
Expand Down
Loading