Skip to content
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

Fix mask output filename issues when '.nii.gz' is not included in out_fname #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion HD_BET/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def run_hd_bet(mri_fnames, output_fnames, mode="accurate", config_file=os.path.j
params.append(torch.load(p, map_location=lambda storage, loc: storage))

for in_fname, out_fname in zip(mri_fnames, output_fnames):
mask_fname = out_fname[:-7] + "_mask.nii.gz"
# mask_fname = out_fname[:-7] + "_mask.nii.gz" # If user doesn't include '.nii.gz' ext, this will cause issues
mask_fname = out_fname.replace('.nii.gz','') + '_mask.nii.gz' # this should work even if out_fname doesn't include .nii.gz ext
if overwrite or (not (os.path.isfile(mask_fname) and keep_mask) or not os.path.isfile(out_fname)):
print("File:", in_fname)
print("preprocessing...")
Expand Down