Skip to content

Commit

Permalink
Add renaming of roi indices
Browse files Browse the repository at this point in the history
  • Loading branch information
gurayerus committed Dec 15, 2024
1 parent 35a800a commit 600ce0e
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/Image_Processing/DTI/qsiprep
2 changes: 1 addition & 1 deletion src/Image_Processing/fMRI/fmriprep
2 changes: 1 addition & 1 deletion src/Image_Processing/fMRI/xcp_d
Submodule xcp_d updated 169 files
2 changes: 1 addition & 1 deletion src/Machine_Learning/spare_score
35 changes: 15 additions & 20 deletions src/viewer/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
"""
)

Expand All @@ -98,15 +99,9 @@ def set_pipeline() -> None:
"😊 Your opinion matters! Kindly take a moment to complete these two brief surveys!"
)

st.markdown(
'<a href=" https://forms.office.com/r/mM1kx1XsgS" target="_blank" style="color: blue; font-size: 16px; font-weight: bold;">NiChart User Experience</a>',
unsafe_allow_html=True,
)
st.link_button('📝 NiChart User Experience', 'https://forms.office.com/r/mM1kx1XsgS')

st.markdown(
'<a href="https://forms.office.com/r/acwgn2WCc4" target="_blank" style="color: blue; font-size: 16px; font-weight: bold;">Shaping the Future of NiChart</a>',
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()
18 changes: 16 additions & 2 deletions src/viewer/pages/plot_sMRI_vars_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
"""
Expand Down
10 changes: 10 additions & 0 deletions src/viewer/utils/utils_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit 600ce0e

Please sign in to comment.