# Get all dois from collections using the NeuroVault API from pyneurovault.api import get_collections, export_collections_tsv # This will return a pandas data frame collections = get_collections() # Take a look at the fields collections.columns # Export collections tsv export_collections_tsv("/home/vanessa/Desktop/dois.tsv",collections) # Retrieve the "DOI" column, remove null values dois = collections["DOI"][collections["DOI"].isnull()==False] # Export them to a tab separated file dois.to_csv("/home/vanessa/Desktop/dois.tsv",sep="\t",index=None) # Or turn into a list for something else dois.tolist()
# Get a collection collection = api.get_collections(pks=457) # collection.collection_id is 457 # Get all images images = api.get_images() # Get all images meta data for a collection images = api.get_images(collection_pks=457) # Remove images that are thresholded images = api.filter(df=images,column_name="is_thresholded",field_value=False) # Not in MNI images = api.filter(df=images,column_name="not_mni",field_value=False) # Just fMRI bold images = api.filter(df=images,column_name="modality",field_value="fMRI-BOLD") # Download images, collections, or both api.export_images_tsv("/home/vanessa/Desktop/images.tsv",images) api.export_collections_tsv("/home/vanessa/Desktop/collections.tsv",collection) # Download all images to file, resample to target outfolder = "/home/vanessa/Desktop" standard = "/usr/share/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz" api.download_images(dest_dir = outfolder,images_df=images,target=standard) # If you don't want to resample api.download_images(dest_dir = outfolder,images_df=images,resample=False)