From 600ce0e2aa2cb24cedf088a1da8444ebc8a2604b Mon Sep 17 00:00:00 2001 From: gurayerus Date: Sat, 14 Dec 2024 23:21:51 -0500 Subject: [PATCH] Add renaming of roi indices --- src/Image_Processing/DTI/qsiprep | 2 +- src/Image_Processing/fMRI/fmriprep | 2 +- src/Image_Processing/fMRI/xcp_d | 2 +- src/Image_Processing/sMRI/DLICV | 2 +- src/Image_Processing/sMRI/DLMUSE | 2 +- src/Machine_Learning/spare_score | 2 +- src/viewer/pages/home.py | 35 ++++++++++-------------- src/viewer/pages/plot_sMRI_vars_study.py | 18 ++++++++++-- src/viewer/utils/utils_dataframe.py | 10 +++++++ 9 files changed, 47 insertions(+), 28 deletions(-) diff --git a/src/Image_Processing/DTI/qsiprep b/src/Image_Processing/DTI/qsiprep index 8802df40..aa43d3b0 160000 --- a/src/Image_Processing/DTI/qsiprep +++ b/src/Image_Processing/DTI/qsiprep @@ -1 +1 @@ -Subproject commit 8802df406b4dc15c720e78750cc7b457fa97c8ab +Subproject commit aa43d3b0aca0c8bf91d7e67c819fbf16bd6b819e diff --git a/src/Image_Processing/fMRI/fmriprep b/src/Image_Processing/fMRI/fmriprep index 73189de5..6c61481e 160000 --- a/src/Image_Processing/fMRI/fmriprep +++ b/src/Image_Processing/fMRI/fmriprep @@ -1 +1 @@ -Subproject commit 73189de5ee576ffc73ab432b7419304d44ce5776 +Subproject commit 6c61481e044116a06488fe43871fe4f6b1de6cf5 diff --git a/src/Image_Processing/fMRI/xcp_d b/src/Image_Processing/fMRI/xcp_d index b1601835..3ba1a93c 160000 --- a/src/Image_Processing/fMRI/xcp_d +++ b/src/Image_Processing/fMRI/xcp_d @@ -1 +1 @@ -Subproject commit b16018353448b1ff6cddf4ae1508bbe6b521ff11 +Subproject commit 3ba1a93c008fb15720d166da8ad12ec4046be562 diff --git a/src/Image_Processing/sMRI/DLICV b/src/Image_Processing/sMRI/DLICV index 7e20b7d9..66d3b2d0 160000 --- a/src/Image_Processing/sMRI/DLICV +++ b/src/Image_Processing/sMRI/DLICV @@ -1 +1 @@ -Subproject commit 7e20b7d9e285f7d604b4fd55d64ce09549a32357 +Subproject commit 66d3b2d0553334fa187fdfba0cf16b9b01860b6a diff --git a/src/Image_Processing/sMRI/DLMUSE b/src/Image_Processing/sMRI/DLMUSE index c954e506..940aa1d6 160000 --- a/src/Image_Processing/sMRI/DLMUSE +++ b/src/Image_Processing/sMRI/DLMUSE @@ -1 +1 @@ -Subproject commit c954e506cc202c7d613f8377d5a2dd8c0acb2d71 +Subproject commit 940aa1d68eb7afd81ec5877994db4fbe20534226 diff --git a/src/Machine_Learning/spare_score b/src/Machine_Learning/spare_score index 00e12d67..d22e18a2 160000 --- a/src/Machine_Learning/spare_score +++ b/src/Machine_Learning/spare_score @@ -1 +1 @@ -Subproject commit 00e12d67a56ff30c4590644a3f4e67c5a98982ac +Subproject commit d22e18a29794f90e10971b5fd8aad016c40b6ef7 diff --git a/src/viewer/pages/home.py b/src/viewer/pages/home.py index 05040370..68c82493 100644 --- a/src/viewer/pages/home.py +++ b/src/viewer/pages/home.py @@ -51,27 +51,28 @@ def set_pipeline() -> None: """ - Check out [NiChart Web page](https://neuroimagingchart.com) - Visit [NiChart GitHub](https://github.com/CBICA/NiChart_Project) - - Jump into our [documentation](https://github.com/CBICA/NiChart_Project) - - Ask a question in our [community - forums](https://github.com/CBICA/NiChart_Project) + - Jump into [our documentation](https://cbica.github.io/NiChart_Project) + - Ask a question in [our community discussions](https://github.com/CBICA/NiChart_Project/discussions) """ ) st.markdown( """ - You can try NiChart manually via our github - ```bash - git clone https://github.com/CBICA/NiChart_Project - git submodule update --init --recursive --remote - pip install -r requirements.txt + You can install NiChart Project desktop + ``` + pip install NiChart_Project ``` - And to run the workflows, just run: - ```bash - python3 run.py --dir_input input folder --dir_output output_folder --studies 1 --version my_version --cores 4 --conda 0 + and run the application + ``` + cd src/viewer + streamlit run NiChartProject.py ``` - You can always find more options at our documentation + Alternatively, the cloud app can be launched at + ``` + https://cloud.neuroimagingchart.com + ``` """ ) @@ -98,15 +99,9 @@ def set_pipeline() -> None: "😊 Your opinion matters! Kindly take a moment to complete these two brief surveys!" ) - st.markdown( - 'NiChart User Experience', - unsafe_allow_html=True, - ) + st.link_button('📝 NiChart User Experience', 'https://forms.office.com/r/mM1kx1XsgS') - st.markdown( - 'Shaping the Future of NiChart', - unsafe_allow_html=True, - ) + st.link_button('📝 Shaping the Future of NiChart', 'https://forms.office.com/r/acwgn2WCc4') # FIXME: For DEBUG utilst.add_debug_panel() diff --git a/src/viewer/pages/plot_sMRI_vars_study.py b/src/viewer/pages/plot_sMRI_vars_study.py index ce5ffaec..dab9546a 100644 --- a/src/viewer/pages/plot_sMRI_vars_study.py +++ b/src/viewer/pages/plot_sMRI_vars_study.py @@ -87,9 +87,13 @@ def panel_incsv() -> None: # Read data if working dir changed if st.session_state.plot_var["df_data"].shape[0] == 0: - st.session_state.plot_var["df_data"] = utildf.read_dataframe( + df_tmp = utildf.read_dataframe( st.session_state.paths["csv_plot"] ) + st.session_state.plot_var["df_data"] = utildf.rename_rois( + df_tmp, + st.session_state.rois["roi_dict"] + ) utilss.reset_plots() st.session_state.is_updated["csv_plot"] = False @@ -119,9 +123,13 @@ def panel_incsv() -> None: # Read input csv if st.session_state.is_updated["csv_plot"]: - st.session_state.plot_var["df_data"] = utildf.read_dataframe( + df_tmp = utildf.read_dataframe( st.session_state.paths["csv_plot"] ) + st.session_state.plot_var["df_data"] = utildf.rename_rois( + df_tmp, + st.session_state.rois["roi_dict"] + ) utilss.reset_plots() st.session_state.is_updated["csv_plot"] = False @@ -195,6 +203,12 @@ def panel_rename() -> None: st.session_state.plot_var["df_data"] = df st.success("Variables are renamed!") + s_title="Rename Data Columns" + s_text=""" + - If your data includes numeric columns + """ + utilst.util_get_help(s_title, s_text) + def panel_select() -> None: """ diff --git a/src/viewer/utils/utils_dataframe.py b/src/viewer/utils/utils_dataframe.py index fe773753..3fe8732e 100644 --- a/src/viewer/utils/utils_dataframe.py +++ b/src/viewer/utils/utils_dataframe.py @@ -19,8 +19,18 @@ def read_dataframe(fname: str) -> pd.DataFrame: df = df.rename(columns={'DLICV':'ICV', 'DLICV_centiles':'ICV_centiles'}) except: df = pd.DataFrame() + return df +def rename_rois(df: pd.DataFrame, roi_dict: dict) -> pd.DataFrame: + df_out = df.rename(columns=roi_dict) + + print(f'AAAA {df_out.shape}') + duplicate_columns = df_out.columns.duplicated()==False + print(f'bbbAAAA {df_out.columns.duplicated().sum()}') + df_out = df_out.loc[:, duplicate_columns] + return df_out + def filter_dataframe(df: pd.DataFrame) -> pd.DataFrame: """