Skip to content

Commit d530b01

Browse files
committed
added subproces string decoding for anonymization use
Three changes related to the anonymization use case. 1 - The bytes literal string returned by subprocess.check_output is decoded to utf-8. 2 - Many anonymization use cases are likely to involve parsing tabular files with a python script, for which pandas is a common strategy. Including it in the docker file of the vanilla build saves people from needing to roll their own. 3 - The user info in the .heudiconv directory is not anonymized if an anon_sid is present.
1 parent 53dbf71 commit d530b01

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
9494
'traits>=4.6.0' \
9595
'scipy' \
9696
'numpy' \
97+
'pandas' \
9798
'nomkl' \
9899
&& sync && conda clean -tipsy && sync \
99100
&& bash -c "source activate base \

heudiconv/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
100100
anon_outdir = outdir
101101

102102
# Generate heudiconv info folder
103-
idir = op.join(outdir, '.heudiconv', sid)
103+
idir = op.join(outdir, '.heudiconv', anon_sid)
104104
if bids and ses:
105105
idir = op.join(idir, 'ses-%s' % str(ses))
106106
if anon_outdir == outdir:

heudiconv/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def dec(obj):
105105
def anonymize_sid(sid, anon_sid_cmd):
106106
from subprocess import check_output
107107
cmd = [anon_sid_cmd, sid]
108-
return check_output(cmd).strip()
108+
return check_output(cmd).decode().strip()
109109

110110

111111
def create_file_if_missing(filename, content):

0 commit comments

Comments
 (0)