Repository navigation
Changed workflow for setting the masking value in the skull stripping #171
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
base: main
Are you sure you want to change the base?
Changes from all commits
c5859c4
2395565
776cf77
9a523df
f8c99d0
fcf4b1d
fb51ade
fc7e640
6568378
d94e078
861e8e1
21f13b8
ebd4c42
2770898
6864686
f59426f
4cb15e9
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 |
|---|---|---|
|
|
@@ -21,7 +21,9 @@ | |
|
|
||
| class SynthStripExtractor(BrainExtractor): | ||
|
|
||
| def __init__(self, border: int = 1): | ||
| def __init__( | ||
| self, border: int = 1, masking_value: Optional[Union[int, float]] = None | ||
| ): | ||
|
Comment on lines
+24
to
+26
|
||
| """ | ||
| Brain extraction using SynthStrip with preprocessing conforming to model requirements. | ||
|
|
||
|
|
@@ -31,9 +33,10 @@ def __init__(self, border: int = 1): | |
|
|
||
| Args: | ||
| border (int): Mask border threshold in mm. Defaults to 1. | ||
| """ | ||
| masking_value (Optional[Union[int, float]], optional): global value to be inserted in the masked areas. Default is None which leads to the minimum of each respective image. | ||
|
|
||
| super().__init__() | ||
| """ | ||
| super().__init__(masking_value=masking_value) | ||
| self.border = border | ||
|
|
||
| def _setup_model(self, device: torch.device) -> StripModel: | ||
|
|
@@ -219,8 +222,8 @@ def extract( | |
|
|
||
| # write the masked output | ||
| img_data = image.get_fdata() | ||
| bg = np.min([0, img_data.min()]) | ||
| img_data[mask == 0] = bg | ||
| # actual application of mask through helper function | ||
| img_data = self.inner_apply_mask(img_data, mask) | ||
| Nifti1Image(img_data, image.affine, image.header).to_filename( | ||
| masked_image_path, | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.