Hi all :)
I'm optimizing a (much larger) macro for automated cell nuclei analysis. I've been using the very helpful 3D Simple Segmentation with the 3D ROI Manager for this. Mixed in with the appropriately-sized ROIs, I tend to get several large 3D ROIs that actually consist of multiple cell nuclei. I'd like to have a macro to automatically split the large ROIs and then delete them if it's unable to split them. However, I'm running in to a looping issue: the macro gets stuck as soon as it reaches an ROI that can't be split and just repetitively attempts to split that one ROI. Here's the text of the splitting portion of the macro (it assumes you already have a 3D segmented image open - I've linked an example image, which gets stuck on the 12th ROI):
Image link:
https://drive.google.com/file/d/0Bw4MsPRmUoyIbGxCbWxwQUNfdHc/edit?usp=sharingMacro:
run("3D Manager");
Ext.Manager3D_AddImage();
Ext.Manager3D_Count(nb_obj);
for (i=0 ; i<nb_obj; i++) {
Ext.Manager3D_Select(i);
Ext.Manager3D_Measure3D(i,"Vol",measure);
if (measure>30000)
Ext.Manager3D_Split(i);
}
There are two options I've considered to fix this, and I haven't yet been successful with either. One is that I could find a way to tell the macro to only attempt to split the ROI once, and to move on to the next ROI after making that one attempt. (I'd have the unsplit, still large ROIs deleted by another macro section after this one.) I tried adding the line "i=i+1;" after "Ext.Manager3D_Split(i);" and this had no effect. I'm not sure if there are any other ways to do so.
The other option would be to have a nested if statement, something like this, that responds to an unsplit ROI by deleting the ROI:
for (i=0 ; i<nb_obj; i++) {
Ext.Manager3D_Select(i);
Ext.Manager3D_Measure3D(i,"Vol",measure);
if (measure>30000)
Ext.Manager3D_Split(i);
if (getInfo("log")=="Object was not splitted")
Ext.Manager3D_Delete(i);
}
My trouble here is that the getInfo("log") doesn't seem to turn into a string as I hoped - instead it just re-copies the log to the log. Even if it did, I'd need to somehow get only the most recent line of the log, and I'm not sure how to do that. I haven't been able to find any other options for having the macro respond to the log.
Any ideas? :)
Thanks very much in advance!
Kaitlin Snider
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html