Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TemponeMH/e738f1429ee32041b0047f25e7bdf0c2 to your computer and use it in GitHub Desktop.
Save TemponeMH/e738f1429ee32041b0047f25e7bdf0c2 to your computer and use it in GitHub Desktop.
Open an XML file saved by Cell Counter as an ImageJ PointRoi (ignoring stack position)
/*
* Open an XML file saved by Cell Counter as an ImageJ PointRoi (ignoring stack position)
*
* (see https://forum.image.sc/t/convert-cell-counter-markers-to-multi-point/23844?u=imagejan)
*/
#@ ImagePlus imp
#@ File input
import groovy.util.XmlParser
import ij.gui.PointRoi
roi = new PointRoi()
parser = new XmlParser()
doc = parser.parse(input)
doc.Marker_Data.Marker_Type.each {
roi.setCounter( it.Type[0].text() as int )
it.Marker.each {
roi.addPoint( it.MarkerX[0].text() as int, it.MarkerY[0].text() as int )
}
}
roi.setShowLabels(true)
imp.setRoi(roi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment