Skip to content
Snippets Groups Projects
Commit 40fab0a2 authored by Nuno Pimpão Santos Martins's avatar Nuno Pimpão Santos Martins
Browse files

add notebooks for ssim data, regarind double degradation experiment

parent 9aebddf8
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:78cf33ef-5d5f-4ef4-8b9a-05d0c62f7ec3 tags:
``` python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
import numpy as np
```
%% Cell type:code id:71683726-4bc2-45e7-b71c-244546fb7330 tags:
``` python
data_path = 'W:/NPC_adult_new/quantification_data/ssim_quantification/'
# data_path = '/mnt/e/Data/contrast_enhancement_paper/quantification_data/'
```
%% Cell type:code id:3d243ded-8625-43cf-8797-92a32846129c tags:
``` python
filename = 'dcx1_vs_degx2_all_ssim_20230725.csv'
```
%% Cell type:code id:652cbe9c-3ce1-4bb0-9849-2088accd2c46 tags:
``` python
data = pd.read_csv(os.path.join(data_path, filename))
```
%% Cell type:code id:e96ecefd-4808-4521-950b-c57c1b81778f tags:
``` python
data_filtered = data.loc[data['Real Z'] < 300]
data_filtered = data_filtered.loc[data_filtered['Real Z'] > 10]
```
%% Cell type:code id:13322995-5ee7-4101-8c9b-eac3263d66ec tags:
``` python
#ref line properties
ref_alpha = 0.2
ref_color = 'k'
ref_style = 'dashed'
#Plot 1
# fig = plt.figure(figsize=(12, 6))
# fig.add_subplot(1, 2, 1)
fig, ax1 = plt.subplots(1, 1, figsize=(6,6))
#Z depth reference line, qualitative results
# plt.vlines(x=[11.1, 50.4, 90.9], ymin=0, ymax=10, colors=ref_color, alpha=ref_alpha, linestyles=ref_style)
sns.lineplot(
data=data_filtered, x='Real Z scaled', #x=[x for x in range(len(perc_ci_mean))],
y="SSIM",
# hue="Condition",
errorbar='se',
linewidth=3,
# palette=["tab:grey","tab:blue", "tab:green", "tab:orange"],
# palette=["grey","blue", "darkblue", "lightgreen", "mediumseagreen", "darkgreen", "sandybrown", "orange", "darkorange"],
# palette=["tab:grey", "b", "g", "orange"],
ax=ax1,
)
sns.despine()
# plt.ylabel('Percentile Contrast Index')
plt.ylabel(' ')
plt.xlabel(' ')
handles, labels = ax1.get_legend_handles_labels()
ax1.legend(
handles=handles,
labels=labels,
# ["Raw", "CLAHE", "Deconvolution", "FCE-Net", "DeepContrast"],
# labelcolor = ["grey","blue", "darkblue", "seagreen", "red", "darkorange"],
loc='upper right',
bbox_to_anchor=(1.15, 1.10),
# fontsize=font_size,
)
# plt.ylim(0.5, 3.0)
# plt.xlim(5.7, 93)
# fig.savefig(data_path+'figures/contrast_quantification_alldata_avg_se_pci_withZref.png', dpi=300, bbox_inches='tight')
```
%% Output
No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.
<matplotlib.legend.Legend at 0x1ef52ada280>
%% Cell type:markdown id:d93fd489-2789-420a-83a2-850e6cc47ae1 tags:
## Getting some simple statistics per condition
%% Cell type:markdown id:fa83a48d-c091-4e74-bb35-c242ddc78a5a tags:
### Percentile Contrast Index stats per condition
mean
%% Cell type:code id:d5e7f3c1-a71e-410d-a8f4-8ff20ae0c971 tags:
``` python
ssim_mean = data_filtered.groupby(['Position'])['SSIM'].mean()
ssim_mean
```
%% Output
Position
Intermediate 0.753602
Surface 0.797983
undefined 0.765423
Name: SSIM, dtype: float64
%% Cell type:markdown id:29788037-a481-4396-906d-e42e679cb9b2 tags:
standard Deviation
%% Cell type:markdown id:66afa544-97e1-457b-b826-9a32baf89e0c tags:
___
%% Cell type:code id:4eb0ce2e-9a1a-4e81-a04b-ad9fd948bd0d tags:
``` python
data_ssim_all = data_filtered['SSIM'].mean()
data_ssim_all
```
%% Output
0.7654951771536332
%% Cell type:code id:8feb4341-0263-4a82-b5cf-7058b3d53a7a tags:
``` python
data_ssim_verydeep = data_filtered.loc[data_filtered['Real Z scaled'] > 85]
# data_psnr = data_psnr.loc[data_psnr['Real Z scaled'] > 93]
```
%% Cell type:code id:6340b6b7-f5a7-4bb7-be53-36e172716724 tags:
``` python
ssim_mean = data_ssim_verydeep['SSIM'].mean()
print(ssim_mean)
ssim_sd = data_ssim_verydeep['SSIM'].std()
print(ssim_sd)
```
%% Output
0.7045112525625001
0.07506882273592072
%% Cell type:code id:7f34999b-66f6-4641-90b1-79de449e19de tags:
``` python
data_ssim_deep = data_filtered.loc[data_filtered['Real Z scaled'] < 85]
data_ssim_deep = data_ssim_deep.loc[data_ssim_deep['Real Z scaled'] > 70]
```
%% Cell type:code id:61a1e022-1e9f-4f80-8658-c671f75c7543 tags:
``` python
ssim_mean = data_ssim_deep['SSIM'].mean()
print(ssim_mean)
ssim_sd = data_ssim_deep['SSIM'].std()
print(ssim_sd)
```
%% Output
0.7179216334719999
0.08817865781126294
%% Cell type:code id:bcbfbd70-0b54-4d57-90a6-13f83d59f93c tags:
``` python
data_ssim_intermediate = data_filtered.loc[data_filtered['Real Z scaled'] < 70]
data_ssim_intermediate = data_ssim_intermediate.loc[data_ssim_intermediate['Real Z scaled'] > 30]
```
%% Cell type:code id:aa0eea4b-745e-4863-b6fc-4c9110331596 tags:
``` python
ssim_mean = data_ssim_intermediate['SSIM'].mean()
print(ssim_mean)
ssim_sd = data_ssim_intermediate['SSIM'].std()
print(ssim_sd)
```
%% Output
0.7694167237889725
0.05672699485707282
%% Cell type:code id:18ee702b-bdcf-4a9a-84a1-b50d12d71d75 tags:
``` python
data_ssim_shallow = data_filtered.loc[data_filtered['Real Z scaled'] > 15]
data_ssim_shallow = data_ssim_shallow.loc[data_ssim_shallow['Real Z scaled'] < 30]
```
%% Cell type:code id:63cb526e-946c-4840-8a66-a0a4783da50f tags:
``` python
ssim_mean = data_ssim_shallow['SSIM'].mean()
print(ssim_mean)
ssim_sd = data_ssim_shallow['SSIM'].std()
print(ssim_sd)
```
%% Output
0.8010575571891156
0.0520739904052131
%% Cell type:code id:acfceaeb-6a19-4f5c-83c0-2267a59bce2c tags:
``` python
data_ssim_veryshallow = data_filtered.loc[data_filtered['Real Z scaled'] < 15]
```
%% Cell type:code id:5c96e298-c496-4eeb-b808-ca1b5b547fb1 tags:
``` python
ssim_mean = data_ssim_veryshallow['SSIM'].mean()
print(ssim_mean)
ssim_sd = data_ssim_veryshallow['SSIM'].std()
print(ssim_sd)
```
%% Output
0.7918207946974359
0.05674874985648138
%% Cell type:code id:376d9867-56ca-4ae8-9a2b-1212162d01cd tags:
``` python
```
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment