From d2b37aca1f9cca1cc126bd3516d2bb4e7898ca56 Mon Sep 17 00:00:00 2001 From: gurayerus Date: Thu, 12 Sep 2024 23:12:55 -0400 Subject: [PATCH] Edit --- src/NiChart_Viewer/src/pages/view_plot_data.py | 8 +++++--- src/NiChart_Viewer/src/pages/workflow_sMRI.py | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/NiChart_Viewer/src/pages/view_plot_data.py b/src/NiChart_Viewer/src/pages/view_plot_data.py index dd97408b..1c41267a 100644 --- a/src/NiChart_Viewer/src/pages/view_plot_data.py +++ b/src/NiChart_Viewer/src/pages/view_plot_data.py @@ -18,7 +18,7 @@ def browse_file_folder(is_file, init_dir): root = tk.Tk() - # root.withdraw() # Hide the main window + root.withdraw() # Hide the main window if is_file == True: out_path = filedialog.askopenfilename(initialdir = init_dir, multiple=0) else: @@ -222,9 +222,11 @@ def filter_dataframe(df: pd.DataFrame, pid) -> pd.DataFrame: with st.sidebar: with st.container(border=True): + # Input file name (check if saved to session_state from a previous module) + if "viewer_in_csv" in st.session_state: + fname_spare = st.session_state.viewer_in_csv + # Input file name (user can enter either using the file browser or type full path) - default_spare_name = '' - fname_spare = default_spare_name if st.sidebar.button("Select input file"): fname_spare = browse_file_folder(True, dir_root) spare_csv = st.sidebar.text_input("Enter the name of the ROI csv file:", diff --git a/src/NiChart_Viewer/src/pages/workflow_sMRI.py b/src/NiChart_Viewer/src/pages/workflow_sMRI.py index adeee88c..d9f8ee12 100644 --- a/src/NiChart_Viewer/src/pages/workflow_sMRI.py +++ b/src/NiChart_Viewer/src/pages/workflow_sMRI.py @@ -104,3 +104,10 @@ def browse_file_folder(is_file, init_dir): cmd = f"python3 {run_dir}/call_snakefile.py --run_dir {run_dir} --dset_name {dset_name} --input_rois {input_rois} --input_demog {input_demog} --dir_output {dir_output}" os.system(cmd) st.write("Run completed!") + + # Set output as the input file of the viewer + out_csv = f"{dir_output}/out_combined/{dset_name}_All.csv" + if os.path.exists(out_csv): + st.session_state.viewer_in_csv = out_csv + +