code_path = os.path.join(base_path, "code") log_path = os.path.join(code_path, "log") preprocess_data_path = os.path.join(base_path, "preprocess_data") # path to the Makefile make_file_path = os.path.join(code_path, "Makefile") # path to where to save the post-flirt nii AD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "AD") Normal_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "Normal") PD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "PD") # get nii paths for subject unique AD_nii_files = process_nii.get_nii(AD_afterflirt_path) (unique_AD_subj, unique_AD_nii_files) = go_array.unique_sub_files(AD_nii_files) Normal_nii_files = process_nii.get_nii(Normal_afterflirt_path) (unique_Normal_subj, unique_Normal_nii_files) = go_array.unique_sub_files(Normal_nii_files) PD_nii_files = process_nii.get_nii(PD_afterflirt_path) (unique_PD_subj, unique_PD_nii_files) = go_array.unique_sub_files(PD_nii_files) unique_data_dict = { "AD": unique_AD_nii_files, "Normal": unique_Normal_nii_files, "PD": unique_PD_nii_files } ############ functions to get randomized train valid test
AD_skullstrip_path = os.path.join(preprocess_data_path, "skull_strip", "AD") Normal_skullstrip_path = os.path.join(preprocess_data_path, "skull_strip", "Normal") PD_skullstrip_path = os.path.join(preprocess_data_path, "skull_strip", "PD") # path to where to save the post-flirt nii AD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "AD") Normal_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "Normal") PD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "PD") AD_afterfnirt_path = os.path.join(preprocess_data_path, "after_fnirt", "AD") Normal_afterfnirt_path = os.path.join(preprocess_data_path, "after_fnirt", "Normal") PD_afterfnirt_path = os.path.join(preprocess_data_path, "after_fnirt", "PD") # visualize raw data AD1 = process_nii.get_nii(AD_raw_data_path) Normal1 = process_nii.get_nii(Normal_raw_data_path) PD1 = process_nii.get_nii(PD_raw_data_path) my_dict = {"AD":AD1, "PD":PD1, "Normal": Normal1} process_nii.random_visualization(5, my_dict, "raw_data") # visualize reoriented data AD1_reorient = process_nii.get_nii(AD_fixorient_path) Normal1_reorient = process_nii.get_nii(Normal_fixorient_path) PD1_reorient = process_nii.get_nii(PD_fixorient_path) my_dict_reorient = {"AD":AD1_reorient, "PD": PD1_reorient, "Normal": Normal1_reorient} process_nii.random_visualization(5, my_dict_reorient, "test_reorient") # visualize skull stripped data
base_path = os.path.join(base_path, "..") raw_data_path = os.path.join(base_path, "raw_data") code_path = os.path.join(base_path, "code") log_path = os.path.join(code_path, "log") preprocess_data_path = os.path.join(base_path, "preprocess_data") # path to the Makefile make_file_path = os.path.join(code_path, "Makefile") # path to where to save the post-flirt nii AD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "AD") Normal_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "Normal") PD_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "PD") # Bad files Bad_afterflirt_path = os.path.join(preprocess_data_path, "after_flirt", "Bad") Bad_to_h5 = os.path.join(preprocess_data_path, "Real_bad_matrix.h5") # get nii paths for bad data # convert to subjects x 1d array Bad_nii_files = process_nii.get_nii(Bad_afterflirt_path) bad_matrix = go_array.nii_to_1d_simple(Bad_nii_files, Bad_to_h5, normalization=True, smooth=1, tf=False) print(bad_matrix.shape) print(bad_matrix.dtype)