def getLookUpTable(): token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id #object_ids = [134] #created_by = [134] #annotated_with = [863792] headers = config.CatmaidApiTokenAuth(token) allAnnotations = requests.get( 'https://neuropil.janelia.org/tracing/fafb/v14-seg-li-190805.0/{}/annotations/' .format(project_id), auth=auth) someData = json.loads(allAnnotations.content.decode('utf-8')) #print(someData) AnnotationLookUpTable = {} AnnotationLookUpTable = someData["annotations"] myLookUpTable = {} for d in AnnotationLookUpTable: myLookUpTable[d['id']] = d['name'] return myLookUpTable
def correctAnnotations(self): mySet = NeuronObjectData.removeSomaless(self) rightHem = [] leftHem = [] for item in mySet: if item.soma[0] < 500000: rightHem.append(item.skeletonID + 1) elif item.soma[0] > 550000: leftHem.append(item.skeletonID + 1) responseOne = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/remove' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={ 'entity_ids': rightHem, 'annotation_ids': [1223085] }) responseOne = json.loads(responseOne.content) print(responseOne) responseTwo = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14-seg-li-190805.0/{}/annotations/remove' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={ 'entity_ids': leftHem, 'annotation_ids': [1167304] }) responseTwo = json.loads(responseTwo.content) print(responseTwo) return
def GetAnnotations(): token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id object_ids = [134] created_by = [134] annotated_with = [863792] headers = config.CatmaidApiTokenAuth(token) #print(str(headers)) payload = { #'skeleton_ids': [ 0 #], #'type': "", #'name': "", #"id": 0 #'annotated_with': '8863792' } response = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/query-targets' .format(project_id), auth=auth, data={'annotated_with': 863792}) return response
def getLookUpTable(): import requests import json import itertools token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id object_ids = [134] created_by = [134] annotated_with = [863792] headers = config.CatmaidApiTokenAuth(token) allAnnotations = requests.get( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/'.format( project_id), auth=auth) someData = json.loads(allAnnotations.content) #print(someData) AnnotationLookUpTable = {} AnnotationLookUpTable = someData["annotations"] myLookUpTable = {} for d in AnnotationLookUpTable: myLookUpTable[d['id']] = d['name'] return myLookUpTable
def addAnnotation(self, newAnnotation, addToSkeletons=True, metaAnnotations=None): """ :param newAnnotation: array of string - to be added to catmaid annotation of neurons (if looking for bulk annotations: set from GFIN objects :param addToSkeletons: default is true - if false, will create annotation and annotate it with a meta_annotation :param metaAnnotations: default is none - should be array[string] if desired :return: print out: success or error (with error message), annotations added (name and id), neuron ids, and list of any new annotations """ if addToSkeletons is True: mySkids = [] for item in self: mySkids.append(item.skeletonID) response = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/add'.format(project_id), auth=config.CatmaidApiTokenAuth(token), data={'skeleton_ids': mySkids, 'annotations': newAnnotation} ) else: response = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/add'.format(project_id), auth=config.CatmaidApiTokenAuth(token), data={'annotations': newAnnotation, 'meta_annotations': metaAnnotations} ) myResults = json.loads(response.content) print(myResults) return
def setAnnotationLookUpTable(SKIDS): response = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/forskeletons' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={'skeleton_ids[0]': SKIDS}) myData = json.loads(response.content) myAnnotations = myData['annotations'] a = [] for i in myAnnotations: a.append(myAnnotations[i]) return a
def addAnnotation(neuron, newAnnotation, addToSkeletons=True): if addToSkeletons is True: mySkids = [neuron] response = requests.post( 'https://neuropil.janelia.org/tracing/fafb/v14-seg-li-190805.0/{}/annotations/add' .format(project_id), auth=config.CatmaidApiTokenAuth(token), data={ 'skeleton_ids': mySkids, 'annotations': newAnnotation }) myResults = json.loads(response.content) print(myResults) return
import config import json import requests import itertools token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id #dn_autoseg_exploration #annotation = 217283624 #descending neuron #annotation = 2998068 #Putative_Ascending #annotation = 217284386 #Ascending Neuron #annotation = 3552044 #Old GetLookUpTable # coding: utf-8 # returns dictionary containing a lookup table with int(annotation id) as key and annotation string/name as value def getLookUpTable(): token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id #object_ids = [134]
''' Emily Tenshaw & Jason Polsky CAT-Card Updated 12/1/2020 Pulls annotation data for GF Input neurons Unsure why needed - mostly written by Jason ''' import config import requests import json import GetAnnotationsRemoveExtraneousInfo as GARI token = config.token auth = config.CatmaidApiTokenAuth(token) project_id = config.project_id object_ids = [134] created_by = [134] annotated_with = [863792] headers = config.CatmaidApiTokenAuth(token) # returns dictionary containing a lookup table with int(annotation id) as key and annotation string/name as value def getLookUpTable(): allAnnotations = requests.get( 'https://neuropil.janelia.org/tracing/fafb/v14/{}/annotations/'.format( project_id), auth=auth)