MagneticResonanceImaging / MRIReco.jl

Julia Package for MRI Reconstruction
https://magneticresonanceimaging.github.io/MRIReco.jl/latest/
Other
85 stars 22 forks source link

Implement reconstruction for Bruker PV360 #158

Closed aTrotier closed 9 months ago

aTrotier commented 9 months ago

related to #157

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:loudspeaker: Thoughts on this report? Let us know!.

aTrotier commented 9 months ago

PV360 introduce a new way to define array :

##$PVM_EncGenSteps1=( 3840 )
@30*(-18) @30*(-17) @30*(-16) @30*(-15) @30*(-14) @30*(-13) @30*(-12) 
@30*(-11) @30*(-10) @30*(-9) @30*(-8) @30*(-7) @30*(-6) @30*(-5) @30*(-4) 
@30*(-3) @30*(-2) @30*(-1) @30*(0) @30*(1) @30*(2) @30*(3) @30*(4) @30*(5) 
@30*(6) @30*(7) @30*(8) @30*(9) @30*(10) @30*(11) @30*(12) @30*(13) @30*(14) 
@30*(15) @30*(16) @30*(17) @30*(18) 3 -24 -25 -30 -9 20 -12 -45 36 4 5 25 -16 
33 -11 32 23 -24 2 -19 38 31 -2 -28 25 -11 29 30 13 8 -41 -9 5 -3 -35 2 3 1 

I also removed the parse steps using try-catch and handled the type by hand with custom functions like in Bruker.jl

tknopp commented 9 months ago

Please just go ahead and merge once you are ready.

aTrotier commented 9 months ago

CS reconstruction with MRIReco vs Bruker :

b = BrukerFile("2023_SUPP_CryoTest/CS")

raw = RawAcquisitionData(b)
acq = AcquisitionData(raw,OffsetBruker=true)

sens = espirit(acq,eigThresh_2 = 0);

params = Dict{Symbol, Any}()
params[:reco] = "multiCoil"    # encoding model
params[:reconSize] = acq.encodingSize
params[:sparseTrafo] = "Wavelet" #sparse trafo
params[:regularization] = "L1"       # regularization
params[:λ] = 20.0
params[:solver] = "admm"    # solver
params[:iterations] = 3
params[:iterationsInner] = 2
params[:ρ] = 1.0e-1
params[:senseMaps] = sens

img_CS = abs.(reconstruction(acq, params))
image

The code handle the following cases for FLASH sequence :

I have to check if the loops works (NA/NR/NAE).

Some informations are lost about the acquisition like because the visu_pars file is now in the pdata folder (and sometime I disable the reconstruction

The visu files is now in the pdata/i folder

aTrotier commented 9 months ago

For information, the code also work with the MGE sequence (at least in fully) But not if you use some specific acceleration methods like :

I need to figure out how to compute the reconstruction matrix size (it is not directly stored in the metadata...)

aTrotier commented 9 months ago

Ok, seems good on my side for most of the cases. I have to relaunch the CI when the dataset is available if it works then we can merge this PR and it will be great to create a release :)

tknopp commented 9 months ago

I have uploaded the data and replaced the Artifacts.toml directly on your branch. Let's see if CI gets green now.

Very nice that you include some CS data. Is it the data with which you reconstructed above shown images?

aTrotier commented 9 months ago

Perfect, now we can merge it ! Yes it is the same dataset, if needed, we can use it in the documentation.

Can you make a release of all the package / subpackages I already need that in a lot of project (as well as the subspace implementation for a paper I'm writing)

tknopp commented 9 months ago

yea, I can do the releases but may need some days.

tknopp commented 9 months ago

@aTrotier: Releases are done. I additionally ported MRIReco from SparsityOperators to LinearOperatorCollection. The later is the successor of the former (more precise name and improved code).

For some reason I needed to adapt the following test accuracy: https://github.com/MagneticResonanceImaging/MRIReco.jl/blob/master/MRIFiles/test/testBrukerFile.jl#L142

I am not sure why but it may be something to do with BrukerFiles being loaded as Float32 instead of Float64 since I also needed to convert the nodes to Float64 since the sampling density calculation just returned zero weights otherwise (see this change https://github.com/MagneticResonanceImaging/MRIReco.jl/blob/c259559ecc715cb6415fce786833dfbce59506f4/MRIBase/src/Datatypes/AcqData.jl#L288)

But I am now happy that all tests pass again. Releasing all the packages when so much happened is quite a journey.