diff --git a/src/viewer/pages/prep_sMRI_dicomtonifti.py b/src/viewer/pages/prep_sMRI_dicomtonifti.py index 7b7e2ae..b378465 100644 --- a/src/viewer/pages/prep_sMRI_dicomtonifti.py +++ b/src/viewer/pages/prep_sMRI_dicomtonifti.py @@ -61,9 +61,10 @@ def help_working_dir(): """ ) - if st.button('Get help 🤔', key='key_btn_working_dir'): - help_working_dir() - + col1, col2 = st.columns([0.5, 0.1]) + with col2: + if st.button('Get help 🤔', key='key_btn_working_dir', use_container_width=True): + help_working_dir() def panel_indicoms() -> None: """ @@ -128,8 +129,10 @@ def help_in_dicoms(): """ ) - if st.button('Get help 🤔', key='key_btn_help_in_dicoms'): - help_in_dicoms() + col1, col2 = st.columns([0.5, 0.1]) + with col2: + if st.button('Get help 🤔', key='key_btn_help_in_dicoms', use_container_width=True): + help_in_dicoms() def panel_detect() -> None: """ @@ -182,8 +185,10 @@ def help_detect_series(): """ ) - if st.button('Get help 🤔', key='key_btn_help_detect_series'): - help_detect_series() + col1, col2 = st.columns([0.5, 0.1]) + with col2: + if st.button('Get help 🤔', key='key_btn_help_detect_series', use_container_width=True): + help_detect_series() def panel_extract() -> None: @@ -266,8 +271,10 @@ def help_extract_nifti(): """ ) - if st.button('Get help 🤔', key='key_btn_help_extract_nifti'): - help_extract_nifti() + col1, col2 = st.columns([0.5, 0.1]) + with col2: + if st.button('Get help 🤔', key='key_btn_help_extract_nifti', use_container_width=True): + help_extract_nifti() def panel_view() -> None: @@ -353,8 +360,9 @@ def panel_view() -> None: ): with blocks[i]: ind_view = utilni.img_views.index(tmp_orient) + size_auto = True utilst.show_img3D( - img, ind_view, img_bounds[ind_view, :], tmp_orient + img, ind_view, img_bounds[ind_view, :], tmp_orient, size_auto ) diff --git a/src/viewer/utils/utils_st.py b/src/viewer/utils/utils_st.py index c76eee9..0122003 100644 --- a/src/viewer/utils/utils_st.py +++ b/src/viewer/utils/utils_st.py @@ -10,7 +10,7 @@ # from wfork_streamlit_profiler import Profiler # import pyinstrument -COL_LEFT = 3 +COL_LEFT = 5 COL_RIGHT_EMPTY = 0.01 COL_RIGHT_BUTTON = 1 @@ -88,7 +88,7 @@ def user_input_filename( path_dir = path_last tmpcol = st.columns((COL_LEFT, COL_RIGHT_BUTTON), vertical_alignment="bottom") with tmpcol[1]: - if st.button(label_btn, key=f"key_btn_{key_st}"): + if st.button(label_btn, key=f"key_btn_{key_st}", use_container_width=True): # path_curr, path_dir = utilio.browse_file(path_dir) out_file = utilio.browse_file(path_dir) if out_file is not None and os.path.exists(out_file): @@ -122,7 +122,7 @@ def user_input_foldername( # Button to select folder with tmpcol[1]: - if st.button(label_btn, key=f"btn_{key_st}"): + if st.button(label_btn, key=f"btn_{key_st}", use_container_width=True): out_str = utilio.browse_folder(path_last) if out_str is not None and os.path.exists(out_str): @@ -151,7 +151,11 @@ def user_input_foldername( def show_img3D( - img: np.ndarray, scroll_axis: Any, sel_axis_bounds: Any, img_name: str + img: np.ndarray, + scroll_axis: Any, + sel_axis_bounds: Any, + img_name: str, + size_auto: bool, ) -> None: """ Display a 3D img @@ -167,17 +171,25 @@ def show_img3D( ) # Extract the slice and display it - w_img = ( - st.session_state.mriview_const["w_init"] - * st.session_state.mriview_var["w_coeff"] - ) - if scroll_axis == 0: - # st.image(img[slice_index, :, :], use_column_width=True) - st.image(img[slice_index, :, :], width=w_img) - elif scroll_axis == 1: - st.image(img[:, slice_index, :], width=w_img) + if size_auto: + if scroll_axis == 0: + st.image(img[slice_index, :, :], use_column_width=True) + elif scroll_axis == 1: + st.image(img[:, slice_index, :], use_column_width=True) + else: + st.image(img[:, :, slice_index], use_column_width=True) else: - st.image(img[:, :, slice_index], width=w_img) + w_img = ( + st.session_state.mriview_const["w_init"] + * st.session_state.mriview_var["w_coeff"] + ) + if scroll_axis == 0: + # st.image(img[slice_index, :, :], use_column_width=True) + st.image(img[slice_index, :, :], width=w_img) + elif scroll_axis == 1: + st.image(img[:, slice_index, :], width=w_img) + else: + st.image(img[:, :, slice_index], width=w_img) def util_panel_workingdir(app_type: str) -> None: