Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ge dev #75

Merged
merged 19 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
.git
test
test_data
output_folder
output_folder/**
!output_folder/NiChart_sMRI_Demo1
!output_folder/NiChart_sMRI_Demo2
**/*.nii.gz
build
**/build
src/NiChart_Website

# Ignore hidden files and directories
.*

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,4 @@ test/test_output

## make sure no data go to the repo
##*.nii.gz

7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ RUN grep -v -E '^(torch)' /tmp/requirements.txt > /tmp/requirements2.txt
USER root
RUN apt-get update && apt-get install -y python3-tk git
USER $MAMBA_USER
RUN pip install --verbose -r /tmp/requirements2.txt && pip uninstall -y torch && pip install --verbose torch==2.3.1 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION}
RUN pip install --verbose -r /tmp/requirements2.txt
RUN mkdir ~/dummyinput && mkdir ~/dummyoutput
RUN git clone https://github.com/CBICA/PredCRD.git && cd PredCRD && pip install -e .
RUN git clone https://github.com/CBICA/DLWMLS.git && cd DLWMLS && pip install -e . && DLWMLS -i ~/dummyinput -o ~/dummyoutput
RUN pip uninstall -y torch && pip install --verbose torch==2.3.1 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION}
## Cache DLMUSE and DLICV models with an empty job so no download is needed later
RUN DLMUSE -i ~/dummyinput -o ~/dummyoutput && DLICV -i ~/dummyinput -o ~/dummyoutput
USER root
COPY . /app/
RUN useradd -s /bin/bash streamlit && mkdir /app/output_folder && \
chmod a+w /app/output_folder && chmod a-rw / && chmod a-w /app && touch /app/src/viewer/pipeline.log && \
RUN useradd -s /bin/bash streamlit && \
chmod -R a+rw /app/output_folder && chmod a-rw / && chmod a-w /app && touch /app/src/viewer/pipeline.log && \
chmod a+rw /app/src/viewer/pipeline.log
USER streamlit
WORKDIR /app/src/viewer/
Expand Down
5 changes: 5 additions & 0 deletions cloud-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lambda_urls": {
"update_stats": "https://gpzw2o0kxd.execute-api.us-east-1.amazonaws.com/default/cbica-nichart-updatestats"
}
}
22 changes: 22 additions & 0 deletions docs2/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Developers - API
===========================

Submodules
----------
df_muse = pd.DataFrame(
columns=['MRID', '702', '701', '600', '601', '...'],
data=[
['Subj1', '...', '...', '...', '...', '...'],
['Subj2', '...', '...', '...', '...', '...'],
['Subj3', '...', '...', '...', '...', '...'],
['...', '...', '...', '...', '...', '...']
]
)
st.markdown(
"""
### DLMUSE File:
The DLMUSE CSV file contains volumes of ROIs (Regions of Interest) segmented by the DLMUSE algorithm. This file is generated as output when DLMUSE is applied to a set of images.
"""
)
st.write('Example MUSE data file:')
st.dataframe(df_muse)
60 changes: 34 additions & 26 deletions src/viewer/pages/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import utils.utils_session as utilss
import utils.utils_st as utilst
from streamlit_extras.stylable_container import stylable_container
import webbrowser
from streamlitextras.webutils import stxs_javascript

# Page config should be called for each page
utilss.config_page()
Expand Down Expand Up @@ -94,14 +94,14 @@ def set_pipeline() -> None:
"""
)

#st.markdown("""
#<style>
#.st-bb {
#background-color: #4CAF50; /* Green */
#color: white;
#}
#</style>
#""", unsafe_allow_html=True)
# st.markdown("""
# <style>
# .st-bb {
# background-color: #4CAF50; /* Green */
# color: white;
# }
# </style>
# """, unsafe_allow_html=True)

with st.container(border=True):

Expand All @@ -111,35 +111,43 @@ def set_pipeline() -> None:
)

with stylable_container(
key="my_button_container",
key="my_button_container",
css_styles="""
button {
background-color: #FF7944;
color: white;
border-radius: 20px;
}
"""
""",
):
if st.button(
'📝 NiChart User Experience',
"📝 NiChart User Experience",
):
webbrowser.open_new_tab('https://forms.office.com/r/mM1kx1XsgS')
# This code only works locally, not on a container or server.
# webbrowser.open_new_tab('https://forms.office.com/r/mM1kx1XsgS')
stxs_javascript(
"""window.open('https://forms.office.com/r/mM1kx1XsgS', '_blank').focus()"""
)

if st.button(
'📝 Shaping the Future of NiChart',
"📝 Shaping the Future of NiChart",
):
webbrowser.open_new_tab('https://forms.office.com/r/acwgn2WCc4')

### Bg color on link_button was not supported in styllable container
#st.link_button(
#'📝 NiChart User Experience',
#'https://forms.office.com/r/mM1kx1XsgS',
#)

#st.link_button(
#'📝 Shaping the Future of NiChart',
#'https://forms.office.com/r/acwgn2WCc4',
#)
# This code only works locally, not on a container or server.
# webbrowser.open_new_tab('https://forms.office.com/r/acwgn2WCc4')
stxs_javascript(
"""window.open('https://forms.office.com/r/acwgn2WCc4', '_blank').focus()"""
)

# Bg color on link_button was not supported in styllable container
# st.link_button(
# '📝 NiChart User Experience',
# 'https://forms.office.com/r/mM1kx1XsgS',
# )

# st.link_button(
# '📝 Shaping the Future of NiChart',
# 'https://forms.office.com/r/acwgn2WCc4',
# )

# FIXME: For DEBUG
utilst.add_debug_panel()
3 changes: 2 additions & 1 deletion src/viewer/pages/pipeline_dlwmls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os

import streamlit as st
import utils.utils_menu as utilmenu
import utils.utils_session as utilss
import os

# Page config should be called for each page
utilss.config_page()
Expand Down
Loading
Loading