MannLabs / py-lmd

https://mannlabs.github.io/py-lmd/
MIT License
7 stars 1 forks source link

can I use reference points outside my image coordenates #10

Open josenimo opened 1 year ago

josenimo commented 1 year ago

Dear @sophiamaedler,

I am currently trying to collect cells from TMA cores, unfortunately, the core segmentation process (https://github.com/HMS-IDAC/UNetCoreograph) separates each core into a separate tif.

I could however calculate the pseduo coordenates of the ref points to the cells, by calculating distance to the crop coordenates. Question is, could I use reference points that are in a space outside my current .tif?

Ideas and feedback are welcome :) Jose

sophiamaedler commented 1 year ago

Hi Jose, In theory yes, in practice I think this might be difficult and lead to imprecise cutting, but it depends a little bit on your imaging data.

  1. How you would do it in theory: simply enter negative coordinates for your reference points that lie outside of the segmentation mask you are loading into the segmentation loader.

  2. Why this will be difficult in practice: To be able to accurately excise several regions from your TMA cores you need to know the exact distance between the shapes you want to excise. If you are working within one TMA core then the distance in the LMD microscope will be equivalent to the distance in your image (assuming that your image stitching worked well). As soon as you start moving outside of your TMA core though (where there are no imaged structures) the stitching will become very bad because there is no signal for it to work with between image tiles. So the distance in the images will no longer correspond to the distance in the LMD. If this is a problem will depend on what your imaging data look like and how close the TMA cores are together. If you could share an example I might be able to give more input.

Cheers Sophia

josenimo commented 1 year ago

Ok, this sounds great we will image some cores with just DAPI and test whether we can do this with enough efficiency.

In your experience, how far away is too far away for the calibration points? In the context of collecting single cells. In our experience 1mm from cutting contour was somewhat still manageable..

sophiamaedler commented 1 year ago

Too far away depends on the size of your imaging tiles. What resolution are you acquiring your images in? I think 1mm should probably still be manageable. The real test will be how well your shapes align when you import them at the LMD.

In my datasets I usually don't encounter this problem so I don't have a lot of hands-on-experience (cell culture cells are always quite homogeneously distributed), but in some tissue slides from colleagues we had some problems with "holes" in the tissue. When the holes were large enough that there were 1-2 complete imaging tiles without any signal we started getting stitching problems. We solved the issue by selecting reference points that were not associated with the "mis-stiched" areas.

In my datasets I have also seen that small stitching mistakes become very noticeable over larger areas from which single-cells should be excised. This is why in my opinion the stitching is one of the most crucial steps in the entire pipeline. But I think I am excising cells from a much larger area than most use cases so it might be a problem unique to our workflow.

Feel free to reach out again when you have the DAPI test data and we can discuss it.