Skip to content

Commit

Permalink
Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
gurayerus committed Sep 13, 2024
1 parent 8dc6de2 commit d2b37ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/NiChart_Viewer/src/pages/view_plot_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:",
Expand Down
7 changes: 7 additions & 0 deletions src/NiChart_Viewer/src/pages/workflow_sMRI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


0 comments on commit d2b37ac

Please sign in to comment.