def parse_coordinates(xmlfile, desc):
    """Read the 'Position' sheet from the Imaris XML file.

    Returns
    -------
    coordinates : [(x, y, z)]
        List of 3-tuples of floats, representing the coordinates.
    """
    log.warn('Reading %s file: %s' % (desc, xmlfile.name))
    imsxml = ImarisXML(xmlfile)
    coordinates = imsxml.coordinates('Position')
    log.warn("- %s objects: %s" % (desc, len(coordinates)))
    return coordinates
Пример #2
0
#!/usr/bin/python

from imaris_xml import ImarisXML
from log import log

log.setLevel(20)

basedir = 'TESTDATA/spots_distances/'
infile = basedir + 'spots_red_multi_ws-all.xml'
outfile = basedir + 'result_ImarisXML_sp_red_mult_all.txt'

# test with filehandle:
XML = ImarisXML(open(infile))
# test with string:
XML = ImarisXML(infile)
res = XML.celldata('Position')

output = open(outfile, 'w')
output.write(str(res))
print('Written results to "%s"' % outfile)