NF - Add DirectionGetter for Flocking Tractography#13
NF - Add DirectionGetter for Flocking Tractography#13gabknight wants to merge 1 commit intogabknight:masterfrom
Conversation
|
Based on your review schedule, I'll review this PR if you request it by commenting
|
| return 0 | ||
|
|
||
| cdef class FlockingDirectionGetter(PmfGenDirectionGetter): | ||
| """ |
There was a problem hiding this comment.
Can you add a docstring here, similar to other DG
| """ | ||
|
|
||
| def __init__(self, pmf_gen, max_angle, sphere, pmf_threshold=.1, particle_count = 16, r_min=0.1, r_max=1.0, delta=0.995, alpha=1.0, **kwargs): | ||
| """Direction getter from a pmf generator. |
There was a problem hiding this comment.
Please describe the flocking method here.
| Used to remove direction from the probability mass function for | ||
| selecting the tracking direction. | ||
| particle_count | ||
| Number of particles in a flock |
There was a problem hiding this comment.
missing "." after the sentences
|
|
||
|
|
||
|
|
||
| cdef int get_direction_c(self, double[::1] point, double[::1] direction): |
There was a problem hiding this comment.
This can be removed if you change the class inheritance to ProbabilisticDirectionGetter (like PTT)
| copy_point(&seed[0], point) | ||
|
|
||
| terminate = False | ||
| r_min = self.r_min |
There was a problem hiding this comment.
why re-defining those variable here? use directly self.r_min
| double N, G, r_min, r_max, delta_1, delta_2, alpha, norma_vec | ||
| cnp.float_t[:, :] particles = np.empty((particle_count, 3), dtype=np.float64) | ||
| cnp.float_t[:, :] particles_dir = np.empty((particle_count, 3), dtype=np.float64) | ||
| cnp.float_t[:, :] u_m = np.empty((particle_count, 3), dtype=np.float64) |
There was a problem hiding this comment.
Please use a more explicit variable name here
| cnp.float_t[:, :] particles_dir = np.empty((particle_count, 3), dtype=np.float64) | ||
| cnp.float_t[:, :] u_m = np.empty((particle_count, 3), dtype=np.float64) | ||
| cnp.uint8_t[:] particle_values = np.ones(particle_count, dtype=np.uint8) | ||
| cnp.float_t[:, :] F_m = np.empty((particle_count, 3), dtype=np.float64) |
| continue | ||
| for k in range(particle_count): | ||
| if k != m: | ||
| for j in range(3): |
There was a problem hiding this comment.
Can you document a bit what you are doing here. It is hard to follow. Explicit variable names will help.
| copy_point(&newdir[0], &direction[0]) | ||
| return 0 | ||
|
|
||
| cdef class FlockingDirectionGetter(PmfGenDirectionGetter): |
There was a problem hiding this comment.
Can you move the flockingDG to it own file, like for PTT?
Description by Korbit AI
What change is being made?
Add the
FlockingDirectionGetterclass to enable flocking tractography in the DIPY library.Why are these changes being made?
This change introduces a new direction getter based on flocking behavior for fiber tracking in diffusion imaging data, allowing for more realistic simulation of particle interactions during tracking. The flocking mechanism is implemented to enhance direction finding capabilities by incorporating parameters like particle count and attraction weights, adding to the existing probabilistic models in the library.