-
Notifications
You must be signed in to change notification settings - Fork 62
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
Modifications in the (bitbucket) tracking scripts - part 2 #511
Modifications in the (bitbucket) tracking scripts - part 2 #511
Conversation
Hello @EmmaRenauld, Thank you for updating !
Comment last updated at 2021-12-20 18:27:16 UTC |
Build passed ! Good Job 🍻 ! |
21bfea0
to
3b56c38
Compare
Build passed ! Good Job 🍻 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Some comments!
scilpy/tracking/local_tracking.py
Outdated
|
||
pool = multiprocessing.Pool(nbr_processes, | ||
initializer=_init_sub_process, | ||
np.save(data_file_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we simply pass the dataset in arguments to all threads? memory limitations? The whole mmap_mode
thingy is quite mysterious to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too... I've left some #toDo for this, thinking we could deal with that later but if someone tells me what to do I can change it.
scilpy/tracking/local_tracking.py
Outdated
global data_file_info | ||
|
||
# args[0] is the Tracker. | ||
self.propagator.tracking_field.dataset.data = np.load( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset
is reloaded inside every thread anyway so I don't understand why it is not passed as an argument.
Build Failed 💥 |
4cabe7c
to
478373f
Compare
Build Failed 💥 |
Build Failed 💥 |
478373f
to
5878dad
Compare
Build passed ! Good Job 🍻 ! |
1 similar comment
Build passed ! Good Job 🍻 ! |
02a1e84
to
084947c
Compare
Build passed ! Good Job 🍻 ! |
2 similar comments
Build passed ! Good Job 🍻 ! |
Build passed ! Good Job 🍻 ! |
084947c
to
8003c44
Compare
Build passed ! Good Job 🍻 ! |
1 similar comment
Build passed ! Good Job 🍻 ! |
f3065be
to
d71ec83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my last comments.
scilpy/image/datasets.py
Outdated
@@ -84,7 +85,7 @@ def is_voxel_in_bound(self, i, j, k): | |||
return (0 <= i < self.dim[0] and 0 <= j < self.dim[1] and | |||
0 <= k < self.dim[2]) | |||
|
|||
def get_voxel_at_position(self, x, y, z): | |||
def voxmm_to_idx(self, x, y, z, origin='center'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the new origin
argument useful? Why would we need this kind of flexibility? Could we not just set it to one or the other and take it into account when writing our tracking scripts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That dataset is not necessarily only associated with our traking script, though. It could eventually be used elsewhere, so I tought it was better to be thorough, like in the sft. But I won't object if others agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ok. But in this case we need to be extra careful when writing our tracking scripts, because the SeedGenerator
always returns positions with origin corner
. Should the SeedGenerator
have an origin
argument too then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added one. For now it is not used-defined (self.origin='corner') but at least a bit more obvious?
Build passed ! Good Job 🍻 ! |
Maybe we can wait for a specific situation where this refactoring is needed and do it if and when we need it, so that the new design really suits our requirements. Also I think deterministic tracking with DTI would work, because peaks are extracted on the whole sphere before selecting the direction inside a cone (if I'm not mistaken). |
Well I actually need now to decide if I will try to force dwi_ml to fit with all this or not. In our case, the tracking_field gets the inputs at current position and runs it through the model. The output from the model is not necessarily a list of directions. It could be, ex, a learned tensor, which is the same as my DTI example above. But right now, I can still use scilpy's propagator. It's just that my "tracking_field.get_possible_next_directions" actually returns the tensor, and the propagator _sample_next_direction samples from that tensor, and I will add theta back later as a stopping critera. |
7b44376
to
1f3dd74
Compare
Will I think it would be better to keep the PR as is and merge it before making new changes, cause this is already a nice refactor that could benefit others right away. Also shouldn't there be a test for the new script? |
Build passed ! Good Job 🍻 ! |
1f3dd74
to
8db4416
Compare
Build passed ! Good Job 🍻 ! |
2 similar comments
Build passed ! Good Job 🍻 ! |
Build passed ! Good Job 🍻 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still crashing when I run:
scil_compute_local_tracking_dev.py sub-197348__fodf.nii.gz seeds_fa015.nii.gz seeds_fa015.nii.gz test.trk --processes 8
Data to test:
https://www.dropbox.com/s/a4s8gvkbro4pqz3/PR_511.zip?dl=0
8db4416
to
dd8c66b
Compare
Sorry @mdesco Tested and retested with your data and mine, verified origin everywhere. |
Build passed ! Good Job 🍻 ! |
Build passed ! Good Job 🍻 ! |
@EmmaRenauld @GuillaumeTh
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright nice!
I will open a PR in the future to clarify the DataVolume
, SeedGenerator
coordinate system extravaganza.
Build passed ! Good Job 🍻 ! |
1 similar comment
Build passed ! Good Job 🍻 ! |
Bigger changes:
https://docs.google.com/presentation/d/1mvvBYjKZ-IVmkl1EYWBTQ_8T8H0R3_Y-/edit?usp=sharing&ouid=101323301275554058305&rtpof=true&sd=true
Smaller changes: