Last active
April 24, 2024 08:06
-
-
Save imagejan/b251d1ccea52912cc54cf09ef7a9b22f to your computer and use it in GitHub Desktop.
Open an XML file saved by Cell Counter as an ImageJ PointRoi (ignoring stack position)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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.xml.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
Thanks for the info, @TemponeMH !