<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Mark, <br>
    <br>
    I've tried the code below but it doesn't work.<br>
    <br>
        conn = BlitzGateway(host=HOST, username=USER, passwd=PASSWORD,
    port=PORT)<br>
        conn.connect()<br>
        updateService = conn.getUpdateService()<br>
    <br>
        # get the image by Id<br>
        imageId = 2<br>
        image = conn.getObject("Image", imageId)<br>
    <br>
        roiService = conn.getRoiService()<br>
        result = roiService.findByImage(imageId, None)<br>
    <br>
        obj_ids = list()<br>
        for roi in result.rois:<br>
             obj_ids.append(roi.getId().getValue())<br>
    <br>
        print obj_ids<br>
        print len(obj_ids)<br>
        print<br>
        handle = conn.deleteObjects(<br>
            "Roi", <br>
            obj_ids, <br>
            deleteAnns=True, <br>
            deleteChildren=True<br>
            )<br>
    <br>
      <br>
        conn._closeSession()<br>
    <br>
    What could I be doing wrong?<br>
    <br>
    P<br>
    <br>
    <div class="moz-cite-prefix">On 21/01/2016 11:25, Mark Carroll
      wrote:<br>
    </div>
    <blockquote cite="mid:56A0C027.9030905@dundee.ac.uk" type="cite">On
      01/21/2016 11:10 AM, Paul Kibet Korir wrote:
      <br>
      <br>
      <blockquote type="cite">Could someone please outline the correct
        way of deleting an ROI
        <br>
        programmatically?
        <br>
      </blockquote>
      <br>
      Does
      <br>
<a class="moz-txt-link-freetext" href="https://www.openmicroscopy.org/site/support/omero5.2/developers/Python.html#delete-data">https://www.openmicroscopy.org/site/support/omero5.2/developers/Python.html#delete-data</a>
      <br>
      help? For the conn.deleteObjects arguments one ought to be able to
      write
      <br>
      "Roi" instead of "Project" and supply the IDs of the ROIs. The
      default
      <br>
      behavior is, if a Roi is deleted, its Shape objects are
      automatically
      <br>
      deleted along with it.
      <br>
      <br>
      -- Mark
      <br>
      <br>
      The University of Dundee is a registered Scottish Charity, No:
      SC015096
      <br>
      _______________________________________________
      <br>
      ome-users mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:ome-users@lists.openmicroscopy.org.uk">ome-users@lists.openmicroscopy.org.uk</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users</a>
      <br>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      With kind regards,<br>
      <br>
      <strong>Paul K Korir, PhD</strong><br>
      <i>Scientific Programmer</i><br>
      EMBL-EBI<br>
      Main Building, A2-35,<br>
      WTGC, Hinxton, Cambridge CB10 1SD<br>
      P: +44 1223 49 44 22<br>
      F: +44 1223 49 44 68</div>
  </body>
</html>