-
Notifications
You must be signed in to change notification settings - Fork 9
[ENH] add min/max len #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -74,7 +74,7 @@ def __init__( | |||||||||||||||||||
| Maximum angle (in radians) between steps | ||||||||||||||||||||
| default: radians(60) | ||||||||||||||||||||
| step_size : float, optional | ||||||||||||||||||||
| Step size for tracking | ||||||||||||||||||||
| Step size for tracking, in voxels | ||||||||||||||||||||
| default: 0.5 | ||||||||||||||||||||
| relative_peak_thresh : float, optional | ||||||||||||||||||||
| Relative peak threshold for direction selection | ||||||||||||||||||||
|
|
@@ -235,7 +235,7 @@ def _divide_chunks(self, seeds): | |||||||||||||||||||
| nchunks = (seeds.shape[0] + global_chunk_sz - 1) // global_chunk_sz | ||||||||||||||||||||
| return global_chunk_sz, nchunks | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def generate_sft(self, seeds, ref_img): | ||||||||||||||||||||
| def generate_sft(self, seeds, ref_img, minlen=0, maxlen=np.inf): | ||||||||||||||||||||
| global_chunk_sz, nchunks = self._divide_chunks(seeds) | ||||||||||||||||||||
| buffer_size = 0 | ||||||||||||||||||||
|
36000 marked this conversation as resolved.
Outdated
|
||||||||||||||||||||
| generators = [] | ||||||||||||||||||||
|
|
@@ -246,7 +246,8 @@ def generate_sft(self, seeds, ref_img): | |||||||||||||||||||
| seeds[idx * global_chunk_sz : (idx + 1) * global_chunk_sz] | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| buffer_size += self.seed_propagator.get_buffer_size() | ||||||||||||||||||||
| generators.append(self.seed_propagator.as_generator()) | ||||||||||||||||||||
| generators.append(self.seed_propagator.as_generator( | ||||||||||||||||||||
| minlen=minlen, maxlen=maxlen)) | ||||||||||||||||||||
| pbar.update( | ||||||||||||||||||||
| seeds[idx * global_chunk_sz : (idx + 1) * global_chunk_sz].shape[0] | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
|
@@ -255,12 +256,12 @@ def generate_sft(self, seeds, ref_img): | |||||||||||||||||||
| ) | ||||||||||||||||||||
|
36000 marked this conversation as resolved.
|
||||||||||||||||||||
| return StatefulTractogram(array_sequence, ref_img, Space.VOX) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| def generate_trx(self, seeds, ref_img): | ||||||||||||||||||||
| def generate_trx(self, seeds, ref_img, minlen=0, maxlen=np.inf): | ||||||||||||||||||||
| global_chunk_sz, nchunks = self._divide_chunks(seeds) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Will resize by a factor of 2 if these are exceeded | ||||||||||||||||||||
| sl_len_guess = 100 | ||||||||||||||||||||
|
||||||||||||||||||||
| sl_len_guess = 100 | |
| sl_len_guess = 100 | |
| # Heuristic: initial guess of how many streamlines we get per seed. | |
| # With the current min/max length filtering in the GPU propagator we | |
| # typically obtain fewer valid streamlines per seed than before, so | |
| # we lower the guess from 4 to 2 to avoid over-allocating memory. | |
| # If the filtering or seeding strategy changes (e.g. more accepted | |
| # streamlines per seed), this value should be re-evaluated to balance | |
| # memory usage against the cost of TRX internal resizes. |
Uh oh!
There was an error while loading. Please reload this page.