Hello out there,
I am trying to polish a macro in which I want to embed the MorpholibJ function “Intensity Measurements 2D/3D” into a function in order to call it with different inputs and labels.
//measure in MorpholibJ and save Results
outputDirectory = "/Users/imle/Desktop/Microscopy/Airy Scan/200303 PBMC Coll647/Day4/Processed/"
name = getTitle();
MeasureMorphoLib("Collagen", "Phalloidin-thresholded-fillHoles_dilated_ref-lbl");
function MeasureMorphoLib (inputImage, labelsImage) {
selectWindow(inputImage);
run("Intensity Measurements 2D/3D", "input='inputImage' labels='labelsImage' mean stddev max min median numberofvoxels volume");
saveAs("Results", outputDirectory + name + labelsImage + ".csv");
}
The macro runs and does not give an error. But…
The Result is not the same as when I call the plugin from the GUI, but it always gives the result of the last plugin run.
For example:
I have 2 LabelImages (they were done with Ext.CLIJ2_connectedComponentsLabeling)
labelsImage 1 contains only 1 label
labelsImage 2 contains 2 labels
Manually I call the “Intensity Measurements 2D/3D” plugin using labelsimage1. The result is correct with only 1 line in the Results window.
Afterwards I call the macro with labelsImage2. The result window which is newly computed only has the 1 line from the previous computing.
I am quite new to the Function business. Does anyone have an idea for me?
I am puzzled.
So long, and thanks already now for any brain power that you put into this.
All the best,
Andrea