.mode csv
.output segmentation.csv
select pt.PatientID, sd.OID, sd.StudyDate,
t1.SeriesDescription , --t1.SeriesInstanceUID ,
t2.SeriesDescription , --t2.SeriesInstanceUID ,
fl.SeriesDescription , --fl.SeriesInstanceUID ,
tc.SeriesDescription , --tc.SeriesInstanceUID ,
sd.StudyDescription
from Studies sd
join Patients pt on sd.PatientsUID=pt.UID
join Series t1 on sd.StudyInstanceUID=t1.StudyInstanceUID
join Series t2 on sd.StudyInstanceUID=t2.StudyInstanceUID
join Series fl on sd.StudyInstanceUID=fl.StudyInstanceUID
join Series tc on sd.StudyInstanceUID=tc.StudyInstanceUID
where t1.SeriesDescription like '%T1%' and t1.SeriesDescription not like
'%+C%' and t1.SeriesDescription not like '%ther%' and t1.SeriesDescription
not like '%t-map%'
and t1.SeriesDescription not like '%post%' and t1.SeriesDescription not
like '%fiber%' and t1.SeriesDescription not like '%CRANIOTOMY%'
and t1.SeriesDescription not like '%dt1%'
and t2.SeriesDescription like '%T2%' and t2.SeriesDescription not like
'%cor%' and t2.SeriesDescription not like '%T2*%' and t2.SeriesDescription
not like '%t-map%'
and t2.SeriesDescription not like '%+c%' and t2.SeriesDescription not
like '%flair%' and t2.SeriesDescription not like '%weighted%'
and t2.SeriesDescription not like '%2%*%' and t2.SeriesDescription not
like '%star%'
and fl.SeriesDescription like '%flair%' and fl.SeriesDescription not like
'%cor%'
and sd.StudyDescription like 'MRI%BRAIN%CONTRAST'
and tc.SeriesDescription like '%T1%' and tc.SeriesDescription like
'%+C%'
and tc.SeriesDescription like '%sag%';
.output stdout

Access the database from MATLAB: http://sourceforge.net/projects/mksqlite/