Skip to content

Commit ee5bda2

Browse files
authored
Merge pull request #819 from UNFmontreal/fix/sbref_bvalvecs
remove bval bvecs files generated for SBRef on XA60/CMRR/dcm2niix
2 parents 2a15cdf + f349ed2 commit ee5bda2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

heudiconv/convert.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ class PopulateIntendedForOpts(TypedDict, total=False):
6161

6262

6363
LOCKFILE = "heudiconv.lock"
64-
DW_IMAGE_IN_FMAP_FOLDER_WARNING = (
65-
"Diffusion-weighted image saved in non dwi folder ({folder})"
66-
)
64+
DW_IMAGE_WRONG_SUFFIX_WARNING = "Diffusion-weighted image saved as non dwi ({prefix})"
6765
lgr = logging.getLogger(__name__)
6866

6967

@@ -896,7 +894,7 @@ def save_converted_files(
896894
bvals, bvecs = res.outputs.bvals, res.outputs.bvecs
897895
bvals = list(bvals) if isinstance(bvals, TraitListObject) else bvals
898896
bvecs = list(bvecs) if isinstance(bvecs, TraitListObject) else bvecs
899-
if prefix_dirname.endswith("dwi"):
897+
if prefix.endswith("dwi"):
900898
outname_bvecs, outname_bvals = prefix + ".bvec", prefix + ".bval"
901899
safe_movefile(bvecs, outname_bvecs, overwrite)
902900
safe_movefile(bvals, outname_bvals, overwrite)
@@ -907,9 +905,7 @@ def save_converted_files(
907905
os.remove(ftr)
908906
lgr.debug("%s and %s were removed since not dwi", bvecs, bvals)
909907
else:
910-
lgr.warning(
911-
DW_IMAGE_IN_FMAP_FOLDER_WARNING.format(folder=prefix_dirname)
912-
)
908+
lgr.warning(DW_IMAGE_WRONG_SUFFIX_WARNING.format(prefix=prefix))
913909
lgr.warning(
914910
".bvec and .bval files will be generated. This is NOT BIDS compliant"
915911
)

heudiconv/tests/test_convert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from heudiconv.cli.run import main as runner
1414
import heudiconv.convert
1515
from heudiconv.convert import (
16-
DW_IMAGE_IN_FMAP_FOLDER_WARNING,
16+
DW_IMAGE_WRONG_SUFFIX_WARNING,
1717
bvals_are_zero,
1818
update_complex_name,
1919
update_multiecho_name,
@@ -170,8 +170,8 @@ def test_b0dwi_for_fmap(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> Non
170170

171171
# assert that it raised a warning that the fmap directory will contain
172172
# bvec and bval files.
173-
expected_msg = DW_IMAGE_IN_FMAP_FOLDER_WARNING.format(
174-
folder=op.join(tmp_path, f"sub-{subID}", "fmap")
173+
expected_msg = DW_IMAGE_WRONG_SUFFIX_WARNING.format(
174+
prefix=op.join(tmp_path, f"sub-{subID}", "fmap", f"sub-{subID}_acq-b0dwi_epi")
175175
)
176176
assert any(expected_msg in c.message for c in caplog.records)
177177

0 commit comments

Comments
 (0)