0
votes

I have the outline of a macro that I created, however would like it to do a few more simple functions that I cannot figure out how to program. I have a series of images that I will import in as a stack. For each image I will use the multipoint tool to make a series of clicks on different objects manually within each image. The macro prints the coordinates of the points in the results table. However each "group/series" of points in each image (there will be 4-5 clusters of 10+ points) will need to be labeled differently in the results table (possibly through the slice??). For example, for each image I would like to label the first cluster of points "1" the second cluster of points "2" etc. Is there a way to manually label this in the results window? In the label column I would like to keep or add to the image name, not replace, but adding this label in the slice column would be ideal.

This is the macro I have created so far...

macro "Macro 2" { 
getSelectionCoordinates(xCoordinates, yCoordinates); 
for(i=0; i<lengthOf(xCoordinates); i++) { 
setResult("X", i, xCoordinates[i]); 
setResult("Y", i, yCoordinates[i]); 
} 
updateResults(); 

It works, except I cannot figure out how to label the different "groups/clusters" of points differently for each image and between images.

1

1 Answers

1
votes

Try this:

var label = 1;

macro "Save to Results" { 
  row = nResults;
  getSelectionCoordinates(xCoordinates, yCoordinates); 
  for(i=0; i<lengthOf(xCoordinates); i++) { 
    setResult("X", i+row, xCoordinates[i]); 
    setResult("Y", i+row, yCoordinates[i]); 
    setResult("Label", i+row, label);
    setResult("Slice", i+row, getSliceNumber());
  } 
  updateResults();
}

macro "Increment label" {
  label++;
  showStatus("label = "+label);
}

macro "Reset Label" {
  label = 1;
  showStatus("label = "+label);
}

It uses a global variable for the label and additional macros to manipulate with it.