Skip to content

Commit

Permalink
workaround for mixed sparsity/full probmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Petre committed Jan 25, 2024
1 parent 4233852 commit 3288267
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CanlabCore/@atlas/merge_atlases.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@
end

% concatenating sparse matrices first is much faster than converting to full and the
% concatenating full matrices
% concatenating full matrices so instead of doing a double conversion
% and concatenating, try concatenating sparse matricies if either of
% them are sparse and then converting to full
%atlas_obj.probability_maps = [full(atlas_obj.probability_maps) full(atlas_obj_to_add.probability_maps)];
if issparse(atlas_obj.probability_maps) || issparse(atlas_obj_to_add.probability_maps)
atlas_obj.probability_maps = sparse(double(atlas_obj.probability_maps));
atlas_obj_to_add.probability_maps = sparse(double(atlas_obj_to_add.probability_maps));
end
atlas_obj.probability_maps = full([atlas_obj.probability_maps atlas_obj_to_add.probability_maps]);

atlas_obj = probability_maps_to_region_index(atlas_obj);
Expand Down

0 comments on commit 3288267

Please sign in to comment.