does anyone know if it’s possible to reorder columns in an ImageJ ResultsTable? (I don’t mean sorting).
I use the particle analyzer for region analysis and want to prepend two descriptive columns (image name and region label). But
rt.setLabel only allows me to preprend one label column. And I can only fill in the region label column after I ran the particle analyzer.
This is a minimal example of how it currently looks: Area is the result of Particle Analyzer, and RegionLabel is what I add later but would want to appear it in this order: Label, RegionLabel, Area.
Jython code to reproduce this:
from ij.plugin.filter import ParticleAnalyzer as PA from ij import IJ from ij.measure import ResultsTable # create a binary image IJ.run("Blobs (25K)"); mask=IJ.getImage(); IJ.setAutoThreshold(mask, "Default"); IJ.run(mask, "Convert to Mask", ""); rt=ResultsTable() last_used_row=rt.getCounter() # PA settings IJ.run(None, "Set Measurements...", "mean redirect=None decimal=3") options = PA.CLEAR_WORKSHEET measurements=PA.AREA # particle analyzer p = PA(options, measurements, rt, 0, 100000000000) p.analyze(mask) # now add 2 descriptive the labels # add column with image file name for rtidx in range (last_used_row,rt.getCounter()): # zero based rt.setLabel(mask.getTitle(),rtidx) # add label ids of rois for counter,rtidx in enumerate(range(last_used_row,rt.getCounter())): # zero based rt.setValue("RegionLabel",rtidx,counter+1) rt.show("Results")
PS: I know that one can display the row numbers but that is not what I’m looking for since I merge results of many images into one table.