If two atlas being merged contain an overlapping set of regions, the merged atlas contains double copies of this region.
Toy example that reproduces the bug:
atlas_obj = load_atlas('canlab2018_2mm');
amy = select_atlas_subset(atlas_obj, {'Amy'})
double_amy = merge_atlases(amy, amy)
% check result
double_amy.labels
ans =
1×8 cell array
{'Amygdala_CM_'} {'Amygdala_SF_'} {'Amygdala_AStr_'} {'Amygdala_LB_'} {'Amygdala_CM_'} {'Amygdala_SF_'} {'Amygdala_AStr_'} {'Amygdala_LB_'}
The 'always_replace' and the 'noreplace' options to merge_atlases do not address this.
I hesitate to try and fix because there already seems to be a complex logic regarding the 'always_replace' and the 'noreplace' options, and I am unsure how this would intersect with the issue reported here.
If two atlas being merged contain an overlapping set of regions, the merged atlas contains double copies of this region.
Toy example that reproduces the bug:
The 'always_replace' and the 'noreplace' options to
merge_atlasesdo not address this.I hesitate to try and fix because there already seems to be a complex logic regarding the 'always_replace' and the 'noreplace' options, and I am unsure how this would intersect with the issue reported here.