@@ -122,13 +122,21 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
122
122
# detected
123
123
# ref: https://github.com/nipy/heudiconv/issues/84#issuecomment-330048609
124
124
# for more automagical wishes
125
- target_heuristic_filename = op .join (idir , op .basename (heuristic .filename ))
125
+ target_heuristic_filename = op .join (idir , 'heuristic.py' )
126
+ # faciliates change - TODO: remove in 1.0
127
+ old_heuristic_filename = op .join (idir , op .basename (heuristic .filename ))
128
+ if op .exists (old_heuristic_filename ):
129
+ assure_no_file_exists (target_heuristic_filename )
130
+ safe_copyfile (old_heuristic_filename , target_heuristic_filename )
131
+ assure_no_file_exists (old_heuristic_filename )
126
132
# TODO:
127
133
# 1. add a test
128
134
# 2. possibly extract into a dedicated function for easier logic flow here
129
135
# and a dedicated unittest
130
- if (op .exists (target_heuristic_filename ) and
131
- file_md5sum (target_heuristic_filename ) != file_md5sum (heuristic .filename )):
136
+ if (
137
+ op .exists (target_heuristic_filename ) and
138
+ file_md5sum (target_heuristic_filename ) != file_md5sum (heuristic .filename )
139
+ ):
132
140
# remake conversion table
133
141
reuse_conversion_table = False
134
142
lgr .info (
@@ -151,7 +159,7 @@ def prep_conversion(sid, dicoms, outdir, heuristic, converter, anon_sid,
151
159
# TODO -- might have been done outside already!
152
160
# MG -- will have to try with both dicom template, files
153
161
assure_no_file_exists (target_heuristic_filename )
154
- safe_copyfile (heuristic .filename , idir )
162
+ safe_copyfile (heuristic .filename , target_heuristic_filename )
155
163
if dicoms :
156
164
seqinfo = group_dicoms_into_seqinfos (
157
165
dicoms ,
0 commit comments