Skip to content

MatLab API

Ivan Sahumbaiev edited this page Aug 11, 2017 · 3 revisions

Matlab functions corresponding for folders rearranging:

  • rearrangeFolders(root_directory, output_directory);
    where root_directory(string) - is a path to the folder which contains PET, MRI images
    output_directory(string) - is a path where rearranged results have to be stored
    Workflow: the main purpose of this function is to move all patients data to a single folder, the output structure -> patient/MRI, PET

  • patiend_ids = csv_rearrange(home_path, xls_files, mat_files)
    where home_path(string) - is a path to root directory. Example: ../neuroimaging
    xls_files(cell array) - paths to original ADNI file which contains information about patients. Example: home/csv_dataset/ADNIMERGE.xls and DXSUM_PDXCONV_ADNIALL.xls
    mat_files(cell array) - path to .mat files which a result of .xls to .mat file conversion. Example: home/csv_dataset/data_ids.mat
    Workflow: the main purpose of this function is convert .xls to array of struct. The conversion contains from several steps: 1. Select patients rtid's who have dx_change from DXSUM_PDXCONV_ADNIALL.xls ; 2. Select all data from ADNIMERGE.xls based on rtid's. It is necessary in order to get right label.
    The conversion for dx_change is the following: 1,7,9 - Normal; 2,4,8 - MCI; 3,5,6 - AD. More

  • rearrangePreFolders(root_directory, csv_data)
    where root_directory(string) - is a path to the folder which contains PET, MRI images. Should be used after rearrangeFolders or with folder which has structure root/patients
    csv_data - is data from ADNI database converted in MatLab format. Example can be find in the csv_dataset origin -> ANDIMERGE.csv; converted -> data_ids.mat; Workflow: the main purpose of this function group patients data in groups based on csv_file. Currently: Normal, MCI, AD

Matlab functions corresponding for image processing:

  • scanAndLogMissing(root_directory, csv_data)
    where root_directory(string) - is a path to the folder which contains PET, MRI images. Should be used after rearrangeFolders or with folder which has structure root/patients
    csv_data(struct array) - is data from ADNI database converted in MatLab format
    Workflow: the main purpose of this function is loop through all folders in root_directory and run preprocessImages function and save to log.txt file missing info. The analysis can start if MRI and PET_AV45 data is available. After analysis unused MRI data will be removed, unless cleanData flag is not 1.

  • output_files = preprocessImages(root_directory, output_directory, dx_data)
    where root_directory(string) - is a path to a folder which contains PET and MRI data
    output_directory(string) - is a name of the root folder where the extracted features will be stored. Currently is the data from dx_change filed.
    dx_data(struct) - is a matlab struct with fields: id, age, gender, dx_change, mmse; which describes patient. Workflow: the main purpose of this function is pick valid images (the date of recording is less then 6 month) and set new origin, coregister, normalize and extract brain features. In order to adjust image spm toolbox functions have been used:

    • spmSetOringin(im_name(**cell**), template_path)
    • r_files = performCoregisterER(image, other)
    • wr_files = performNormalization(mri_image, r_files(**cell array**))
    • performSegmentation(mri_image) - in order to get white, gray matter
    • getRegionFromAtlas(brain_atlas_path, image)