-
Notifications
You must be signed in to change notification settings - Fork 60
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
Module streamline operations #736
Module streamline operations #736
Conversation
Build passed ! Good Job 🍻 ! |
I like the new organization and I see that all tests are still passing (and I believe all modified scripts were covered). Since this PR is just about moving around things I think the really important PR is the next one where the functions are tested, there is not much to comment on since I agree with the structure and you "only" moved code. Thank you, it look great! |
Thanks! I just added a small change, good to go for 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.
Minor comment, everything else is perfect ! Very nice work
Build Failed 💥 |
ef59d02
to
5f8db35
Compare
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.
One small comment otherwise LGTM
@@ -123,7 +126,7 @@ def _extract_and_save_tails_heads_from_endpoints(gt_endpoints, out_dir): | |||
affine = mask_img.affine | |||
dimensions = mask.shape | |||
|
|||
head, tail = split_heads_tails_kmeans(mask) | |||
head, tail = split_mask_blobs_kmeans(mask, nb_clusters=2) |
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 the extra parameter ? Does it change the behaviour of the function ?
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.
No. I just moved the function to image.utils because it only takes a mask as parameter, no tractogram. So it felt weird to keep it named split_head_tail. It could split any mask into two blobs. And why not into K blobs, if eventually anyone needs it. So it went from:
Tractanalysis.tools:
X = np.argwhere(data)
k_means = KMeans(n_clusters=2).fit(X)
mask_1 = np.zeros(data.shape)
mask_2 = np.zeros(data.shape)
mask_1[tuple(X[np.where(k_means.labels_ == 0)].T)] = 1
mask_2[tuple(X[np.where(k_means.labels_ == 1)].T)] = 1
To
image.utils:
X = np.argwhere(data)
k_means = KMeans(n_clusters=nb_clusters).fit(X)
masks = []
for i in range(nb_clusters):
mask_i = np.zeros(data.shape)
mask_i[tuple(X[np.where(k_means.labels_ == i)].T)] = 1
masks.append(mask_i)
return masks
But I forgot to change the doctstring. Doing it now, thanks.
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.
LGTM
Next step in preparing tests for scilpy: module streamline operations.
Absolutely no line of code was changed here: only moved stuff around, clarifying the folder separations.
Now the 'streamline operation' scripts that we had identified in our previous meeting (@frheault, @AntoineTheb , @AlexVCaron) only import stuff from operation modules, nothing from tractanalysis. They will be ready for tests in a next PR.