Comments (2)
Thanks for your questions, we measured PSNR and SSIM using the metrics:
from skimage.metrics import structural_similarity as ssim
from skimage.metrics import peak_signal_noise_ratio as psnr
They are imported in https://github.com/utcsilab/csgm-mri-langevin/blob/main/plot-demo.ipynb, but seems like we didn't include a clear example, sorry about that. We compared the magnitude images using SSIM and PSNR.
The ground-truth was the complex-valued MVUE image obtained from the raw fastMRI kspace data, by first properly resizing it to a square size. Given that the ground-truth MVUE requires sensitivity maps, we used the BART toolbox to estimate them - https://mrirecon.github.io/bart/.
The sparse measurements were taken from this resized kspace, and our posterior sampling returns a square, complex-valued image of the same shape as the ground truth. For example, for the fastMRI T2 brain @ 3T axial dataset, we first resized the kspace to 384 x 384; we used a 1D FFT to resize the x-axis, and a crop on the y-axis (the x-axis is ~768 in the raw kspace data; the y-axis is >= 384).
I'll follow up with exact code snippets once I retrieve them, let us know if there are any other questions in the meantime.
from csgm-mri-langevin.
Here is the exact code we used to estimate sensitivity maps s_maps
from the raw fastMRI files via the BART toolbox Python API:
import sys
sys.path.insert(0, 'your/path/to/bart/python')
from bart import bart
# Load kspace from file
file = 'your/file/here.h5'
with h5py.File(file, 'r') as data:
# Get kspace
kspace= np.asarray(data['kspace'])
# Number of ACS lines
acs_lines = 12
(num_slices, num_coils, img_h, img_w) = kspace.shape
# Output maps
s_maps = np.zeros((num_slices, num_coils, img_h, img_w),
dtype=np.complex64)
# For each slice
for idx in tqdm(range(num_slices)):
# ACS
num_cols = k_image.shape[-1]
acs_idx = np.arange(num_cols //2 - acs_lines//2,
num_cols //2 + acs_lines//2)
# Remove everything except ACS
k_down = np.zeros(k_image.shape)
k_down[..., acs_idx] = k_image[..., acs_idx]
# Estimate maps from ACS region
s_maps[idx] = bart(1, 'ecalib -m1 -W -c0',
k_down.transpose((1, 2, 0))[None,...]).transpose(
(3, 1, 2, 0)).squeeze()
The other processing of kspace
that I mentioned previously can be found e.g. for T2 brain here:
csgm-mri-langevin/dataloaders.py
Lines 112 to 135 in 91e0a5a
Now one can use kspace
and paired s_maps
and run any reconstruction algorithm that results in a coil-combined image e.g. as in here: https://github.com/utcsilab/csgm-mri-langevin/blob/91e0a5ac658feaf6460045706ef16dd140894374/main.py#L198C37-L198C37
Finally, we used the SSIM and PSNR from scikit.metrics as:
from skimage.metrics import structural_similarity as ssim_loss
from skimage.metrics import peak_signal_noise_ratio as psnr_loss
ssim = ssim_loss(np.abs(gt_mvue), np.abs(estimated_mvue), data_range=np.abs(gt_mvue).max())
psnr = psnr_loss(np.abs(gt_mvue), np.abs(estimated_mvue), data_range=np.abs(gt_mvue).max())
from csgm-mri-langevin.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csgm-mri-langevin.