Exemplo n.º 1
0
def extract_terms(output_dir):

    if has_internet_connectivity():    
       terms = dict()
       atlases = get_json("http://neurovault.org/api/atlases/?format=json")
       for atlas in atlases:
           label_description_file = "http://neurovault.org/media/images/291/Talairach-labels-2mm.xml"
           print "Parsing %s" %(label_description_file)
           xml_dict = read_xml_url(label_description_file)
           atlas_name = xml_dict["atlas"]["header"]["name"]
           atlas_name_label = atlas_name.replace(" ","_").lower()
           atlas_labels = xml_dict["atlas"]["data"]["label"]
           for l in range(len(atlas_labels)):
               label = atlas_labels[l]
               # We will use coordinate for unique ID
               unique_id = "%s_%s" %(atlas_name_label,l)
               terms[unique_id] = {"name":label["#text"],
                                   "x":label["@x"],
                                   "y":label["@y"],
                                   "z":label["@z"]}

       save_terms(terms,output_dir=output_dir)

    else:
       print "Cannot define fsl atlas terms, no internet connectivity."
Exemplo n.º 2
0
def extract_terms(output_dir):

    if has_internet_connectivity():    
       terms = get_terms()
       save_terms(terms,output_dir=output_dir)

    else:
       print "Cannot define fma-nif region terms, no internet connectivity."
Exemplo n.º 3
0
def extract_terms(output_dir):

    # You can provide a dictionary if your terms have meta data
    # the key should be some unique ID for your term, and use numbers
    # if you do not have any. The "name" variable in the meta data should
    # correspoind to the term name
    terms = {"term_unique_id1":{"meta1":"meta_value1",
                                "meta2":"meta_value2",
                                "name":"term1"}}
    # Or a list if not
    terms = ["term1"]

    save_terms(terms,output_dir=home)
Exemplo n.º 4
0
def extract_terms(output_dir):
    f,d = download_data()
    features = pandas.read_csv(f,sep="\t")  
    terms = features.columns.tolist()
    terms.pop(0)  #pmid
    save_terms(terms,output_dir)
Exemplo n.º 5
0
def extract_terms(output_dir):

    terms = get_terms()
    save_terms(terms,output_dir=output_dir)
Exemplo n.º 6
0
def extract_terms(output_dir):

    cattell = get_cattell()
    terms = get_terms(cattell)
    save_terms(terms,output_dir=output_dir)