-
Notifications
You must be signed in to change notification settings - Fork 13
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
Misc features #36
Misc features #36
Conversation
…entation threshold and TTA
@@ -193,7 +193,7 @@ def extract_patches( | |||
min_coords[0] : min_coords[0] + 160, | |||
min_coords[1] : min_coords[1] + 160, | |||
min_coords[2] : min_coords[2] + 160, | |||
] | |||
].copy() |
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.
When not adding the "copy", overlapping extracted patches will have the ignore-label padding in each other, because the original array is padded instead of the small patches.
@@ -121,7 +128,7 @@ def convert_single_nrrd_files(labels_dir, corrections_dir, out_dir): | |||
merged_corrections = get_corrections_from_folder( | |||
cur_patch_corrections_folder, os.path.join(labels_dir, label_file) | |||
) | |||
out_file = os.path.join(out_dir, label_file) | |||
out_file = os.path.join(out_dir, token + ".nii.gz") |
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.
If not specifying .nii.gz format, it will take to data format of the inputs (which can also be e.g. .mrc)
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'm not sure I follow. It looks like the output file path is hardcoded to .nii.gz
.
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, exactly. I hard-coded it to nii.gz
s.t. it does not save out e.g. .mrc
files. The input to the training is still nii.gz
. We may want to change that at some point to something more common in Cryo-ET. This change here is to make everything compatible with the current training setup.
@@ -95,3 +109,53 @@ def components( | |||
os.path.splitext(os.path.basename(segmentation_path))[0] + "_components.mrc", | |||
) | |||
store_tomogram(filename=out_file, tomogram=segmentation) | |||
|
|||
|
|||
@cli.command(name="thresholds", no_args_is_help=True) |
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.
This is a separate command for a function that
- takes as input a scoremap produced by MemBrain-seg, together with multiple float values
- thresholds the scoremap at each given float value and stores the resulting segmentation mask
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.
This LGTM! I just have a small minor question below. Please feel free to merge once you've addressed it.
@@ -121,7 +128,7 @@ def convert_single_nrrd_files(labels_dir, corrections_dir, out_dir): | |||
merged_corrections = get_corrections_from_folder( | |||
cur_patch_corrections_folder, os.path.join(labels_dir, label_file) | |||
) | |||
out_file = os.path.join(out_dir, label_file) | |||
out_file = os.path.join(out_dir, token + ".nii.gz") |
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'm not sure I follow. It looks like the output file path is hardcoded to .nii.gz
.
Hi,
I have implemented a couple of potentially useful features from some user requests, and packed it together with some small bug fixes and documentation:
I think most things should be relatively straightforward, but feel free take a look and let me know if you spot anything :)