@@ -249,57 +249,6 @@ def init_infant_brain_extraction_wf(
249
249
return workflow
250
250
251
251
252
- def init_precomputed_mask_wf (
253
- bspline_fitting_distance = 200 , omp_nthreads = None , name = "precomputed_mask_wf"
254
- ):
255
- from nipype .interfaces .ants import N4BiasFieldCorrection
256
- from niworkflows .interfaces .header import CopyXForm , ValidateImage
257
- from niworkflows .interfaces .nibabel import ApplyMask , IntensityClip
258
-
259
- workflow = pe .Workflow (name = name )
260
- inputnode = pe .Node (niu .IdentityInterface (fields = ["t1w" , "t1w_mask" ]), name = "inputnode" )
261
- outputnode = pe .Node (
262
- niu .IdentityInterface (fields = ["t1w_preproc" , "t1w_mask" , "t1w_brain" ]),
263
- name = "outputnode" ,
264
- )
265
-
266
- validate_mask = pe .Node (ValidateImage (), name = "validate_mask" )
267
- fix_hdr = pe .Node (CopyXForm (), mem_gb = 0.1 , name = "fix_hdr" )
268
- final_n4 = pe .Node (
269
- N4BiasFieldCorrection (
270
- dimension = 3 ,
271
- bspline_fitting_distance = bspline_fitting_distance ,
272
- save_bias = True ,
273
- copy_header = True ,
274
- n_iterations = [50 ] * 5 ,
275
- convergence_threshold = 1e-7 ,
276
- rescale_intensities = True ,
277
- shrink_factor = 4 ,
278
- ),
279
- n_procs = omp_nthreads ,
280
- name = "final_n4" ,
281
- )
282
- final_clip = pe .Node (IntensityClip (p_min = 5.0 , p_max = 99.5 ), name = "final_clip" )
283
- apply_mask = pe .Node (ApplyMask (), name = "apply_mask" )
284
-
285
- # fmt:off
286
- workflow .connect ([
287
- (inputnode , validate_mask , [("t1w_mask" , "in_file" )]),
288
- (validate_mask , fix_hdr , [("out_file" , "in_file" )]),
289
- (inputnode , fix_hdr , [("t1w" , "hdr_file" )]),
290
- (inputnode , final_n4 , [("t1w" , "input_image" )]),
291
- (fix_hdr , final_n4 , [("out_file" , "weight_image" )]),
292
- (fix_hdr , apply_mask , [("out_file" , "in_mask" )]),
293
- (final_n4 , apply_mask , [("output_image" , "in_file" )]),
294
- (final_n4 , final_clip , [("output_image" , "in_file" )]),
295
- (fix_hdr , outputnode , [("out_file" , "t1w_mask" )]),
296
- (final_clip , outputnode , [("out_file" , "t1w_preproc" )]),
297
- (apply_mask , outputnode , [("out_file" , "t1w_brain" )]),
298
- ])
299
- # fmt:on
300
- return workflow
301
-
302
-
303
252
def _pop (in_files ):
304
253
if isinstance (in_files , (list , tuple )):
305
254
return in_files [0 ]
0 commit comments