DumpDemographics - MRC CBU Imaging Wiki

Revision 2 as of 2009-12-11 12:48:47

Clear message
location: DumpDemographics

Dump demographics

Here's a matlab script that dumps the age & sex of a list of subjects.

subjs={'CBU090515','CBU090516','CBU090518','CBU090519','CBU090520','CBU090829','CBU090830','CBU090837','CBU090838','CBU090842'};
rawpath='/mridata/cbu';

for subjind=1:length(subjs)
    fn=dir(fullfile(rawpath,[subjs{subjind} '*']));
    try
        daydir=dir(fullfile(rawpath,fn(1).name,'2009*'));
        seriesdir=dir(fullfile(rawpath,fn(1).name,daydir(1).name,'Series*'));
        dicomfn=dir(fullfile(rawpath,fn(1).name,daydir(1).name,seriesdir(1).name,'*.dcm'));
        dicomfn=fullfile(rawpath,fn(1).name,daydir(1).name,seriesdir(1).name,dicomfn(1).name);
        fprintf('%s\t',subjs{subjind});
        H=spm_dicom_headers(dicomfn);
        fprintf('%s\t%s\n',H{1}.PatientsSex,H{1}.PatientsAge);
    catch
            fprintf('Cannot find %s\n',subjs{subjind});
    end;
end;