Skip to content

Correct Class Segment in spm.preprocess #580

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 3 commits into from
Jun 15, 2013
Merged
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
24 changes: 13 additions & 11 deletions nipype/interfaces/spm/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,17 @@ class SegmentInputSpec(SPMCommandInputSpec):


class SegmentOutputSpec(TraitedSpec):
native_gm_image = File(exists=True, desc='native space grey probability map')
normalized_gm_image = File(exists=True, desc='normalized grey probability map',)
modulated_gm_image = File(exists=True, desc='modulated, normalized grey probability map')
native_wm_image = File(exists=True, desc='native space white probability map')
normalized_wm_image = File(exists=True, desc='normalized white probability map')
modulated_wm_image = File(exists=True, desc='modulated, normalized white probability map')
native_csf_image = File(exists=True, desc='native space csf probability map')
normalized_csf_image = File(exists=True, desc='normalized csf probability map')
modulated_csf_image = File(exists=True, desc='modulated, normalized csf probability map')
modulated_input_image = File(exists=True, desc='modulated version of input image')
native_gm_image = File(desc='native space grey probability map')
normalized_gm_image = File(desc='normalized grey probability map',)
modulated_gm_image = File(desc='modulated, normalized grey probability map')
native_wm_image = File(desc='native space white probability map')
normalized_wm_image = File(desc='normalized white probability map')
modulated_wm_image = File(desc='modulated, normalized white probability map')
native_csf_image = File(desc='native space csf probability map')
normalized_csf_image = File(desc='normalized csf probability map')
modulated_csf_image = File(desc='modulated, normalized csf probability map')
modulated_input_image = File(deprecated='0.10', new_name='bias_corrected_image', desc='bias-corrected version of input image')
bias_corrected_image = File(desc='bias-corrected version of input image')
transformation_mat = File(exists=True, desc='Normalization transformation')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only transformation_mat and inverse_transformation_mat are not predicated by inputs, so File(exists=True) remains for these outputs

inverse_transformation_mat = File(exists=True, desc='Inverse normalization info')

Expand Down Expand Up @@ -583,7 +584,8 @@ def _list_outputs(self):
if getattr(self.inputs, outtype)[idx]:
outfield = '%s_%s_image'%(image,tissue)
outputs[outfield] = fname_presuffix(f, prefix='%sc%d'%(prefix,tidx+1))
outputs['modulated_input_image'] = fname_presuffix(f, prefix='m')
if isdefined(self.inputs.save_bias_corrected) and self.inputs.save_bias_corrected:
outputs['bias_corrected_image'] = fname_presuffix(f, prefix='m')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new variable bias_corrected_image is used in this line of code

Copy link
Member

Choose a reason for hiding this comment

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

i'll have to run this to test, but with the deprecated flag do you know if outputs['modulated_input_image'] is set or not when the interface returns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When i used outputs['modulated_input_image'] instead of outputs['bias_corrected_image'] (both with the deprecated flag update already in place) then it didn't work (can't remember what was wrong). But with the code as shown above then no matter the boolean value of save_bias_corrected, the interface run fine.

Does that answer your question? Or would you need me to run the interface as shown above and see the value of outputs['modulated_input_image']?

t_mat = fname_presuffix(f, suffix='_seg_sn.mat', use_ext=False)
outputs['transformation_mat'] = t_mat
invt_mat = fname_presuffix(f, suffix='_seg_inv_sn.mat', use_ext=False)
Expand Down