diff --git a/src/NiChart_Viewer/src/pages/home.py b/src/NiChart_Viewer/src/pages/home.py index 5b0a6c28..b04b3750 100644 --- a/src/NiChart_Viewer/src/pages/home.py +++ b/src/NiChart_Viewer/src/pages/home.py @@ -7,11 +7,12 @@ if 'instantiated' not in st.session_state: # Dataframe to keep plot ids - st.session_state.plots = pd.DataFrame({'PID':[]}) - st.session_state.pid = 1 + st.session_state.plots = pd.DataFrame(columns = ['pid', 'xvar', 'yvar', 'hvar', 'trend']) + st.session_state.plot_index = 1 # Path to root folder st.session_state.path_root = os.path.dirname(os.path.dirname(os.path.dirname(os.getcwd()))) + st.session_state.path_root = os.path.join(st.session_state.path_root, 'test') # Path to input folder (used as the init path in file selection) st.session_state.path_input = st.session_state.path_root @@ -20,11 +21,11 @@ st.session_state.path_output = '' # Default values for plotting parameters - st.session_state.default_x_var = 'Age' - st.session_state.default_y_var = 'GM' - st.session_state.default_hue_var = 'Sex' + st.session_state.plot_xvar = 'Age' + st.session_state.plot_yvar = 'GM' + st.session_state.plot_hvar = 'Sex' st.session_state.trend_types = ['none', 'ols', 'lowess'] - st.session_state.default_trend_type = 'none' + st.session_state.plot_trend = 'none' # ID selected by user st.session_state.sel_mrid = '' diff --git a/src/NiChart_Viewer/src/pages/view_img.py b/src/NiChart_Viewer/src/pages/view_img.py index c0b8be6e..28bcb02c 100644 --- a/src/NiChart_Viewer/src/pages/view_img.py +++ b/src/NiChart_Viewer/src/pages/view_img.py @@ -13,12 +13,6 @@ import numpy as np from nibabel.orientations import axcodes2ornt, ornt_transform -# # Initiate Session State Values -# if 'instantiated' not in st.session_state: -# st.session_state.plots = pd.DataFrame({'PID':[]}) -# st.session_state.pid = 1 -# st.session_state.instantiated = True - # Parameters for viewer VIEWS = ["axial", "sagittal", "coronal"] VIEW_AXES = [0, 2, 1] @@ -27,7 +21,6 @@ MASK_COLOR = np.array([0.0, 1.0, 0.0]) # RGB format OLAY_ALPHA = 0.2 - def reorient_nifti(nii_in, ref_orient = 'LPS'): ''' Initial img is reoriented to a standard orientation @@ -192,7 +185,6 @@ def prep_images(f_img, f_mask, sel_var_ind, dict_derived): # Read derived roi list and convert to a dict dict_derived = read_derived_roi_list(st.session_state.list_MUSE_derived) - # Page controls in side bar with st.sidebar: @@ -234,10 +226,14 @@ def prep_images(f_img, f_mask, sel_var_ind, dict_derived): # Select roi index sel_var_ind = dict_roi[sel_var] - # File names for img and mask -f_img = os.path.join(st.session_state.path_output, st.session_state.folder_img_t1, sel_mrid + st.session_state.suffix_t1img) -f_mask = os.path.join(st.session_state.path_output, st.session_state.folder_img_dlmuse, sel_mrid + st.session_state.suffix_dlmuse) +f_img = os.path.join(st.session_state.path_output, + st.session_state.folder_img_t1, + sel_mrid + st.session_state.suffix_t1img) + +f_mask = os.path.join(st.session_state.path_output, + st.session_state.folder_img_dlmuse, + sel_mrid + st.session_state.suffix_dlmuse) if os.path.exists(f_img) & os.path.exists(f_mask): diff --git a/test/test4_adni3 b/test/test4_adni3 index 60833760..0ca7a2b5 120000 --- a/test/test4_adni3 +++ b/test/test4_adni3 @@ -1 +1 @@ -/home/gurayerus/GitHub/CBICA/TestData/ADNI3_Test \ No newline at end of file +../../TestData/Test_NiChart_ADNI3 \ No newline at end of file