Skip to content

Commit 8b63fef

Browse files
committed
sty: cleaner imports
1 parent d8a4e55 commit 8b63fef

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

heudiconv/bids.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@
1414
import dcmstack as ds
1515

1616
from .parser import find_files
17-
from .utils import (load_json, save_json, create_file_if_missing,
18-
json_dumps_pretty, set_readonly, is_readonly)
17+
from .utils import (
18+
load_json,
19+
save_json,
20+
create_file_if_missing,
21+
json_dumps_pretty,
22+
set_readonly,
23+
is_readonly,
24+
)
1925

2026
lgr = logging.getLogger(__name__)
2127

heudiconv/cli/run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from .. import __version__, __packagename__
77
from ..parser import get_study_sessions
8-
from ..utils import (load_heuristic, anonymize_sid, treat_infofile, SeqInfo)
8+
from ..utils import load_heuristic, anonymize_sid, treat_infofile, SeqInfo
99
from ..convert import prep_conversion
1010

1111
import inspect
@@ -201,7 +201,8 @@ def process_args(args):
201201
#
202202
# Load heuristic -- better do it asap to make sure it loads correctly
203203
#
204-
heuristic = load_heuristic(op.realpath(args.heuristic_file))
204+
heuristic = (load_heuristic(op.realpath(args.heuristic_file))
205+
if args.heuristic_file else gen_heuristic)
205206

206207
study_sessions = get_study_sessions(args.dicom_dir_template, args.files,
207208
heuristic, outdir, args.session,

heudiconv/convert.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,30 @@
33
import logging
44
import shutil
55

6-
from .utils import (read_config, load_json, save_json, write_config, TempDirs,
7-
safe_copyfile, treat_infofile, set_readonly,
8-
clear_temp_dicoms)
9-
from .bids import (convert_sid_bids, populate_bids_templates, save_scans_key,
10-
tuneup_bids_json_files, add_participant_record)
11-
from .dicoms import (group_dicoms_into_seqinfos, embed_metadata_from_dicoms,
12-
compress_dicoms)
6+
from .utils import (
7+
read_config,
8+
load_json,
9+
save_json,
10+
write_config,
11+
TempDirs,
12+
safe_copyfile,
13+
treat_infofile,
14+
set_readonly,
15+
clear_temp_dicoms,
16+
seqinfo_fields,
17+
)
18+
from .bids import (
19+
convert_sid_bids,
20+
populate_bids_templates,
21+
save_scans_key,
22+
tuneup_bids_json_files,
23+
add_participant_record,
24+
)
25+
from .dicoms import (
26+
group_dicoms_into_seqinfos,
27+
embed_metadata_from_dicoms,
28+
compress_dicoms
29+
)
1330

1431
lgr = logging.getLogger(__name__)
1532

@@ -115,6 +132,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
115132
filegroup = {si.series_id: x for si, x in seqinfo.items()}
116133
dicominfo_file = op.join(idir, 'dicominfo%s.tsv' % ses_suffix)
117134
with open(dicominfo_file, 'wt') as fp:
135+
fp.write('\t'.join([val for val in seqinfo_fields]) + '\n')
118136
for seq in seqinfo_list:
119137
fp.write('\t'.join([str(val) for val in seq]) + '\n')
120138
lgr.debug("Calling out to %s.infodict", heuristic)

heudiconv/external/dlad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os.path as op
33
import logging
44

5-
from ..utils import (create_file_if_missing, mark_sensitive)
5+
from ..utils import create_file_if_missing, mark_sensitive
66

77
lgr = logging.getLogger(__name__)
88

heudiconv/parser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@
1010
from tempfile import mkdtemp
1111

1212
from .dicoms import group_dicoms_into_seqinfos
13-
from .utils import (docstring_parameter, StudySessionInfo, load_json,
14-
save_json, create_file_if_missing, json_dumps_pretty)
13+
from .utils import (
14+
docstring_parameter,
15+
StudySessionInfo,
16+
load_json,
17+
save_json,
18+
create_file_if_missing,
19+
json_dumps_pretty,
20+
)
1521

1622
lgr = logging.getLogger(__name__)
1723

0 commit comments

Comments
 (0)