ENHANCE-PET / FALCON

FALCON is a Python-based software application designed to facilitate PET motion correction, both for head and total-body scans. Our program is built around the fast 'greedy' registration toolkit, which serves as the registration engine. With FALCON, users can enjoy a streamlined experience for implementing motion correction.
GNU General Public License v3.0
36 stars 6 forks source link

Analysis: Include scripts for plotting the evaluation results of falcon #25

Closed LalithShiyam closed 1 year ago

LalithShiyam commented 2 years ago

Plots needed:

  1. Plotly based Line plot with symmetric error bands

@Keyn34: please show a sample of the line plot with symmetric error bands that you created with excel to @DariaFerrara.

Keyn34 commented 2 years ago

@DariaFerrara, a sample of said plots can be found below: Image

The spreadsheet is attached: Moco_Data_Stats.xlsx

LalithShiyam commented 2 years ago

Image

Exactly, however, it would be nice to have the interpolation of the line plots as splines. So that the plot lines and symmetric bands look smooth. Just aesthetic issues. @DariaFerrara @Keyn34

DariaFerrara commented 2 years ago
import pandas as pd
import plotly.graph_objs as go

# Load excel file
df = pd.read_excel(r"C:\\Users\\ferra\\Downloads\\Moco_Data_Stats.xlsx", sheet_name=0)

# Define variables and standard deviations to plot
x = df['Frames']
y1 = df['DICE mean [motion-imposed, original data]']
y2 = df['DICE mean [constant GREEDY, original data]']
y1_std = df['DICE STD [motion-imposed, original data]']
y2_std = df['DICE STD [constant GREEDY, original data]']

# Line plot with symmetric error bands
fig = go.Figure([go.Scatter(x=x, y=y1,
                            mode='lines',
                            line=dict(color='rgb(51, 153, 51)', shape='spline'),
                            name='constant GREEDY'),
                 go.Scatter(x=x, y=y1+y1_std,
                            mode='lines',
                            marker=dict(color="#444"),
                            line=dict(width=0, shape='spline'),
                            showlegend=False),
                 go.Scatter(x=x, y=y1-y1_std,
                            marker=dict(color="#444"),
                            line=dict(width=0, shape='spline'),
                            mode='lines',
                            fillcolor='rgba(214, 245, 214, 0.5)',
                            fill='tonexty',
                            showlegend=False),
                 go.Scatter(x=x, y=y2,
                            mode='lines',
                            line=dict(color='rgb(204, 0, 102)', shape='spline'),
                            name='motion imposed'),
                 go.Scatter(x=x, y=y2+y2_std,
                            mode='lines',
                            marker=dict(color="#444"),
                            line=dict(width=0, shape='spline'),
                            showlegend=False),
                 go.Scatter(x=x, y=y2-y2_std,
                            marker=dict(color="#444"),
                            line=dict(width=0, shape='spline'),
                            mode='lines',
                            fillcolor='rgba(204, 0, 102, 0.2)',
                            fill='tonexty',
                            showlegend=False)])

fig.update_layout(xaxis_title='Frames', yaxis_title='DICE score',
                  title='Mean DICE score after constant GREEDY per frame before vs. after',
                  hovermode="x",
                  plot_bgcolor='white')
fig.show()
fig.write_html(r"C:\Users\ferra\Desktop\falcon_plot.html")