CaImAn icon indicating copy to clipboard operation
CaImAn copied to clipboard

CNMF seems to be merging components despite setting do_merge = False

Open oterocoronel opened this issue 1 year ago • 1 comments

  1. How you installed Caiman (pure conda, conda + compile, colab, ..): conda

When running cnm.fit(images) I have noticed that this gets logged:

[cnmf.py: fit():603] [3681004] merging

I have set do_merge = False and del_duplicates = True (to avoid merging the ROIs in the overlapping strides of the patches). In addition to that, I have noticed that if even if I set do_merge = False the number of ROIs I get vary depending on the value of merge_thr, so I think that many components are being merged together.

In cnmf.py line 603:

logging.info("merging")
self.estimates.merged_ROIs = [0]

And in line 642:

while len(self.estimates.merged_ROIs) > 0:
     self.merge_comps(Yr, mx=np.Inf)

So it seems like merge_comps (which in turn calls merge_components) gets always called regardless of the do_merge parameter. Also, the max_merge_area does not seem to be passed, and in my experience it does not affect the merging even if do_merge = True

Am I missing something? Or is there a reason why some components would need to be merged even if the do_merge flag is set to False?

oterocoronel avatar Apr 11 '23 21:04 oterocoronel