Skip to content

Commit d55a553

Browse files
authored
Merge pull request #396 from tsalo/ref/fix-typos
[REF] Fix miscellaneous typos in ReproIn heuristic file
2 parents 5330f55 + 07e12d2 commit d55a553

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

heudiconv/heuristics/reproin.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
import logging
127127
lgr = logging.getLogger('heudiconv')
128128

129-
# Terminology to hamornise and use to name variables etc
129+
# Terminology to harmonise and use to name variables etc
130130
# experiment
131131
# subject
132132
# [session]
@@ -170,9 +170,9 @@
170170
# QA
171171
'43b67d9139e8c7274578b7451ab21123':
172172
[
173-
#('anat-scout.*', 'anat-scout_ses-{date}'),
173+
# ('anat-scout.*', 'anat-scout_ses-{date}'),
174174
# do not change it so we retain _ses-{date}
175-
#('anat-scout.*', 'anat-scout'),
175+
# ('anat-scout.*', 'anat-scout'),
176176
('BOLD_p2_s4_3\.5mm', 'func_task-rest_acq-p2-s4-3.5mm'),
177177
('BOLD_p2_s4', 'func_task-rest_acq-p2-s4'),
178178
('BOLD_p2_noprescannormalize', 'func-bold_task-rest_acq-p2noprescannormalize'),
@@ -254,22 +254,22 @@
254254
[
255255
('fmap_acq-discorr-dti-', 'fmap_acq-dwi_dir-'),
256256
],
257-
#'022969bfde39c2940c114edf1db3fabc':
257+
# '022969bfde39c2940c114edf1db3fabc':
258258
# [ # should be applied only for ses-03!
259259
# ('_acq-MPRAGE_ses-02', '_acq-MPRAGE_ses-03'),
260260
# ],
261261
# to be used only once for one interrupted accession but we cannot
262262
# fix per accession yet
263263
# '23763823d2b9b4b09dafcadc8e8edf21':
264264
# [
265-
# ('anat-T1w_acq-MPRAGE', 'anat-T1w_acq-MPRAGE_run-06'),
265+
# ('anat-T1w_acq-MPRAGE', 'anat-T1w_acq-MPRAGE_run-06'),
266266
# ('anat_T2w', 'anat_T2w_run-06'),
267267
# ('fmap_acq-3mm', 'fmap_acq-3mm_run-06'),
268268
# ],
269269
}
270270
# there was also screw up in the locator specification
271271
# so we need to fix in both
272-
#protocols2fix['67ae5e641ea9d487b6fdf56fb91aeb93'] = protocols2fix['022969bfde39c2940c114edf1db3fabc']
272+
# protocols2fix['67ae5e641ea9d487b6fdf56fb91aeb93'] = protocols2fix['022969bfde39c2940c114edf1db3fabc']
273273

274274
# list containing StudyInstanceUID to skip -- hopefully doesn't happen too often
275275
dicoms2skip = [
@@ -279,8 +279,8 @@
279279

280280
DEFAULT_FIELDS = {
281281
# Let it just be in each json file extracted
282-
#'Manufacturer': "Siemens",
283-
#'ManufacturersModelName': "Prisma",
282+
# 'Manufacturer': "Siemens",
283+
# 'ManufacturersModelName': "Prisma",
284284
"Acknowledgements":
285285
"We thank Terry Sacket and the rest of the DBIC (Dartmouth Brain Imaging "
286286
"Center) personnel for assistance in data collection, and "
@@ -360,11 +360,13 @@ def md5sum(string):
360360
m = hashlib.md5(string.encode())
361361
return m.hexdigest()
362362

363+
363364
def get_study_description(seqinfo):
364365
# Centralized so we could fix/override
365366
v = get_unique(seqinfo, 'study_description')
366367
return v
367368

369+
368370
def get_study_hash(seqinfo):
369371
# XXX: ad hoc hack
370372
return md5sum(get_study_description(seqinfo))
@@ -427,8 +429,8 @@ def fix_seqinfo(seqinfo):
427429

428430
def ls(study_session, seqinfo):
429431
"""Additional ls output for a seqinfo"""
430-
#assert len(sequences) <= 1 # expecting only a single study here
431-
#seqinfo = sequences.keys()[0]
432+
# assert len(sequences) <= 1 # expecting only a single study here
433+
# seqinfo = sequences.keys()[0]
432434
return ' study hash: %s' % get_study_hash(seqinfo)
433435

434436

@@ -440,15 +442,14 @@ def infotodict(seqinfo):
440442
441443
allowed template fields - follow python string module:
442444
443-
item: index within category
444-
subject: participant id
445+
item: index within category
446+
subject: participant id
445447
seqitem: run number during scanning
446448
subindex: sub index within group
447449
session: scan index for longitudinal acq
448450
"""
449451
seqinfo = fix_seqinfo(seqinfo)
450452
lgr.info("Processing %d seqinfo entries", len(seqinfo))
451-
and_dicom = ('dicom', 'nii.gz')
452453

453454
info = OrderedDict()
454455
skipped, skipped_unknown = [], []
@@ -471,7 +472,7 @@ def infotodict(seqinfo):
471472

472473
template = None
473474
suffix = ''
474-
seq = []
475+
# seq = []
475476

476477
# figure out type of image from s.image_info -- just for checking ATM
477478
# since we primarily rely on encoded in the protocol name information
@@ -552,11 +553,11 @@ def infotodict(seqinfo):
552553
raise ValueError("Do not know image data type yet to make decision")
553554
seqtype_label = {
554555
# might want explicit {file_index} ?
555-
# _epi for pipolar fieldmaps, see
556+
# _epi for pepolar fieldmaps, see
556557
# https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/01-magnetic-resonance-imaging-data.html#case-4-multiple-phase-encoded-directions-pepolar
557558
'M': 'epi' if 'dir' in series_info else 'magnitude',
558559
'P': 'phasediff',
559-
'DIFFUSION': 'epi', # according to KODI those DWI are the EPIs we need
560+
'DIFFUSION': 'epi', # according to KODI those DWI are the EPIs we need
560561
}[dcm_image_iod_spec]
561562

562563
# label for dwi as well
@@ -634,7 +635,7 @@ def from_series_info(name):
634635
run_label,
635636
seqtype_label,
636637
]
637-
# filter tose which are None, and join with _
638+
# filter those which are None, and join with _
638639
suffix = '_'.join(filter(bool, suffix_parts))
639640

640641
# # .series_description in case of
@@ -736,9 +737,9 @@ def get_unique(seqinfos, attr):
736737
return values.pop()
737738

738739

739-
# TODO: might need to do groupping per each session and return here multiple
740+
# TODO: might need to do grouping per each session and return here multiple
740741
# hits, or may be we could just somehow demarkate that it will be multisession
741-
# one and so then later value parsed (again) in infotodict would be used???
742+
# one and so then later value parsed (again) in infotodict would be used???
742743
def infotoids(seqinfos, outdir):
743744
# decide on subjid and session based on patient_id
744745
lgr.info("Processing sequence infos to deduce study/session")
@@ -788,7 +789,7 @@ def infotoids(seqinfos, outdir):
788789
# although we might want an explicit '=' to note the same session as
789790
# mentioned before?
790791
if len(nonsign_vals) > 1:
791-
lgr.warning( #raise NotImplementedError(
792+
lgr.warning( # raise NotImplementedError(
792793
"Cannot deal with multiple sessions in the same study yet!"
793794
" We will process until the end of the first session"
794795
)
@@ -810,7 +811,7 @@ def infotoids(seqinfos, outdir):
810811
# ... actually the same as with nonsign_vals, we just would need to figure
811812
# out initial one if sign ones, and should make use of knowing
812813
# outdir
813-
#raise NotImplementedError()
814+
# raise NotImplementedError()
814815
# we need to look at what sessions we already have
815816
sessions_dir = os.path.join(outdir, locator, 'sub-' + subject)
816817
prior_sessions = sorted(glob(os.path.join(sessions_dir, 'ses-*')))
@@ -828,7 +829,6 @@ def infotoids(seqinfos, outdir):
828829
else:
829830
session = '001'
830831

831-
832832
if study_description_hash == '9d148e2a05f782273f6343507733309d':
833833
session = 'siemens1'
834834
lgr.info('Imposing session {0}'.format(session))
@@ -865,7 +865,7 @@ def parse_series_spec(series_spec):
865865
# https://github.com/ReproNim/reproin/issues/14
866866
# where PU: prefix is added by the scanner
867867
series_spec = re.sub("^[A-Z]*:", "", series_spec)
868-
series_spec = re.sub("^WIP ", "", series_spec) # remove Philips WIP prefix
868+
series_spec = re.sub("^WIP ", "", series_spec) # remove Philips WIP prefix
869869

870870
# Remove possible suffix we don't care about after __
871871
series_spec = series_spec.split('__', 1)[0]

0 commit comments

Comments
 (0)