Skip to content

Commit 518ce37

Browse files
committed
rescuing files for git annex
1 parent a56df09 commit 518ce37

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

.gitignore

100644100755
File mode changed.

heudiconv/queue.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
/annex/objects/SHA256E-s1164--c0074611d4178ba7bf603159c93e65f7ee7aa7c2c339a30098a9cd7e20db4547.py
1+
import os
2+
import os.path as op
3+
4+
import logging
5+
6+
lgr = logging.getLogger(__name__)
7+
8+
# start with SLURM but extend past that #TODO
9+
def queue_conversion(progname, queue, outdir, heuristic, dicoms, sid,
10+
anon_cmd, converter, session,with_prov, bids):
11+
12+
# Rework this...
13+
convertcmd = ' '.join(['python', progname,
14+
'-o', outdir,
15+
'-f', heuristic,
16+
'-s', sid,
17+
'--anon-cmd', anon_cmd,
18+
'-c', converter])
19+
if session:
20+
convertcmd += " --ses '%s'" % session
21+
if with_prov:
22+
convertcmd += " --with-prov"
23+
if bids:
24+
convertcmd += " --bids"
25+
if dicoms:
26+
convertcmd += " --files"
27+
convertcmd += [" '%s'" % f for f in dicoms]
28+
29+
script_file = 'dicom-%s.sh' % sid
30+
with open(script_file, 'wt') as fp:
31+
fp.writelines(['#!/bin/bash\n', convertcmd])
32+
outcmd = 'sbatch -J dicom-%s -p %s -N1 -c2 --mem=20G %s' \
33+
% (sid, queue, script_file)
34+
35+
os.system(outcmd)

heudiconv/tests/anonymize_script.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
/annex/objects/SHA256E-s305--d13f986ddc4e3ba2a9fdea076834eb9861cddd365380d5675ebdf1177281f352.py
1+
#! /usr/bin/env python
2+
3+
import sys
4+
import re
5+
import ctypes
6+
7+
8+
def bids_id_(sid):
9+
parsed_id = re.compile(r"^(?:sub-|)(.+)$").search(sid).group(1)
10+
return str(ctypes.c_size_t(hash(parsed_id)).value)
11+
12+
13+
def main():
14+
sid = sys.argv[1]
15+
return bids_id_(sid)
16+
17+
18+
if __name__ == '__main__':
19+
main()

0 commit comments

Comments
 (0)