@@ -0,0 +1,1771 @@
+# -*- coding: utf-8 -*-%0A%0A#%0A# * Copyright (c) 2009-2015. Authors: see NOTICE file.%0A# *%0A# * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# * you may not use this file except in compliance with the License.%0A# * You may obtain a copy of the License at%0A# *%0A# *      http://www.apache.org/licenses/LICENSE-2.0%0A# *%0A# * Unless required by applicable law or agreed to in writing, software%0A# * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# * See the License for the specific language governing permissions and%0A# * limitations under the License.%0A# */%0A%0A%0A__author__          = %22Mar%C3%A9e Rapha%C3%ABl %3Craphael.maree@ulg.ac.be%3E%22%0A__copyright__       = %22Copyright 2010-2015 University of Li%C3%A8ge, Belgium, http://www.cytomine.be/%22%0A%0A%0Afrom cytomine import Cytomine%0Afrom cytomine.models import *%0A%0A%0A#Cytomine connection parameters%0Acytomine_host=%22XXX%22%0Acytomine_public_key=%22XXX%22%0Acytomine_private_key=%22XXX%22%0A%0A#Connection to Cytomine Core%0Aconn = Cytomine(cytomine_host, cytomine_public_key, cytomine_private_key, base_path = '/api/', working_path = '/tmp/', verbose= True)%0A%0A%0A#Replace XXX by your values%0Aid_image=XXX%0Aid_user=XXX%0Aid_project=XXX%0A%0Aprevious_annotations = conn.get_annotations(id_image = id_image,%0A                                            id_user = id_user,%0A                                            id_project= id_project)%0A%0Aprint %22%25d annotations to delete%22 %25len(previous_annotations.data())%0A%0A#Warning: this will delete all annotations of user id_user in image id_image from project id_project%0Afor annotation in previous_annotations.data():                                                                                  %0A    conn.delete_annotation(annotation.id)        %0A

delete annotations example