Skip to content

Commit 189d0a9

Browse files
committed
BF: use save_json, not adhoc call to json.dump
1 parent 8935e25 commit 189d0a9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

heudiconv/dicoms.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
import tarfile
77

88
from .external.pydicom import dcm
9-
from .utils import load_json, get_typed_attr, set_readonly, SeqInfo
9+
from .utils import (
10+
get_typed_attr,
11+
load_json,
12+
save_json,
13+
SeqInfo,
14+
set_readonly,
15+
)
1016

1117
import warnings
1218
with warnings.catch_warnings():
@@ -410,6 +416,7 @@ def embed_dicom_and_nifti_metadata(dcmfiles, niftifile, infofile, bids_info):
410416
import os.path as op
411417
import json
412418
import re
419+
from heudiconv.utils import save_json
413420

414421
from heudiconv.external.dcmstack import ds
415422
stack = ds.parse_and_stack(dcmfiles, force=True).values()
@@ -440,8 +447,7 @@ def embed_dicom_and_nifti_metadata(dcmfiles, niftifile, infofile, bids_info):
440447
meta_info.update(bids_info)
441448

442449
# write to outfile
443-
with open(infofile, 'wt') as fp:
444-
json.dump(meta_info, fp, indent=3, sort_keys=True)
450+
save_json(infofile, meta_info)
445451

446452

447453
def embed_metadata_from_dicoms(bids_options, item_dicoms, outname, outname_bids,

0 commit comments

Comments
 (0)