Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove clearing the ROI manager before adding new ROI #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jboulanger
Copy link

Clearing the ROI manager prevent using startdist on multiple images in Fiji.

Clearing the ROI manager prevent using startdist on multiple images in Fiji.
@uschmidt83
Copy link
Member

Hi and thanks for the PR. I can't really remember, but I think there was a reason why we cleared the ROI Manager. Is this important to your workflow?

@jboulanger
Copy link
Author

Hi,

Yes it is important. I am using it on different channels in an IJ macro.

I tried using the label image output and extract the ROI from there but in batch mode, for some reason the label image was not accessible. Here is a test example that show the issue with the label image:

run("Close All");
run("Blobs (25K)");
run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'blobs.gif', 'modelChoice':'Versatile (fluorescent nuclei)', 'normalizeInput':'true', 'percentileBottom':'0.0', 'percentileTop':'100.0', 'probThresh':'0.479071', 'nmsThresh':'0.3', 'outputType':'Label Image', 'nTiles':'1', 'excludeBoundary':'0', 'roiPosition':'Hyperstack', 'verbose':'false', 'showCsbdeepProgress':'false', 'showProbAndDist':'false'], process=[false]");
selectWindow("Label Image");

run("Close All");
run("Blobs (25K)");
setBatchMode("hide");
run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2D], args=['input':'blobs.gif', 'modelChoice':'Versatile (fluorescent nuclei)', 'normalizeInput':'true', 'percentileBottom':'0.0', 'percentileTop':'100.0', 'probThresh':'0.479071', 'nmsThresh':'0.3', 'outputType':'Label Image', 'nTiles':'1', 'excludeBoundary':'0', 'roiPosition':'Hyperstack', 'verbose':'false', 'showCsbdeepProgress':'false', 'showProbAndDist':'false'], process=[false]");
selectWindow("Label Image");
setBatchMode("exit and display");

An other option was to use convert the image to a time lapse and normalizing the images before hand.

The third option was to modify the stardist code and hope this is useful to others.

I don't see any other use of the ROI Manager in the project at this level. It is only used in this function so it would suggest the side effect are minimal. The roiManager variable would actually not need to be a member of StartDist2DBase in the end and could have its scope limited to the export function. In that case, I would remove
protected RoiManager roiManager = null;
and have later

roiManager = RoiManager.getInstance();
if (roiManager == null) roiManager = new RoiManager();

otherwise, keep the protected member and have:

if (roiManager == null) {
    roiManager = RoiManager.getInstance();
    if (roiManager == null) roiManager = new RoiManager();
}

May be..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants