chan-labsite / SC-Track

SC-Track: A biologically inspired algorithm for generating accurate single cell linages
https://github.com/chan-labsite/SC-Track
GNU General Public License v3.0
5 stars 2 forks source link

Tracking errors (because of matching order?) #1

Open FrickTobias opened 2 months ago

FrickTobias commented 2 months ago

Hi!

I'm trying out your tool for tracking segmentations and I'm experiencing some errors which I would guess are related to in which order the objects are handled.

If my diagnosis's are correct (or at least not completely crazy) I think performance could be improved if matches are assigned in order of match quality, instead of matches being assigned in order of object id in descending order.

For my small test data I saw these errors:

Example one:

track_visualization-0427

track_visualization-0428

Example two:

track_visualization-0536

track_visualization-0537

track_visualization-0538

frozenleaves commented 2 months ago

Hi!

I'm trying out your tool for tracking segmentations and I'm experiencing some errors which I would guess are related to in which order the objects are handled.

If my diagnosis's are correct (or at least not completely crazy) I think performance could be improved if matches are assigned in order of match quality, instead of matches being assigned in order of object id in descending order.

For my small test data I saw these errors:

Example one:

  • My diagnosis:
  1. A division is detected and match to 3-0; creating 3-1 and 3-2
  2. 3-2 is matched, occupying previously 14-0
  3. 14-0 is matched before 11-1
  4. 11-1 is lost

track_visualization-0427

track_visualization-0428

Example two:

  • My diagnosis:
  1. 13-0 appears because of a faulty split in the segmentation
  2. 13-0 is matched before 3-1
  3. 3-1 is lost

track_visualization-0536

track_visualization-0537

track_visualization-0538

Hi !

Thank you for your interest in our work!

Your idea is correct, and in fact, we do the same. However, in the process of matching cell division, if there is a lack of cell cycle control information, it may lead to the matching process mistakenly entering the matching of cell division events. One possible solution for this issue is to make the conditions for entering cell division more stringent, which can solve some false positive problems. However, if the segmentation noise is heavy, such as many false negative segmentation, this may reduce the number of matched cell division events.

When there is no cell cycle information, the current means for SCTrack to control the entry into the cell division event matching process is only the time interval between the last occurrence of the division event. In this case, when a certain interval is exceeded, the algorithm no longer controls the matching cell division process. If the candidate item meets the conditions for matching the division event, it will be transferred to this process.

image The control method like this, you can see, when the config.INCLUDE_CELL_CYCLE is False, only enter_mitosis(self, frame) function can work, so, you can try to modify this function, to add your own conditions, it should be resolve a little part of the problem.

Another possible option is to selectively label cells that can undergo division and then track them. However, further development is needed for this function, as SCTrack can only adapt to all or none cases, and some labeling has not been processed yet. You can pay attention to it in the future, and if possible, I will try to add this logic.

If you are willing, you can also send me your test dataset to take a look, and perhaps some problems can be solved by adjusting the parameters. Thank you again for your interest in our work.

kuanyoow commented 2 months ago

Hi!

I'm trying out your tool for tracking segmentations and I'm experiencing some errors which I would guess are related to in which order the objects are handled.

If my diagnosis's are correct (or at least not completely crazy) I think performance could be improved if matches are assigned in order of match quality, instead of matches being assigned in order of object id in descending order.

For my small test data I saw these errors:

Example one:

  • My diagnosis:
  1. A division is detected and match to 3-0; creating 3-1 and 3-2
  2. 3-2 is matched, occupying previously 14-0
  3. 14-0 is matched before 11-1
  4. 11-1 is lost

track_visualization-0427

track_visualization-0428

Example two:

  • My diagnosis:
  1. 13-0 appears because of a faulty split in the segmentation
  2. 13-0 is matched before 3-1
  3. 3-1 is lost

track_visualization-0536

track_visualization-0537

track_visualization-0538

Hi Tobias, I just got the chance to review Chengxin's response based on your post and I think there is some misunderstandings on Chengxin's side. It is quite odd that the track IDs are switching especially when the cells in the frames clearly did not move much from previous frames.

Would it be possible that you provide us a small sample of your segmentation results and images used for the generation of the tracks? This is so that we can work on figuring out the cause of this unexpected behaviour. Thanks.

FrickTobias commented 2 months ago

Hi Tobias, I just got the chance to review Chengxin's response based on your post and I think there is some misunderstandings on Chengxin's side. It is quite odd that the track IDs are switching especially when the cells in the frames clearly did not move much from previous frames.

Would it be possible that you provide us a small sample of your segmentation results and images used for the generation of the tracks? This is so that we can work on figuring out the cause of this unexpected behaviour. Thanks.

Sure, I can provide the data together with the tracking results! I'll update soon with a link. Thanks a lot for taking the time!

FrickTobias commented 2 months ago

Here's the test data and output: https://drive.google.com/drive/folders/1fAJuL9kMUtnO4LAQ0sc6_XXYiZQ9Dgt8?usp=drive_link

NOTES.md contains the command and version.

chan-labsite commented 2 months ago

Hi Tobias, thanks for sharing your imaging data. I have informed Chengxin about this and I hope he will be able to come back to you on this matter. Please be patient with us as Chengxin recently took on a new role and it may take some time before he can address this. Many apologies for this.

kuanyoow commented 1 month ago

Hi Tobias, many apologies for the delay in addressing your issue related to sctrack. While working on your tracking problem, we have discovered multiple bugs in sctrack which causes the tracking errors that you observed. We are working on these issues at the moment which would require a considerable time to troubleshoot the underlying code.

Included here is a quick and dirty solution that can correct the tracking errors that you are observing.

Due to the relatively small morphological differences between the mother and daughter cells on your microscopy images, it will be challenging to make accurate mother daughter assignments with our current implementation of sctrack in the absence of the cell cycle classification. We will aim to address this with future updates on sctrack.

prototype_refiner.txt

FrickTobias commented 1 month ago

Thank you for taking all this time to work on it!

I'm happy my data could help you identify a lot of bugs and I completely understand it might take some time.

Big thanks for the prototype, I'll try and run it on my full dataset and see if it's something I can incorporate in my pipeline and I'll see if I can tackle the mother-daughter problem on my own. I'll update you if I find something which seem to work.

Thanks a lot again!

kuanyoow commented 1 month ago

Hi Tobias, Glad that we are able to help with your tracking problem. We hope that we can make SC-Track more robust so that it will be useful to as many users as possible. Please let us know if you managed to sort out the mother-daughter assignment problem. I think the single cell tracks that has been refined will be a good start for deciding which single cell lineages should be linked as mother daughter assignments. The highly similar cell size and shape of the daughter cells after the cell division event may be a good indicator for the linking assigmnent.