@@ -167,20 +167,6 @@ def get_study_sessions(dicom_dir_template, files_opt, heuristic, outdir,
167
167
dcmfilter = getattr (heuristic , 'filter_dicom' , None ),
168
168
grouping = grouping )
169
169
170
- if not getattr (heuristic , 'infotoids' , None ):
171
- lgr .warn ("Heuristic is missing an `infotoids` method, assigning "
172
- "empty method. For best results, define an `infotoids`" )
173
- def infotoids (seqinfos , outdir ):
174
- return {
175
- 'locator' : None ,
176
- 'session' : None ,
177
- 'subject' : None
178
- }
179
- heuristic .infotoids = infotoids
180
- # raise NotImplementedError(
181
- # "For now, if no subj template is provided, requiring "
182
- # "heuristic to have infotoids")
183
-
184
170
if sids :
185
171
if not (len (sids ) == 1 and len (seqinfo_dict ) == 1 ):
186
172
raise RuntimeError (
@@ -193,6 +179,23 @@ def infotoids(seqinfos, outdir):
193
179
else :
194
180
sid = None
195
181
182
+ if not getattr (heuristic , 'infotoids' , None ):
183
+ # allow bypass with subject override
184
+ if not sid :
185
+ raise NotImplementedError ("Cannot guarantee subject id - add "
186
+ "`infotoids` to heuristic file or "
187
+ "provide `--subject` argument" )
188
+ lgr .warn ("Heuristic is missing an `infotoids` method, assigning "
189
+ "empty method and using provided subject id" , sid ,
190
+ "Provide `session` and `locator` fields for best results." )
191
+ def infotoids (seqinfos , outdir ):
192
+ return {
193
+ 'locator' : None ,
194
+ 'session' : None ,
195
+ 'subject' : None
196
+ }
197
+ heuristic .infotoids = infotoids
198
+
196
199
for studyUID , seqinfo in seqinfo_dict .items ():
197
200
# so we have a single study, we need to figure out its
198
201
# locator, session, subject
0 commit comments