Skip to content

tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed#2257

Merged
dchristiaens merged 2 commits intoMRtrix3:masterfrom
sertopexamgio:fix_tckglobal_particle_removal
Jan 13, 2021
Merged

tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed#2257
dchristiaens merged 2 commits intoMRtrix3:masterfrom
sertopexamgio:fix_tckglobal_particle_removal

Conversation

@sertopexamgio
Copy link
Contributor

@sertopexamgio sertopexamgio commented Jan 12, 2021

I observed particles inside a voxel getting duplicated after the ParticleGrid::remove and ParticleGrid::shift. After some digging, the reason seem to be the erase-delete-idiom. After these changes, no duplicates of particles were observed and removal of shifting seems to work as expected.

sertopexamgio and others added 2 commits January 12, 2021 23:34
Rebase to latest master
Use erase-remove idiom, otherwise particles will be duplicated instead of removed.
@sertopexamgio sertopexamgio changed the title tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed. tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed Jan 12, 2021
@sertopexamgio sertopexamgio changed the title tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed label:bug Jan 12, 2021
@sertopexamgio sertopexamgio changed the title tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed label:bug tckglobal: Fix bug that caused particles in a voxel to be duplicated when tried to be removed Jan 12, 2021
@jdtournier jdtournier added the bug label Jan 13, 2021
@jdtournier jdtournier added this to the 3.0.3 hotfix milestone Jan 13, 2021
Copy link
Member

@dchristiaens dchristiaens left a comment

Choose a reason for hiding this comment

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

Very good catch, and thanks for contributing!

This is clearly a bug, which I seem to have introduced 4 years ago. I tested your fix and it works exactly as it should.

@dchristiaens dchristiaens merged commit 14423cf into MRtrix3:master Jan 13, 2021
@sertopexamgio sertopexamgio deleted the fix_tckglobal_particle_removal branch January 13, 2021 16:42
@Lestropie Lestropie modified the milestones: 3.0.4 hotfix, 3.0.3 hotfix May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants