-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathData Visualization.py
34 lines (31 loc) · 1.19 KB
/
Data Visualization.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
brain_df['mask'].value_counts()
import plotly.graph_objects as go # using plotly to create interactive plots
fig = go.Figure([go.Bar(x=brain_df['mask'].value_counts().index,
y=brain_df['mask'].value_counts(),
width=[.4, .4]
)
])
fig.update_traces(marker_color='rgb(158,202,225)', marker_line_color='rgb(8,48,107)',
marker_line_width=4, opacity=0.4
)
fig.update_layout(title_text="Mask Count Plot",
width=700,
height=550,
yaxis=dict(
title_text="Count",
tickmode="array",
titlefont=dict(size=20)
)
)
fig.update_yaxes(automargin=True)
fig.show()
for i in range(len(brain_df)):
if cv2.imread(brain_df.mask_path[i]).max() > 0:
break
plt.figure(figsize=(8,8))
plt.subplot(1,2,1)
plt.imshow(cv2.imread(brain_df.mask_path[i]));
plt.title('Tumor Location')
plt.subplot(1,2,2)
plt.imshow(cv2.imread(brain_df.image_path[i]));
cv2.imread(brain_df.mask_path[i]).max(), cv2.imread(brain_df.mask_path[i]).min()