Skip to content

Interface SPM ApplyTransform generated an error if out_file was not provided #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2014

Conversation

mick-d
Copy link
Contributor

@mick-d mick-d commented Oct 23, 2014

Generation of out_file name was broken and out_file remained empty if not provided, leading SPM to fail.

@chrisgorgo
Copy link
Member

any chance we could use name_source here instead of genfilename?

@mick-d
Copy link
Contributor Author

mick-d commented Oct 24, 2014

Sure, i'll just need to go back and check the exact use of name_source

@mick-d
Copy link
Contributor Author

mick-d commented Oct 24, 2014

@chrisfilo what you are asking relies on refactoring the SPM base interface to add support for name_source

I tried but couldn't get it to work, for some reasons when debugging, the following commands in _parse_inputs:

metadata = dict(field=lambda t: t is not None) 
self.inputs.traits(**metadata).items()

returns an empty list, with self.inputs.traits evaluating to:

self.inputs.traits
<bound method MatlabInputSpec.traits of 
args = <undefined>
environ = {}
ignore_exception = False
logfile = <undefined>
mfile = True
nodesktop = True
nosplash = True
paths = <undefined>
postscript = ['\n,catch ME,', "fprintf(2,'MATLAB code threw an exception:\\n');", "fprintf(2,'%s\\n',ME.message);", "if length(ME.stack) ~= 0, fprintf(2,'File:%s\\nName:%s\\nLine:%d\\n',ME.stack.file,ME.stack.name,ME.stack.line);, end;", 'end;']
prescript = ["fprintf(1,'Executing %s at %s:\\n',mfilename,datestr(now));", 'ver,', 'try,']
script = 
        infile = '/test/T1.nii';
        outfile = '<undefined>'
        transform = load('/test/T1.mat');

        V = spm_vol(infile);
        X = spm_read_vols(V);
        [p n e v] = spm_fileparts(V.fname);
        V.mat = transform.M * V.mat;
        V.fname = fullfile(outfile);
        spm_write_vol(V,X);


script_file = pyscript_applytransform.m
single_comp_thread = True
terminal_output = allatonce
uses_mcr = <undefined>
>

@mick-d
Copy link
Contributor Author

mick-d commented Oct 24, 2014

Do you know why that would be?

@chrisgorgo
Copy link
Member

I see. I'll add name_source support to BaseInterface later. For now you can stick with genfile.

chrisgorgo added a commit that referenced this pull request Oct 24, 2014
Interface SPM ApplyTransform generated an error if out_file was not provided
@chrisgorgo chrisgorgo merged commit 9a82862 into nipy:master Oct 24, 2014
@mick-d mick-d deleted the spm branch July 22, 2015 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants