Commit
·
2b62c92
1
Parent(s):
8017014
modifying the series list
Browse files
app.py
CHANGED
@@ -12,11 +12,13 @@ import papermill as pm
|
|
12 |
import subprocess
|
13 |
from PIL import Image
|
14 |
|
15 |
-
st.write(os.listdir())
|
16 |
|
17 |
# Main Streamlit app code
|
18 |
st.title("DICOM Classification Demo")
|
19 |
st.write("Select IDC data to download, extract images and metadata, and perform inference using three pre-trained models")
|
|
|
|
|
20 |
|
21 |
# Fetch IDC index
|
22 |
client = index.IDCClient()
|
@@ -25,6 +27,9 @@ index_df = client.index
|
|
25 |
# Option to choose IDC data
|
26 |
st.subheader("Choose IDC Data to Process")
|
27 |
collection_ids = index_df["collection_id"].unique()
|
|
|
|
|
|
|
28 |
selected_collection_id = st.selectbox("Select Collection ID", collection_ids)
|
29 |
|
30 |
# Filter dataframe based on selected collection_id
|
@@ -49,6 +54,13 @@ selected_study = st.selectbox("Select Study", studies)
|
|
49 |
df_filtered_by_study = df_filtered_by_modality[df_filtered_by_modality["StudyInstanceUID"] == selected_study]
|
50 |
|
51 |
series = df_filtered_by_study["SeriesInstanceUID"].unique()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
selected_series = st.selectbox("Select Series", series)
|
53 |
|
54 |
print('selected_series: ' + str(selected_series))
|
@@ -57,7 +69,7 @@ print('selected_series: ' + str(selected_series))
|
|
57 |
if st.button("Run inference"):
|
58 |
|
59 |
# Code to run when the button is pressed
|
60 |
-
st.write("Button pressed! Running inference")
|
61 |
|
62 |
if not os.path.exists("DICOMScanClassification_user_demo.ipynb"):
|
63 |
subprocess.run(["wget", "https://raw.githubusercontent.com/deepakri201/DICOMScanClassification_pw41/main/DICOMScanClassification_user_demo.ipynb"])
|
|
|
12 |
import subprocess
|
13 |
from PIL import Image
|
14 |
|
15 |
+
# st.write(os.listdir())
|
16 |
|
17 |
# Main Streamlit app code
|
18 |
st.title("DICOM Classification Demo")
|
19 |
st.write("Select IDC data to download, extract images and metadata, and perform inference using three pre-trained models")
|
20 |
+
st.write("NOTE: This demo only works for classification of MR series of the prostate - T2 weighted axial, DWI, ADC and DCE")
|
21 |
+
st.write("NOTE: These models were trained on patients from QIN-Prostate-Repeatability PCAMPMRI-00001 to PCAMPMRI-00012 and on ProstateX ProstateX-0000 to ProstateX-0275 patients. Therefore it is wise to not evaluate on those patients." )
|
22 |
|
23 |
# Fetch IDC index
|
24 |
client = index.IDCClient()
|
|
|
27 |
# Option to choose IDC data
|
28 |
st.subheader("Choose IDC Data to Process")
|
29 |
collection_ids = index_df["collection_id"].unique()
|
30 |
+
# only keep collection_ids with prostate in the name
|
31 |
+
collection_ids = [f if "prostate" in f for f in collection_ids]
|
32 |
+
print('collection_ids: ' + str(collection_ids))
|
33 |
selected_collection_id = st.selectbox("Select Collection ID", collection_ids)
|
34 |
|
35 |
# Filter dataframe based on selected collection_id
|
|
|
54 |
df_filtered_by_study = df_filtered_by_modality[df_filtered_by_modality["StudyInstanceUID"] == selected_study]
|
55 |
|
56 |
series = df_filtered_by_study["SeriesInstanceUID"].unique()
|
57 |
+
# Get the corresponding list of SeriesDescriptions
|
58 |
+
series_descriptions = df_filtered_by_study[df_filtered_by_study['SeriesInstanceUID'].isin(series)]['SeriesDescription'].values
|
59 |
+
|
60 |
+
print('number of series: ' + str(len(series)))
|
61 |
+
print('series_descriptions: ' + str(series_descriptions))
|
62 |
+
print('number of series_descriptions: ' + str(len(series_descriptions)))
|
63 |
+
|
64 |
selected_series = st.selectbox("Select Series", series)
|
65 |
|
66 |
print('selected_series: ' + str(selected_series))
|
|
|
69 |
if st.button("Run inference"):
|
70 |
|
71 |
# Code to run when the button is pressed
|
72 |
+
st.write("Button pressed! Running inference using three models")
|
73 |
|
74 |
if not os.path.exists("DICOMScanClassification_user_demo.ipynb"):
|
75 |
subprocess.run(["wget", "https://raw.githubusercontent.com/deepakri201/DICOMScanClassification_pw41/main/DICOMScanClassification_user_demo.ipynb"])
|