Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…ACDC into optimizations
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 39 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
cellacdc/workers.py:185
- These accesses assume
data_dict['regionprops']is anacdcRegionpropswith.IDs/.IDs_set. If older/alternate code paths still store a plainskimage.measure.regionpropslist here, this will raiseAttributeErroreven whenlabis present. Consider using a small helper likeIDs = rp.IDs if hasattr(rp, 'IDs') else [obj.label for obj in rp](and similarly forIDs_set).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| precompiled_import_success = False | ||
| try: | ||
| from cellacdc.precompiled.precompiled_functions import ( | ||
| find_all_objects_2D, | ||
| find_all_objects_3D, | ||
| calc_IoA_matrix_2D, | ||
| calc_IoA_matrix_3D, | ||
| ) | ||
| precompiled_import_success = True | ||
| except Exception as err: | ||
| import traceback | ||
| print('[WARNING]: could not import precompiled functions, falling back to pure python versions. ') | ||
| traceback.print_exc() | ||
|
|
||
| if precompiled_import_success: | ||
| print('Precompiled functions imported successfully.') No newline at end of file |
There was a problem hiding this comment.
Importing cellacdc now prints to stdout/stderr (warning + full traceback on ImportError, and a success message on success). Import-time prints are noisy in CLI/GUI contexts and can break tools that rely on clean stdout. Consider using the project logger (or warnings.warn) and avoid printing tracebacks unless an explicit debug flag/environment variable is enabled.
| IDs = data_dict['regionprops'].IDs | ||
| checker = core.CcaIntegrityChecker(cca_df, lab, IDs) | ||
|
|
There was a problem hiding this comment.
IDs = data_dict['regionprops'].IDs assumes regionprops is an acdcRegionprops. If it is ever a plain list of RegionProperties (e.g., legacy cached state), this will raise AttributeError and prevent integrity checks from running. Use the same fallback pattern as elsewhere (e.g., hasattr(rp, 'IDs')).
| self.ID_to_idx = {obj.label: idx for idx, obj in enumerate(self._rp)} | ||
| # Update IDs and IDs_set separately and explicitly | ||
| self.IDs_set = set(self.ID_to_idx) | ||
| self.IDs = list(self.IDs_set) |
There was a problem hiding this comment.
set_attributes builds self.IDs from list(self.IDs_set). Since sets are unordered, this makes rp.IDs nondeterministic between runs, which can lead to flaky behavior in callers that iterate rp.IDs. Prefer preserving region order (e.g., list(self.ID_to_idx) / [obj.label for obj in self._rp]) or explicitly sorting.
| self.IDs = list(self.IDs_set) | |
| self.IDs = list(self.ID_to_idx) |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 39 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Questions:
Is update_rp always called? Also, when modifying unvisited frames?