deepakri201 commited on
Commit
9a8d565
·
1 Parent(s): 9c7e8bf

removing the download of series in the app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -27
app.py CHANGED
@@ -52,38 +52,40 @@ df_filtered_by_study = df_filtered_by_modality[df_filtered_by_modality["StudyIns
52
  series = df_filtered_by_study["SeriesInstanceUID"].unique()
53
  selected_series = st.selectbox("Select Series", series)
54
 
 
55
 
56
- # Button to process IDC data
57
- if st.button("Process IDC data"):
58
- # Fetch data from IDC based on selection
59
- selection = index_df[
60
- (index_df["SeriesInstanceUID"] == selected_series)
61
- ]
62
 
63
- series_instance_uids = selection["SeriesInstanceUID"].tolist()
 
 
 
 
 
64
 
65
- # with TemporaryDirectory() as temp_dir:
66
- download_errors = []
67
- #input_dir = os.path.join(temp_dir, "input_data")
68
- input_dir=Path("input_data/")
69
- if input_dir.exists():
70
- shutil.rmtree(input_dir)
71
- os.makedirs(input_dir, exist_ok=True)
72
 
73
- try:
74
- client.download_from_selection(seriesInstanceUID=series_instance_uids, downloadDir=input_dir)
75
- except Exception as e:
76
- download_errors.append(f"Error downloading data: {str(e)}")
 
 
 
77
 
78
- if download_errors:
79
- st.error("\n".join(download_errors))
80
- else:
81
- st.success("Data downloaded successfully.")
82
 
83
- # Process downloaded DICOM data
84
- dicom_files = [str(file) for file in input_dir.glob('**/*.dcm')]
85
- # parquet_file = 'dcm2parquet_output.parquet'
86
- # save_dicom_header_to_parquet(dicom_files, parquet_file)
 
 
 
 
 
87
 
88
 
89
 
@@ -96,7 +98,7 @@ if st.button("Process IDC data"):
96
  pm.execute_notebook(
97
  "DICOMScanClassification_user_demo.ipynb",
98
  'output.ipynb',
99
- parameters = dict(SeriesInstanceUID=series_instance_uids)
100
  )
101
 
102
  with open('output.ipynb', "rb") as f:
 
52
  series = df_filtered_by_study["SeriesInstanceUID"].unique()
53
  selected_series = st.selectbox("Select Series", series)
54
 
55
+ print('selected_series: ' + str(selected_series))
56
 
 
 
 
 
 
 
57
 
58
+ # # Button to process IDC data
59
+ # if st.button("Process IDC data"):
60
+ # # Fetch data from IDC based on selection
61
+ # selection = index_df[
62
+ # (index_df["SeriesInstanceUID"] == selected_series)
63
+ # ]
64
 
65
+ # series_instance_uids = selection["SeriesInstanceUID"].tolist()
 
 
 
 
 
 
66
 
67
+ # # with TemporaryDirectory() as temp_dir:
68
+ # download_errors = []
69
+ # #input_dir = os.path.join(temp_dir, "input_data")
70
+ # input_dir=Path("input_data/")
71
+ # if input_dir.exists():
72
+ # shutil.rmtree(input_dir)
73
+ # os.makedirs(input_dir, exist_ok=True)
74
 
75
+ # try:
76
+ # client.download_from_selection(seriesInstanceUID=series_instance_uids, downloadDir=input_dir)
77
+ # except Exception as e:
78
+ # download_errors.append(f"Error downloading data: {str(e)}")
79
 
80
+ # if download_errors:
81
+ # st.error("\n".join(download_errors))
82
+ # else:
83
+ # st.success("Data downloaded successfully.")
84
+
85
+ # # Process downloaded DICOM data
86
+ # dicom_files = [str(file) for file in input_dir.glob('**/*.dcm')]
87
+ # # parquet_file = 'dcm2parquet_output.parquet'
88
+ # # save_dicom_header_to_parquet(dicom_files, parquet_file)
89
 
90
 
91
 
 
98
  pm.execute_notebook(
99
  "DICOMScanClassification_user_demo.ipynb",
100
  'output.ipynb',
101
+ parameters = dict(SeriesInstanceUID=selected_series)
102
  )
103
 
104
  with open('output.ipynb', "rb") as f: