Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colocalization cellmap tweak #161

Open
wants to merge 44 commits into
base: v3.0.x
Choose a base branch
from

Conversation

completementgaga
Copy link

Cellmap tweak to have the correct output to instantiate colocalization.Channel.

…example it allows to select a unique representative in each connect component of maxima.
…_detection, to avoid buggy use of watershedding.
…ll to voxelize could yield nonseparated peaks and cause bugs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the API defaults is dangerous as this may create unexpected behaviour. Whenever possible, try to reproduce the expected behaviour by default and the new behaviour when parameters are passed (unless this is a bugfix)

Copy link
Author

@completementgaga completementgaga Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same try to preserve exsiting behaviour by default unless you are fixing a but

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watershed_line=True should be function of arguments

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added watershed_line as an argument. The ancient behavior would be with watershed_mask=False.
Yet, for consistency of the new version, to have the sizes of detected cells independent of the other arguments choices, the default watershed_mask = True is the only choice.

Moreover the difference between False and True for watershed_mask does not entail a drastic change in the observed sizes.

I would favor consistency of the new version against maintaining the exact same API. Feel free to make your choice.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo introduced in docstring
Are you actually initialising the asset to None ?
The idea is that one might search for an asset with a prefix (not an exact match)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new lines 310-312 : this is actually a fix for the case there would be no entry for asset_type is in the AssetCollection self.asset_collections[channel] of former line 310. In that case the getitem method would raise an exception.

typo fixed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are not checking for presave_parser before using it.
If it is automatically required whenever an other argument is selected, verify that it is the case and raise a clearer exception otherwise

Copy link
Author

@completementgaga completementgaga Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. I made the change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtype = par.get('save_dtype', 'float')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to preserve behaviour whenever possible through additive changes
It might make sense to signal a change of behaviour otherwise
ln430 and 462 are not indented as expected
ln466 is blank

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check performance

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked perf of cell-detection with ancient and new implementation
with cfos channel of your test dataset, on my workstation.
6'16'' with ancient
6''25'' with new
Since the new implementation prevents counting twice the same cell in the case of adjacent maxima, I think this new version should be merged.

follow expanduser() demand.
added missing presave_parser check
fixed default to initial value
fix indent
FORMAT: add 3 spaces
FORMAT: add one space
FORMAT: remove blank line.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtype = par.get('save_dtype', 'float')

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check performance

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watershed_line=True should be function of arguments

simplify par.get call with correct default value usage
removed hardcoded path
Remove debug print and add watershed_line to detect_shape signature.
use watershed_line input in detect_shape
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.

2 participants