georgeoshardo / SyMBac

Accurate segmentation of bacterial microscope images using deep learning synthetically generated image data.
https://doi.org/10.1186/s12915-022-01453-6
GNU General Public License v2.0
19 stars 9 forks source link

Position Shift on Symbac 2 #42

Closed kmpape closed 5 months ago

kmpape commented 9 months ago

Hello Georgeos,

I am about to push something, but before that I have a question:

https://github.com/georgeoshardo/SyMBac/blob/7b8244370f976a79d84f8b31dd53a2c49bba8df2/SyMBac/cell.py#L133 https://github.com/georgeoshardo/SyMBac/blob/7b8244370f976a79d84f8b31dd53a2c49bba8df2/SyMBac/cell.py#L134

Are you sure about the signs above? In my opinion, if the mother is kept at the top, new_x should have something subtracted and new_y something added. The other way around for the daughter.

Thanks!

kmpape commented 9 months ago

Sorry, my bad. I think that it should be

x_mother = self.position[0] - self.division_sign * self.length/2 *  np.cos(self.angle - np.pi/2)  
y_mother = self.position[1] + self.division_sign * self.length/2 *  np.sin(self.angle - np.pi/2)

assuming that self.angle starts at the horizontal axis.

I have now simplified some stuff on my end and will make a pull request some time next week. I added division_sign above so one can specify whether the mother should be on top or bottom. It only matters for something related to IDs, which will be contained in the pull request.

georgeoshardo commented 9 months ago

Hi Idris, I think this can be a change which is made for the convenience of mother machine simulations, sure. Great that it's adjustable. The simulation is still stable yes? If we have a robust lineage tracking system then this will also help.

georgeoshardo commented 5 months ago

Hi @kmpape

I finally fully realised why you want you want to do this while implementing some stuff to export lineages from the simulation as directed graphs, and maintaining constant mask ID during the simulation. Having the mother stay at the top keeps its mask constant, with each daughter gaining a new mask label. This will be in a commit today.

georgeoshardo commented 5 months ago

Fixed in https://github.com/georgeoshardo/SyMBac/commit/a976458a4e3db5c293a2a6815803b705e7b42a9d!

kmpape commented 3 months ago

Thank you very much for this.