Skip to content

Commit 36dde27

Browse files
committed
change location of templates and gaussian parameters for SPM12 segment
1 parent d088410 commit 36dde27

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

nipype/workflows/fmri/spm/preprocess.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,32 @@ def create_DARTEL_template(name='dartel_template'):
254254
iterfield=['channel_files'],
255255
name='segment')
256256
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':
261262
tissue1 = ((os.path.join(spm_path,'toolbox/Seg/TPM.nii'), 1), 2, (True,True), (False, False))
262263
tissue2 = ((os.path.join(spm_path,'toolbox/Seg/TPM.nii'), 2), 2, (True,True), (False, False))
263264
tissue3 = ((os.path.join(spm_path,'toolbox/Seg/TPM.nii'), 3), 2, (True,False), (False, False))
264265
tissue4 = ((os.path.join(spm_path,'toolbox/Seg/TPM.nii'), 4), 3, (False,False), (False, False))
265266
tissue5 = ((os.path.join(spm_path,'toolbox/Seg/TPM.nii'), 5), 4, (False,False), (False, False))
266267
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))
268276
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]
270280
else:
271-
logger.critical('MATLAB not found: DARTEL not setting tissue templates')
281+
logger.critical('SPM not found')
282+
272283
dartel = pe.Node(spm.DARTEL(), name='dartel')
273284

274285
"""Get the gray and white segmentation classes generated by NewSegment

0 commit comments

Comments
 (0)