Skip to content

spm.preproces.realign doesn't expect the use of write_which #533

@beOn

Description

@beOn

This issue is secondary to #531.

After you apply the patch from #532, if you use one of the values for write_which that prevent the reslicing of all images (eg. [0, 1]), this part of Realign's _list_outputs fails, because it tries to add files to the output that have not in fact been created.

if self.inputs.jobtype == "write" or self.inputs.jobtype == "estwrite":
            if isinstance(self.inputs.in_files[0], list):
                first_image = self.inputs.in_files[0][0]
            else:
                first_image = self.inputs.in_files[0]

            outputs['mean_image'] = fname_presuffix(first_image, prefix='mean')
            outputs['realigned_files'] = []
            for imgf in filename_to_list(self.inputs.in_files):
                realigned_run = []
                if isinstance(imgf,list):
                    for inner_imgf in filename_to_list(imgf):
                        realigned_run.append(fname_presuffix(inner_imgf, prefix=self.inputs.out_prefix))
                else:
                    realigned_run = fname_presuffix(imgf, prefix=self.inputs.out_prefix)
                outputs['realigned_files'].append(realigned_run)

I will submit a pull request to address this shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions