Skip to content

Commit fe16163

Browse files
committed
BF: Fixed several issues with GroupAndStack interface
1 parent 3abf060 commit fe16163

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

nipype/interfaces/dcmstack.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class DcmStack(NiftiGeneratorBase):
8787
>>> stacker.inputs.dicom_files = 'path/to/series/'
8888
>>> stacker.run()
8989
>>> result.outputs.out_file
90-
'sequence.nii.gz'
90+
'/path/to/cwd/sequence.nii.gz'
9191
'''
9292
input_spec = DcmStackInputSpec
9393
output_spec = DcmStackOutputSpec
@@ -132,23 +132,23 @@ def _list_outputs(self):
132132
class GroupAndStackOutputSpec(TraitedSpec):
133133
out_list = traits.List(desc="List of output nifti files")
134134

135-
class GroupAndStack(NiftiGeneratorBase):
136-
'''Create (potentially) multiple Nifti files for a set of DICOM files.'''
135+
class GroupAndStack(DcmStack):
136+
'''Create (potentially) multiple Nifti files for a set of DICOM files.
137+
'''
137138
input_spec = DcmStackInputSpec
138139
output_spec = GroupAndStackOutputSpec
139140

140141
def _run_interface(self, runtime):
141142
src_paths = self._get_filelist(self.inputs.dicom_files)
142-
stacks = \
143-
dcmstack.parse_and_stack(src_paths,
144-
key_format=self.inputs.out_format
145-
)
143+
stacks = dcmstack.parse_and_stack(src_paths)
146144

147145
self.out_list = []
148146
for key, stack in stacks.iteritems():
149-
nw = NiftiWrapper(stack.to_nifti(embed_meta=self.inputs.embed_meta))
147+
nw = NiftiWrapper(stack.to_nifti(embed_meta=True))
150148
const_meta = nw.meta_ext.get_class_dict(('global', 'const'))
151149
out_path = self._get_out_path(const_meta)
150+
if not self.inputs.embed_meta:
151+
nw.remove_extension()
152152
nb.save(nw.nii_img, out_path)
153153
self.out_list.append(out_path)
154154

0 commit comments

Comments
 (0)