Comments (2)
Thanks a lot for giving detailed answers and codes. It helped!
from arssr.
Thanks for your attention to our work!
These quantitative metrics we used are implemented based on some open-source Python libraries. The links are:
PSNR: https://scikit-image.org/docs/stable/api/skimage.metrics.html#skimage.metrics.peak_signal_noise_ratio
SSIM: https://scikit-image.org/docs/stable/api/skimage.metrics.html#skimage.metrics.structural_similarity
LPIPS:https://github.com/richzhang/PerceptualSimilarity
PSI:https://github.com/feichtenhofer/PSI
LPC-SI:https://ece.uwaterloo.ca/~z70wang/research/lpcsi/
Note that the first two (PSNR and SSIM) can be directly calculated for 3D volumes, while the last three (LPIPS, PSI, and LPC-SI) are designed for 2D slices. In our cases, we compute them by a slice-by-slice strategy that includes three steps:
- Given a 3D volume, we extract its 2D MR slices from three orthogonal directions (axial, sagittal, and coronal directions).
- We compute the scores for each 2D MR slice.
- We average the scores of all the 2D MR slices to calculate the final scores.
The following code snippet is to compute LPIPS using the slice-by-slice strategy:
import SimpleITK as sitk
import numpy as np
import torchs
import lpips
def compute_lpips(gt_slice, recon_slice):
lpips_alex = lpips.LPIPS(net = 'alex')
h, w = gt_slice.shape
gt_image = np.zeros((1, 3, h, w))
recon_image = np.zeros((1, 3, h, w))
for c in range(3):
gt_image[:, c, :, :] = gt_slice
recon_image[:, c, :, :] = recon_slice
lpips_value = lpips_alex(torch.tensor(gt_image).to(torch.float32), torch.tensor(recon_image).to(torch.float32))
return lpips_value
gt_volume_path = ''
recon_volume_path = ''
gt_volume = sitk.GetArrayFromImage(sitk.ReadImage(gt_volume_path))
recon_volume = sitk.GetArrayFromImage(sitk.ReadImage(recon_volume_path))
# In any volume, the center region often includes more image information than the margin region.
# Therefore, we extract 10 2D slices in the center from three directions, respectively.
# Here the volumes are 264*264*264 size
i_strart, i_end = 127, 137
lpips_value = 0.
for i in range(i_strart, i_end):
# direction 1
gt_slice = gt_volume[i, :, :]
recon_slice = recon_volume[i, :, :]
lpips_value += compute_lpips(gt_slice, recon_slice)
# direction 2
gt_slice = gt_volume[:, i, :]
recon_slice = recon_volume[:, i, :]
lpips_value += compute_lpips(gt_slice, recon_slice)
# direction 3
gt_slice = gt_volume[:, :, i]
recon_slice = recon_volume[:, :, i]
lpips_value += compute_lpips(gt_slice, recon_slice)
lpips_value = lpips_value / 30
print('LPIPS:', lpips_value)
from arssr.
Related Issues (13)
- 能否提供一下测试数据集 HOT 25
- HCP_1200 T1w原始数据 HOT 1
- HCP_1200 t1w 原始数据 HOT 1
- Which HCP-1200 data set of skull dissection was used in the paper? HOT 1
- 评价指标的代码 HOT 6
- quality metrics HOT 6
- 关于测试集下采样的问题 HOT 2
- some questions
- 你好,如何使用ANTs得到下面的这样的分割图? HOT 4
- 自动分割的问题 HOT 16
- Wrong command in README HOT 1
- training loss HOT 11
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 arssr.