Login  Register

Modify (or create) results table

Posted by Mark Matsche on Feb 06, 2015; 2:29pm
URL: http://imagej.273.s1.nabble.com/Modify-or-create-results-table-tp5011481.html

Hello,

I'm a new ImageJ user and complete newb when it comes macros etc.  I use ImageJ to determine density, size of cell clusters in tissue sections.  The macro I'm using (provided to me) is:

macro "mac agg" {dir = getDirectory("Choose Source Directory");
  list = getFileList(dir);
  for (i=0; i<list.length; i++) {
     open(dir+list[i]);
run("8-bit");
  setAutoThreshold("Default");
run("Threshold...");
     waitForUser("Adjust threshold, then click 'OK' ");
  run("Analyze Particles...", "size=50-Infinity display exclude include summarize");close ();}
  saveAs("Measurements", "C:\\Documents and Settings\\mmatsche\\Desktop\\test.xls");
close();close();close();
};

This lets me pick a folder of images and do analyze particles in each image contained within.  Results are added to the results table and a summary table is built as well.

What I would like is to modify the results table (or create a new one if that is easier) but after looking through several examples online I couldn't figure it out.  The first image posted here is an example of the results that I currently get (default results table).  Unfortunately I no longer have a colleague with the skills to write macros.

<nabble_img src="results.png" border="0"/> 

The "Label" is the image filename that the area of cell cluster is measured from.  I can get anywhere from 20-200 cell clusters per image.  I would like to change the "Label" column name to "Fish" and modify how ImageJ records the file name.  Essentially, I would like to truncate the file name from (example) 14ST238-1.tif to 14ST238 (remove the dash and everything after).  I don't need the file extension and the "-1"  just before the .tif in the file name indicates the section number (I use 3 different images, or sections, per fish).  

Second, I would like to create a new column after the "Label" named "section".  The "-1" just before the .tif extension is the section number.  Can that number be identified and moved to the new column called "section"?  Example.  If I have 20 cell clusters in image 14ST150-2.tif, I would like all 20 measures of area and perim to be labeled as 14ST150 in the "Fish" column and "2" in the section column.

These modifications would greatly simplify handling the output.  

Thanks!
Mark M