MagneticResonanceImaging / MRIReco.jl

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

Offsets Bruker acquisition is not handle by the current reconstruction pipeline #58

Closed aTrotier closed 2 years ago

aTrotier commented 2 years ago

The reconstruction pipeline images FOV is at the isocenter

aTrotier commented 2 years ago

One of the function I use in matlab is creating a linear ramp phase that I add to the current k-space before reconstruction.

function phaseOff = phaseOffsetCorrection_BruKitchen(bruk)

sx=bruk.acqp.ACQ_size(1)/2;
sy=bruk.method.PVM_Matrix(2);
PVM_SpatDimEnum = bruk.method.PVM_SpatDimEnum{1};

if strcmp(PVM_SpatDimEnum,'3D')
    sz=bruk.method.PVM_Matrix(3);
    phaseOffy=zeros(sx,sy,sz);
    phaseOffz=zeros(sx,sy,sz);

    for k=1:sz
        phaseOffz(:,:,k)=ones(sx,sy)*(k-sz/2+1)/sz*sz*-bruk.method.PVM_SPackArrSliceOffset/bruk.method.PVM_Fov(3);
    end
else
    sz=1;
    phaseOffy=zeros(sx,sy,sz);
    phaseOffz=zeros(sx,sy,sz);
end

for k=1:sy
    phaseOffy(:,k,:)=ones(sx,sz)*(k-sy/2+1)/sy*sy*bruk.method.PVM_SPackArrPhase1Offset/bruk.method.PVM_Fov(2);
end

phaseOff=phaseOffy+phaseOffz;
phaseOff=exp(1i*2*pi*phaseOff);

end

Maybe it is better/easier to perform a linear interpolation in the image domain ?

tknopp commented 2 years ago

I think doing it in Fourier space is the correct thing TODO.

aTrotier commented 2 years ago

At what point should we add the phase ?

Even if it is something specific to Bruker It might a better idea to either wrote a function that acts on the raw or acq structure ? In that case we can directly take the nodes and create the phase correction based on that ?

tknopp commented 2 years ago

I am not really sure. The easiest for now would be to add the phase when transitioning from the RawAcquisitionData to the AcquisitionData object. You would need to look at the ISMRMRD data format to check where they store that information. Then you can store it at the same location when going from BrukerFile to RawAcquisitionData. After that you add the phase here:

https://github.com/MagneticResonanceImaging/MRIReco.jl/blob/master/src/Datatypes/RawAcqData.jl#L193

aTrotier commented 2 years ago

Good idea, I forget it was already stored here : https://github.com/MagneticResonanceImaging/MRIReco.jl/blob/1e801179928d6488920b72ff6702592e8ab6585c/src/IO/Brukerfile.jl#L292

It might required some tests to validate that the metadata are right. Because we might also need that to create a good nifti at the end. (I have done some works here about that : https://github.com/aTrotier/ismrmrd_to_nifti)

aTrotier commented 2 years ago

I found more informations on magnetom.net :

% correct FOV shifts ROT = [head.phase_dir head.read_dir head.slice_dir]; % rotation matrix shifts = inv(ROT) (head.position./fov'); % FOV shifts (in units of fov) phi = exp(-2 pi i om(:,:,y)' shifts); % om = trajectory (unit 1/fov) data = phi . data; % data size is readout x coils

aTrotier commented 2 years ago

I'm working on that here : https://github.com/MagneticResonanceImaging/MRIReco.jl/pull/90