GithubHelp home page GithubHelp logo

kgicmd / imagescope_xml_utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from one-sixth/imagescope_xml_utils

0.0 1.0 0.0 7 KB

A tool for read and write aperio imagescope xml file.

License: MIT License

Python 100.00%

imagescope_xml_utils's Introduction

imagescope_xml_utils

A tool for read and write aperio imagescope xml file.

Types of tags currently supported for reading and writing: boxes, contours, arrows, ellpises.
Metadata reads and writes are currently not supported.

Attention

Please note that the coordinate format I use is yx, not xy.

Color is a int tuple (R, G, B)

Dependent

lxml
numpy

How to use

This is a simple example.
Only read a xml file and write it with not modified.
Your can find the test data in this repo.

reader = ImageScopeXmlReader("test.xml", keep_arrow_tail=False, use_box_y1x1y2x2=True)
arrows, arrow_colors = reader.get_arrows()
boxes, box_colors = reader.get_boxes()
contours, contour_colors = reader.get_contours()
ellipses, ellipse_colors = reader.get_ellipses()

writer = ImageScopeXmlWriter()
writer.add_arrows(arrows, arrow_colors)
writer.add_boxes(boxes, box_colors)
writer.add_contours(contours, contour_colors)
writer.add_ellipses(ellipses, ellipse_colors)
writer.write('test2.xml')

Format

boxes (use_box_y1x1y2x2=True): [y1x1y2x2, y1x1y2x2, ...]
boxes (use_box_y1x1y2x2=False): [[top_left_yx, top_right_yx, bottom_right_yx, bottom_left_yx], [top_left_yx, top_right_yx, bottom_right_yx, bottom_left_yx], ...]

arrows (keep_arrow_tail=True): [[head_yx, tail_yx], [head_yx, tail_yx], ...]
arrows (keep_arrow_tail=False): [head_yx, head_yx, ...]

contours : [[con_yx, con_yx, ...], [con_yx, con_yx, ...], ...]

ellipses : [[top_left_yx, bottom_right_yx], [top_left_yx, bottom_right_yx], ...]

imagescope_xml_utils's People

Contributors

one-sixth avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.