@@ -254,21 +254,32 @@ def create_DARTEL_template(name='dartel_template'):
254
254
iterfield = ['channel_files' ],
255
255
name = 'segment' )
256
256
workflow .connect (inputnode , 'structural_files' , segment , 'channel_files' )
257
- if not no_matlab :
258
- version = spm .Info .version ()
259
- if version and version ['name' ] == 'SPM8' :
260
- spm_path = version ['path' ]
257
+
258
+ version = spm .Info .version ()
259
+ if version :
260
+ spm_path = version ['path' ]
261
+ if version ['name' ] == 'SPM8' :
261
262
tissue1 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 1 ), 2 , (True ,True ), (False , False ))
262
263
tissue2 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 2 ), 2 , (True ,True ), (False , False ))
263
264
tissue3 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 3 ), 2 , (True ,False ), (False , False ))
264
265
tissue4 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 4 ), 3 , (False ,False ), (False , False ))
265
266
tissue5 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 5 ), 4 , (False ,False ), (False , False ))
266
267
tissue6 = ((os .path .join (spm_path ,'toolbox/Seg/TPM.nii' ), 6 ), 2 , (False ,False ), (False , False ))
267
- segment .inputs .tissues = [tissue1 , tissue2 , tissue3 , tissue4 , tissue5 , tissue6 ]
268
+ elif version ['name' ] == 'SPM12' :
269
+ spm_path = version ['path' ]
270
+ tissue1 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 1 ), 1 , (True ,True ), (False , False ))
271
+ tissue2 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 2 ), 1 , (True ,True ), (False , False ))
272
+ tissue3 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 3 ), 2 , (True ,False ), (False , False ))
273
+ tissue4 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 4 ), 3 , (False ,False ), (False , False ))
274
+ tissue5 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 5 ), 4 , (False ,False ), (False , False ))
275
+ tissue6 = ((os .path .join (spm_path ,'tpm/TPM.nii' ), 6 ), 2 , (False ,False ), (False , False ))
268
276
else :
269
- logger .critical ('SPM8 not found: DARTEL not available' )
277
+ logger .critical ('Unsupported version of SPM' )
278
+
279
+ segment .inputs .tissues = [tissue1 , tissue2 , tissue3 , tissue4 , tissue5 , tissue6 ]
270
280
else :
271
- logger .critical ('MATLAB not found: DARTEL not setting tissue templates' )
281
+ logger .critical ('SPM not found' )
282
+
272
283
dartel = pe .Node (spm .DARTEL (), name = 'dartel' )
273
284
274
285
"""Get the gray and white segmentation classes generated by NewSegment
0 commit comments