Creating and saving a custom table from 'Results'


Just another results table issue. Although there are examples, they are too complex for my understanding, so I couldnt make it.

Particle analysis tool creates a Results table and I need only four of provided columns.
Bx, By, Width, Height.
Lets say these are 25, 40, 10, 7 respectively.

Since results table is not directly (too bad) providing full bounding box coordinates (x1 y1 x2 y2), I need to create a new table with line(s) containing calculated x2 and y2 values, as following;

sometext 25 40 35 47 someothertext
sometext …
sometext …

and save it as results.txt

Looking for your help, once again.

The plugin Particles8 in my Morphology collection computes the bounding box coordinates (ROIX1, ROIY1, ROIX2 and ROIY2). You need an image already binarised and to check the “morphology” option in the dialog.
You can get it also via the Morphology update site in Fiji.

1 Like

Hello thank you for the clue, your plugin is working well. But I am afraid next part of my problem is still there. Since I am not into programming, I do not understand how to format the output and save it as results.txt file.

As a secondary solution, I can try to reformat it in excel via macro language, but is best to finalize it in the source since there will be thousands of results.csv files within complicated subdirectories. But I dont understand how to deal with table structure in results.csv produced by particle analysis.

Hi @OntheWay,

Seeing as your request is a bit vague for now, I would ask what language you are using to save the new results table.

The simplest thing you can do is make two new columns with the information you need on the same table using setResult()

Otherwise you can

  1. Grab the results from the raw table
  2. Make a new table with the modified columns

I’ve made an example code that does just that in ImageJ macro language.

You can get it on GIST

Considering what you need to do, I would recommend that you read up on the great ressources on the website to gain an understanding of basic macro language programming, as your current question seems to imply that you will have to code some more. If you are familiar with the Excel Macro Language (shudders at the memories), then ImageJ should be a breeze :smile:

All the best

1 Like