Skip to content

Conversation

@schilling40
Copy link
Contributor

Post-process IHC segmentation based on the synapse per IHC count.
First, IHC instances with a high synapse per IHC count are investigated and replaced with multiple instances from a reference segmentation.
Based on the edited segmentation. the synapse count per IHC is once more calculated and IHC instances without synapses can be omitted.

The current commit works for single crops in tif format but seems to have issues when being applied on data in n5 / ome-zarr format.

WIP

@schilling40
Copy link
Contributor Author

The current implementation of the script flamingo-tools/scripts/prediction/postprocess_ihc_synapse.py uses the segmentation found at the input path both as the input data and the base for the output. Regions of interest are replaced in the input and stored in the same file. While this avoids copying the data and saving the whole file again, it requires to copying of the input files beforehand and is not very clean. What would be a better way to handle this?

@constantinpape
Copy link
Contributor

This looks good.

The current implementation of the script flamingo-tools/scripts/prediction/postprocess_ihc_synapse.py uses the segmentation found at the input path both as the input data and the base for the output. Regions of interest are replaced in the input and stored in the same file. While this avoids copying the data and saving the whole file again, it requires to copying of the input files beforehand and is not very clean. What would be a better way to handle this?

To understand: the script changes the segmentation in-place, and the copy you mention is needed to have a back-up of the initial version to avoid that it's lost. If I understand this correctly: I think this is ok. You could add a flag --bkp to the script that automatically does the copy, e.g. to a file called <INPUT_FILE>.bkp.

@schilling40 schilling40 merged commit 39b313f into master Jul 31, 2025
6 checks passed
@schilling40 schilling40 deleted the postprocess_ihc_synapse branch July 31, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants