The following code fragment finds female subjects in the Q2 data release and downloads the preprocessed structural data for ten of them. This code shows a different interface to the XNAT search engine than the one described in the ConnectomeDB-Python tutorial; see the pyxnat search documentation for details. 

>>> import pyxnat
>>> cdb = pyxnat.Interface('','username','password')
>>> subjects ='//subjects').where([('xnat:subjectData/GENDER','=','female'),('xnat:subjectData/PROJECTS','LIKE','%Q2'),'AND'])
>>>[:10], '3T_Structural_unproc')

Note: the slice notation [:10] applied to subjects in the last line depends on a feature added to the HCP-customized pyxnat in July 2013; if you have an older version, you'll need to update.

  • No labels