mcib3d / mcib3d-plugins

ImageJ plugins for 3D processing and analysis
https://imagej.net/3D_ImageJ_Suite
8 stars 9 forks source link

3D Spot Segmentation "seg" window missing? #18

Closed ferielp closed 3 years ago

ferielp commented 3 years ago

I wrote a macro in 2018 using 3D spot segmentation. It worked great but I haven't needed to use it much until just now. The macro no longer works because an output window the "seg" stack is not found. Below is a snippet of my macro from the time the 3D spot Segmentation is run to the point at which the macro breaks down.

run("3D Spot Segmentation", "seeds_threshold="+thresholdArray[i]+" local_background=0 radius_0=2 radius_1=4 radius_2=6 weigth=0.50 radius_max="+gaussianRadius+" sd_value=1.17 local_threshold=[Gaussian fit] seg_spot=Maximum watershed volume_min=1 volume_max=1000000 seeds=3D_MaximumLocal"+example+" spots=rawBackSubtracted"+example+" radius_for_seeds=2 output=Both"); print("Segmenting thresh ="+thresholdArray[i]+"; gaussian radius ="+gaussianRadius); //7000 is a good noise tolerance; a good modification would be to stop and let the user examine the point selection Complete to get a better sense of Find Maxima...countrun("Z Project...", "projection=[Max Intensity]"); selectWindow("MAX_rawBackSubtracted"+example); run("Select None"); run("Find Maxima...", "noise="+noiseTolArray[i]+" output=Count"); print("NoiseTol after Count is done = "+noiseTolArray[i]); //To beginn with 0th row of the Results table and end with (seriesCount-1) to get Find Maxima..., 3D ROI Count, and %Difference in Results window //Store Find Maxima... count from Results Window in variable and use to calculate error with objCount j=nResults-1; maxCount=getResult("Count",j); objCount=0; run("3D Manager"); Ext.Manager3D_Count(objCount); setResult("Series #",j,example); //Extract the element from the array of titles that is 1 less the iteration number because arrays start from the 0th element t=titles[i-1]; setResult("Series/Condition Name",j,t); updateResults(); //This works after the two setResult commands to refresh the Results window with new values // ----------------------------------------------------------SEE BELOW

    selectWindow("seg"); // This is where the macro stops, there is no seg stack to select
    //These window names are generated with each run, so they must be renamed to avoid using an old one in the next iteration. None of them will be closed, allowing user to look at them all, compare, and evaluate settings
    rename("seg"+example);
mcib3d commented 3 years ago

You are right, there is a bug in the 3D Spots Segmentation plugin when you want to display the 3D Manager. The bug will be fixed in a new release soon. You macro will work if you change the output of spots segmentation to output=[Label Image]. Then you will need to add the image to the 3D Manage before : Ext.Manager3D_AddImage();

Hope this helps.

nhuhoa commented 3 years ago

Hi, Here is my macro, it works well. I use version: mcib3d_plugins3.93.jar, mcib3d-core3.93.jar:

run("3D Spot Segmentation", "seeds_threshold="+spot_seeds_threshold+" local_background=0 radius_0=2 radius_1=4 radius_2=6 weigth=0.50 radius_max=20 sd_value=1.90 local_threshold=[Gaussian fit] seg_spot=Block watershed volume_min=800 volume_max=100000 seeds=Automatic spots=BP_dapi radius_for_seeds=2 output=[Label Image]"); selectWindow("seg"); run("3-3-2 RGB"); saveAs("Tiff",seg_output);

All the bests, Hoa Tran