Thanks Satra, that worked for me.
I'm not using github yet (haven't made the switch from SVN), but my
code is pretty short. I just threw the following in nipype/interfaces/
fsl/utils.py :
class CreateHeaderInputSpec(FSLCommandInputSpec):
x_size = traits.Int(argstr="%d", position=0, desc="x size",
mandatory=True)
y_size = traits.Int(argstr="%d", position=1, desc="y size",
mandatory=True)
z_size = traits.Int(argstr="%d", position=2, desc="z size",
mandatory=True)
t_size = traits.Int(argstr="%d", position=3, desc="t size",
mandatory=True)
voxel_x_size = traits.Float(argstr="%f", position=4, desc="voxel x
size", mandatory=True)
voxel_y_size = traits.Float(argstr="%f", position=5, desc="voxel y
size", mandatory=True)
voxel_z_size = traits.Float(argstr="%f", position=6, desc="voxel z
size", mandatory=True)
tr = traits.Float(argstr="%f", position=7, desc="repetition time
(TR)", mandatory=True)
x_origin = traits.Int(argstr="%d", position=8, desc="x origin",
mandatory=True)
y_origin = traits.Int(argstr="%d", position=9, desc="y origin",
mandatory=True)
z_origin = traits.Int(argstr="%d", position=10, desc="z origin",
mandatory=True)
datatype = traits.Int(argstr="%d", position=11, desc="data type",
mandatory=True)
out_file = File(argstr="%s", position=12, desc="output file",
genfile=True)
class CreateHeaderOutputSpec(TraitedSpec):
out_file = File(exists=True)
class CreateHeader(FSLCommand):
""" Use fslcreatehd to create a header and image
"""
_cmd = 'fslcreatehd'
input_spec = CreateHeaderInputSpec
output_spec = CreateHeaderOutputSpec
def _list_outputs(self):
outputs = self._outputs().get()
outputs['out_file'] = self.inputs.out_file
if not isdefined(outputs['out_file']):
outputs['out_file'] = self._gen_fname('header.nii.gz')
return outputs
def _gen_filename(self, name):
if name == 'out_file':
return self._list_outputs()[name]
return None
and of course, added CreateHeader to the import statement in nipype/
interfaces/fsl/__init__.py
I'm not sure how correct this code is, but it seems to work.
- Jimmy