MagneticResonanceImaging / MRIReco.jl

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

Scaling of data #92

Open aTrotier opened 2 years ago

aTrotier commented 2 years ago

BART scales the data before performing the CS reconstruction (see). I found that very usefull because most of the time the "optimal" regularizations factor is consistent ( around 0.01).

Do you think it is a good idea to implement that as well ?

My student wrote most of the BART function in matlab if required

function scaling = get_bart_scaling(kdata,calib_dim)
% kdata : ordered kspace data ready to be reconstructed using bart
% calib_dim : dimensions of fully sampled center of kspace,
% calib_dim=[dim1,dim2,dim3], default is [32 32 32]
if (nargin<2); calib_dim=[32 32 32] ; end

kcenter=kdata((size(kdata,1)/2-calib_dim(1)/2-1):(size(kdata,1)/2+calib_dim(1)/2-2),(size(kdata,2)/2-calib_dim(2)/2+1):(size(kdata,2)/2+calib_dim(2)/2),(size(kdata,3)/2-calib_dim(3)/2+1):(size(kdata,3)/2+calib_dim(3)/2),:,:,1,1);
im_center=bart('fft -u -i 7',kcenter);
rss_center=bart('rss 8',im_center);
rescale=sqrt(size(kdata,1)/calib_dim(1))*sqrt(size(kdata,2)/calib_dim(2))*sqrt(size(kdata,3)/calib_dim(3));
rss_sorted=sort(rss_center(:))/rescale;
if (rss_sorted(end) - rss_sorted(round(end*0.9))) < 2 * (rss_sorted(round(end*0.9)) - rss_sorted(round(end/2)))
    scaling = rss_sorted(round(end*0.9));
else
    scaling = rss_sorted(end);
end

end