I’m somewhat new to imagej scripting so please pardon if this is well known…I did spend time looking at examples of weka trainable segmentation scripting but could not find what I need.
We have manual annotations for images that were created in a different tool, and saved as xml for each image. The xml defines polygon coordinates and the type of segment. I want to load these annotation via script as class labels for weka trainable segmentation. I figured a script like:
import ij.IJ; import trainableSegmentation.*; import ij.gui.Roi; import ij.gui.PolygonRoi; imp = IJ.openImage("C:\\Users\\darshat\\Desktop\\Medico\\DAB-Separation\\14_298_1.tif" ); // create Weka Segmentation object segmentator = new WekaSegmentation(imp); segmentator.addExample( 0, new Roi( 10, 10, 50, 50 ), 1 ); segmentator.addExample( 0, new Roi( 100, 100, 500, 500 ), 1 ); imp.show()
should work. I would like to visually cross check the annotations are applied correctly. In the UI window, I dont see these annotations after the ‘addExample’ calls are made. Is a refresh method needed to show annotations in the UI window?