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

macro for slices #4

Open
matfallet opened this issue Mar 23, 2020 · 10 comments
Open

macro for slices #4

matfallet opened this issue Mar 23, 2020 · 10 comments

Comments

@matfallet
Copy link

matfallet commented Mar 23, 2020

Hi,
Is there a way to put stardist in a macro to apply the segmentation for each slice and recombine them to reconstruct 3D nuclei ?
It would be great, I try but don't find the command to skip the interface :

getDimensions(width, height, channels, slices, frames);
for (i = 1; i < slices+1; i++) {
				setSlice(i);
				run("Make Substack...", "  slices="+i);
				run("StarDist 2D");
}
// Recombine the slices and make the Connectivity like in morpholibJ
// Run("Connected Components Labeling", "connectivity=6 type=[16 bits]");

Thanks so much, the segmentation is amazing in 2D for nuclei, I cannot imagine it was possible to do so good job !
Cheers, Mathieu

@uschmidt83
Copy link
Member

Hi Mathieu, thanks for using StarDist!

Our Python package can do 3D nuclei segmentation and we would love to bring that also to our Fiji plugin. However, there are unfortunately several technical challenges why this hasn't happened yet.

What you are trying to do (segment in 2D and merge) could work for some easier datasets, but is likely not going to work well in general. Hence, we're not pursuing this approach.
However, if you want to give it a try, please have a look at this Jython script that shows how StarDist can be scripted from within Fiji.

Hope that helps.

Best,
Uwe

@haesleinhuepf
Copy link
Contributor

Hey @uschmidt83,

there are some people on the image.sc forum asking for how to run StartDist from ImageJ Macro or having issues in running it from Macro:

https://forum.image.sc/t/automation-of-stardist-in-imagej-macros/35611

https://forum.image.sc/t/beginner-in-clij-implementation-for-an-existing-macro/35541

Unfortunately, the Macro recorder just records run("StarDist 2D"); when executing the plugin. I was wondering if there are any plans for making StartDist usable from ImageJ Macro.

I would also be happy to help implementing it. Just let me know. ;-)

Cheers,
Robert

@uschmidt83
Copy link
Member

Hi Robert,

Unfortunately, the Macro recorder just records run("StarDist 2D"); when executing the plugin. I was wondering if there are any plans for making StartDist usable from ImageJ Macro.

I would also be happy to help implementing it. Just let me know. ;-)

I don't know if/how this is possible (note that StarDist is an ImageJ2 plugin).
We'd gladly support ImageJ macro and the macro recorder if the amount of work to do that is reasonable ;)

Best,
Uwe

@haesleinhuepf
Copy link
Contributor

Hi Uwe,

cool. ImageJ2 plugins are usually recordable. In this case it's tricky. But I've done it before, so no big deal. I'll send a PR with the recordable plugin soon.

Cheers,
Robert

@matfallet
Copy link
Author

Hi Uwe,
It would be great to have plugin for sure.
I will try now to run your python code from my macro as I need a 3D version.
Is-it possible to run your python code like this ?
call("ij.plugin.Macro_Runner.runPython", script, parameter);
Thanks, Mathieu

@uschmidt83
Copy link
Member

Hi @matfallet,

sorry for the late reply. I don't think you can easily call our python code from within Fiji, let alone a macro.

Sorry.

@matfallet
Copy link
Author

matfallet commented Apr 10, 2020 via email

@uschmidt83
Copy link
Member

  • do you implement it on synthetic data only ?

No, the example just uses synthetic data.

  • Does your model is robust to different parameters, in 2D it works perfect, so why not in 3D ?

I don't understand. Do you mean why the 3D model cannot be applied to other images like yours?
In contrast to the 2D model, which was trained a larger variety of different images, there is no similar model in 3D yet. Hence, for now you need to train a model on your own labeled training data.

@matfallet
Copy link
Author

OK I understand, there is no model cuurently in 3D to detect nuclei like for 2D : versatile (fluo nuclei). I suppose that the 3D model could be trained on 3D image with high voxel size (good sampling) and then we can change the number of slices to train on lower sampling...how many cells do you use to build the 2D model ? Just an idea how long could it takes in 3D.. Thanks Mathieu

@uschmidt83
Copy link
Member

how many cells do you use to build the 2D model ? Just an idea how long could it takes in 3D

We trained the 2D model on hundreds of images (thousands of cells) of the DSB 2018 nuclei segmentation challenge dataset. That's why it works so well in general.

In general, it is very difficult to say how many annotated images/cells are needed to reach results that are good enough for the intended application. It really depends on the appearance variability of the to be segmented cells. The more variability, the more annotated data is required.

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

No branches or pull requests

3 participants