Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pypreprocess/configure_spm.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def _configure_spm_using_mcr(spm_mcr, spm_dir, spm_version):
_logger.info('setting SPM MCR path to "{}" '
'and "use_mcr" to True'.format(spm_mcr))
spm.SPMCommand.set_mlab_paths(
matlab_cmd='{} run script'.format(spm_mcr), use_mcr=True)
matlab_cmd='{} batch'.format(spm_mcr), use_mcr=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on this. They have deprecated using "run" from recent standalone versions for SPM12. More details on this can be found here https://github.com/spm/spm12/blob/master/spm_standalone.m

I am wandering whether this might again get into script running errors when users fall back to slightly older standalone versions ?

_logger.info('SPM configuration succeeded using SPM MCR.')


Expand Down
22 changes: 7 additions & 15 deletions pypreprocess/nipype_preproc_spm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def _do_subject_slice_timing(subject_data, TR, TA=None, spm_dir=None,
time_acquisition=TA, num_slices=nslices,
ref_slice=ref_slice + 1,
slice_order=list(slice_order + 1), # SPM
ignore_exception=True
)
if stc_result.outputs is None:
subject_data.failed = True
Expand Down Expand Up @@ -495,7 +494,6 @@ def _do_subject_coregister(subject_data, reslice=False, spm_dir=None,
source=coreg_source,
apply_to_files=apply_to_files,
jobtype=jobtype,
ignore_exception=True
)

# failed node ?
Expand Down Expand Up @@ -633,7 +631,6 @@ def _do_subject_segment(subject_data, output_modulated_tpms=True, spm_dir=None,
wm_output_type=gm_output_type,
csf_output_type=csf_output_type,
tissue_prob_maps=[GM_TEMPLATE, WM_TEMPLATE, CSF_TEMPLATE],
ignore_exception=True
)

# failed node
Expand Down Expand Up @@ -746,7 +743,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
output_dir=subject_data.scratch)
normalize_result = normalize(
source=subject_data.anat, template=t1_template,
write_preserve=False, ignore_exception=True)
write_preserve=False)
parameter_file = normalize_result.outputs.normalization_parameters
else:
parameter_file = subject_data.nipype_results[
Expand Down Expand Up @@ -777,7 +774,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
apply_to_files=apply_to_files,
write_voxel_sizes=list(write_voxel_sizes),
# write_bounding_box=[[-78, -112, -50], [78, 76, 85]],
write_interp=1, jobtype='write', ignore_exception=True)
write_interp=1, jobtype='write')

# failed node ?
if normalize_result.outputs is None:
Expand Down Expand Up @@ -807,9 +804,7 @@ def _do_subject_normalize(subject_data, fwhm=0., anat_fwhm=0., caching=True,
write_voxel_sizes=list(write_voxel_sizes),
write_wrap=[0, 0, 0],
write_interp=1,
jobtype='write',
ignore_exception=True
)
jobtype='write')

# failed node
subject_data.nipype_results['normalize_%s' % brain_name
Expand Down Expand Up @@ -933,7 +928,7 @@ def _do_subject_smooth(subject_data, fwhm, anat_fwhm=None, spm_dir=None,
in_files = [getattr(subject_data, x) for x in anat_like]

smooth_result = smooth(
in_files=in_files, fwhm=width, ignore_exception=True)
in_files=in_files, fwhm=width)

# failed node ?
subject_data.nipype_results['smooth'][brain_name] = smooth_result
Expand Down Expand Up @@ -1025,7 +1020,7 @@ def _do_subject_dartelnorm2mni(subject_data,
flowfield_files=subject_data.dartel_flow_fields,
template_file=template_file,
modulate=output_modulated_tpms, # don't modulate
fwhm=anat_fwhm, ignore_exception=True, **tricky_kwargs)
fwhm=anat_fwhm, **tricky_kwargs)
setattr(subject_data, "mw" + tissue,
dartelnorm2mni_result.outputs.normalized_files)

Expand All @@ -1034,7 +1029,6 @@ def _do_subject_dartelnorm2mni(subject_data,
apply_to_files=subject_data.anat,
flowfield_files=subject_data.dartel_flow_fields,
template_file=template_file,
ignore_exception=True,
modulate=output_modulated_tpms,
fwhm=anat_fwhm,
**tricky_kwargs
Expand All @@ -1049,7 +1043,6 @@ def _do_subject_dartelnorm2mni(subject_data,
createwarped_result = createwarped(
image_files=subject_data.func,
flowfield_files=subject_data.dartel_flow_fields,
ignore_exception=True
)
subject_data.func = createwarped_result.outputs.warped_files

Expand Down Expand Up @@ -1406,9 +1399,8 @@ def _do_subjects_newsegment(

# run node
newsegment_result = newsegment(
channel_files=[subject_data.anat for subject_data in subjects],
tissues=TISSUES,
ignore_exception=True)
channel_files=[subject_data.anat.replace(".nii.gz", ".nii")
for subject_data in subjects], tissues=TISSUES)
if newsegment_result.outputs is None:
return
else:
Expand Down