Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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. 

Code Block
>>> import pyxnat
>>> cdb = pyxnat.Interface('https://db.humanconnectome.org','username','password')
>>> subjects = cdb.select('//subjects').where([('xnat:subjectData/GENDER','=','female'),('xnat:subjectData/PROJECTS','LIKE','%Q2'),'AND'])
>>> cdb.packages.download(subjects[: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.