NEUBIAS / training-resources

Resources for teaching/preparing to teach bioimage analysis
https://neubias.github.io/training-resources
Other
46 stars 21 forks source link

watershed module (double-check) #327

Open maulakhan opened 2 years ago

maulakhan commented 2 years ago

image

@tischi Should it not include all steps of the GUI activity, I don't see GUI activity here (or did we change the convention already):

tischi commented 2 years ago

To be honest, for the more advanced modules I find it quite tiring to write down the GUI workflow.

One can tell the students how to read the macro to reproduce in the GUI (@manerotoni did that the first day).

I think in the future I would consider teaching such complex stuff only after the students know how some macro programming.

But thanks a lot for providing the GUI activity! 🥇

tischi commented 2 years ago

@maulakhan

I added the GUI version. Thanks a lot!

I would say we do not do this for the other activities and exercises in the watershed module as it is too much work.

I just did not like so much the "ImageJ GUI and Macro", but I think just having plain "ImageJ Macro" and explaining the students how to read them is OK for the more advanced modules.

I think this is also a point that we can actively make: "Dear participants, we are now at a level where the analysis is becoming so advanced and complex that we actually feel that it is not practical to do this in the GUI".

@manerotoni @AnniekStok what do you think?

manerotoni commented 2 years ago

To be honest, for the more advanced modules I find it quite tiring to write down the GUI workflow. One can tell the students how to read the macro to reproduce in the GUI (@manerotoni did that the first day).

Funny this was the conclusion from our first round of courses.
Writing down a GUI in text is quite some work and also prone to error. The version where you copy paste the macro code and then add some comments. One could may be give an hint in the activity. For instance using following commands .... solve the problem.

manerotoni commented 2 years ago

I think it is not wrong to say that when you run a complicated workflow you should record your steps. This process takes a few minutes and allows you to recover the workflow.

How to change the macro is more complicated and requires more programming skills.

maulakhan commented 2 years ago

image

Note: If we apply chamfer distance transform with borgefors(3,4), we get the desired result without suppressing minima

image

tischi commented 2 years ago
  • *two objects (instead of three)

Thanks @maulakhan, I fixed it.

* *basic watershed algorithm!!!? or using steps in previous activity doesn't work here!!!!!

Thanks, I fixed it.

Note: If we apply chamfer distance transform with borgefors(3,4), we get the desired result without suppressing minima

Thanks, we found this out, too, but discussed that it is anyway best practice to smooth the distance transform, so we left this in on purpose.

maulakhan commented 2 years ago

image

maulakhan commented 2 years ago

image

image

maulakhan commented 2 years ago

image

tischi commented 2 years ago

@maulakhan Camilla's data is beautiful! I think it is so beautiful that the watershed segmentation may even work without using the nuclei as seeds? Could you try?

tischi commented 2 years ago

only thing would be see again all the sentences in the activity and check if you want to use full stops or not.

I added full stops now in all the sentences. Any opinion on this in general? I think I do not care too much as long as it is consistent within one module.

tischi commented 2 years ago

In exercise image, not smoothing with gaussian works better if chessboard is used, however, with borgefor smoothing works

Thanks! As mentioned above, I think smoothing the distance transform is often good practice and thus good if we do it.

tischi commented 2 years ago

I think e) should come before c) because c) is the result actually produced using e)

Done.

maulakhan commented 2 years ago

image

maulakhan commented 2 years ago

image

tischi commented 2 years ago

@maulakhan Very interesting! If you are motivated you could add an exercise using this material, but I think we have more than enough material for the course on Monday, so no time pressure.

manerotoni commented 2 years ago

Hello @tischi and @maulakhan, the watershed module is very good!

I wonder if you can add in the concept map and/or learning goals that watershed algorithm needs valleys to work.

Embarrassingly it took me a while to understand this. The confusing part is that some plugins do the inversion as part of the workflow. For instance watershed in ImageJ watershed method [Process > Binary > Watershed] plugin does a lot of stuff on the back, among others it probably invert the distance transform (called distance map).

To run the built in [ImageJ watershed method](https://imagej.nih.gov/ij/docs/menus/process.html#watershed) choose menu item: Process - Binary - Watershed. This method finds the centre of each object (using a morphological erode operation), then calculates a distance map from the object centre points to the edges of the objects, then fills that “topological map” with imaginary water. Where 2 “Watersheds” meet, it builds a dam to separate them! One could do all these steps manually, but the watershed function automates that for you, which is nice. Your watershed image should look like this:

manerotoni commented 2 years ago

This lead me to an erosion exercise for the rank filters that can be used to identify seeds.

tischi commented 2 years ago

I wonder if you can add in the concept map and/or learning goals that watershed algorithm needs valleys to work.

This is there already:

image

Embarrassingly it took me a while to understand this. The confusing part is that some plugins do the inversion as part of the workflow. For instance watershed in ImageJ watershed method [Process > Binary > Watershed] plugin does a lot of stuff on the back, among others it probably invert the distance transform (called distance map).

Yes, [Process > Binary > Watershed] does all the stuff that you mentioned in one go.

manerotoni commented 2 years ago

From this concept I do not understand that you need minima. I can have local intensity minima also in a non-inverted image. This is then the background.

BTW: Can you edit the watershed exercise to "java" code.

manerotoni commented 2 years ago

You can't change to code layout an exercise . It is always a md. You can create code decorator at start and at end

This is a reason more why we should just use activities.

manerotoni commented 2 years ago

See https://github.com/NEUBIAS/training-resources/pull/334

tischi commented 2 years ago

From this concept I do not understand that you need minima. I can have local intensity minima also in a non-inverted image. This is then the background.

Not sure what you mean. If you have minima then you can run a watershed also without inverting. See for example here:

image