sciai-lab / mutex-watershed

The mutex watershed for image segmentation.
63 stars 13 forks source link

How to generate 'labels/gt_segmentation' from 'labels/membranes' ? #9

Closed yangfan616 closed 10 months ago

yangfan616 commented 3 years ago

Hi, thank you for sharing. I tried to open isbi_train_volume.h5 and it contains ['affinities', 'labels', 'raw'], also the ['labels'] contains 'gt_segmentation' and 'membrabes'. In the previous issue, I learned that 'gt_segmentation' is a 3d segmentation derived from 'membranes'.

I would be very grateful if you could elaborate on this. Thanks!

(The first one in the following two pictures belongs to 'membranes', and the second one belongs to 'gt-segmentation') image image

constantinpape commented 3 years ago
* I wonder how did you get gt_segmentation from membrabes ? Is There any algorithm uesd in the process?

Yes, this was derived by Multicut based segmentation, following the procedure detailed in https://www.nature.com/articles/nmeth.4151 and using the membrane ground-truth as boundary probabilities.

yangfan616 commented 3 years ago

Thanks for your quick reply! I would like to read this paper and learn about this algorithm .

constantinpape commented 3 years ago

I would like to read this paper and learn about this algorithm .

A good starting point would be the supplementary material, which is available here, and also should not be pay-walled.

Note that the software described in the paper is out-dated, I have more up-to-date implementations in another repository, you can find usage examples here: https://github.com/constantinpape/elf/tree/master/example/segmentation

yangfan616 commented 3 years ago

So sorry to bother you again! Following your suggestions, I studied the content of the supplementary material, and then prepared to reproduce the sample code in the https://github.com/constantinpape/elf/tree/master/example/segmentation, however I met another problem: In the multicut_boundaries.ipynb, there are two inputs: the first is ['raw'], which refers to the original images, the other is ['isbi_test_prob.tif'], which may refer to the bounday probabilities.

Due to lack of ['isbi_test_prob.tif'], I used ['lables/membrabes'] in isbi_train_volume.h5 instead of ['isbi_test_prob.tif'] to execute multicut_boundaries.ipynb, but the final result was not good(See below)

image

According to the supplementary material, I think the ['isbi_test_prob.tif'] here is produced with the CNN described in the paper. https://www.nature.com/articles/nmeth.4151. So, I got ['probabilities_train.tif'] (See below) from https://files.ilastik.org/multicut/NaturePaperDataUpl.zip

image

When I used ['probabilities_train.tif'] instead of ['isbi_test_prob.tif'] to execute multicut_boundaries.ipynb, the final result was much better(See below)

image

Here my another question is

If there is something wrong with my words, I hope you can correct me. Really appreciate your time and help. Thank you so much! Best wishes!

constantinpape commented 3 years ago

Due to lack of ['isbi_test_prob.tif'], I used ['lables/membrabes'] in isbi_train_volume.h5 instead of ['isbi_test_prob.tif'] to execute multicut_boundaries.ipynb, but the final result was not good(See below)

Yes, I have also used the membrane groundtruth for this, but with some post-processing (shrinking the boundaries + smoothing). Is there any reason why you want to reproduce this exact step? The segmentation ground-truth is available after all.

* When I want to get the example data from the link: https://hcicloud.iwr.uni-heidelberg.de/index.php/s/6LuE7nxBN3EFRtL, but found it is invalid. Is there another link I can get the example data?

Which example data is this?

* In the process of generating ['label/gt_segmentation'] in isbi_train_volume.h5, did you use CNN to obtain [probabilities_train.tif] from ['membrabes'], and use [probabilities_train.tif] to obtain ['gt_segmentation'] through distance transform watershed + Multicut ?

Like I said, this is the multicut processing applied to the membrane labels after some ground-truth. Unfortunately I don't quite know where the exact script for this is right now.

yangfan616 commented 3 years ago

Which example data is this?

The example data refers to ['isbi_test_prob.tif'] and [isbi_test_volume.h5] used in the multicut_boundaries.ipynb. Now I have [isbi_test_volume.h5] but lack ['isbi_test_prob.tif'].
That's why I tried to use ['lables/membrabes'] and ['probabilities_train.tif'] instead of ['isbi_test_prob.tif'] to execute multicut_boundaries.ipynb

Yes, I have also used the membrane groundtruth for this, but with some post-processing (shrinking the boundaries + smoothing).

I can't imagine the accuracy will be improved so much by just adding some post-processing operations. You know, the result using ['lables/membrabes'] without post-processing steps is not really good. I woule like to try post-processing steps with the ['lables/membrabes'] in isbi_train_volume.h5.

Is there any reason why you want to reproduce this exact step? The segmentation ground-truth is available after all.

Yes! Actually, I want to apply Mutex Watershed with my dataset to see whether the segmentation result is satisfied. I have some Synthetic Aperture Radar data(just like ['raw'] here), but i don't have the ['gt_segmentation'] used in CNN. Therefore, I really really want to know about the exact steps used in generating ['gt_segmentation'], so that I could make the groundtruth for the Synthetic Aperture Radar data.

Like I said, this is the multicut processing applied to the membrane labels after some ground-truth. Unfortunately I don't quite know where the exact script for this is right now.

It’s OK. Your suggestions have helped me a lot, I am very grateful for this.

Now, my question is how I can get the ['gt_segmentation'] from ['lables/membrabes'], if you have any other suggestions, plz tell me anyway. Thanks again for your kind help!

Best wishes!