本文整理汇总了Python中dcmstack.dcmmeta.NiftiWrapper.remove_extension方法的典型用法代码示例。如果您正苦于以下问题:Python NiftiWrapper.remove_extension方法的具体用法?Python NiftiWrapper.remove_extension怎么用?Python NiftiWrapper.remove_extension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dcmstack.dcmmeta.NiftiWrapper
的用法示例。
在下文中一共展示了NiftiWrapper.remove_extension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _run_interface
# 需要导入模块: from dcmstack.dcmmeta import NiftiWrapper [as 别名]
# 或者: from dcmstack.dcmmeta.NiftiWrapper import remove_extension [as 别名]
def _run_interface(self, runtime):
src_paths = self._get_filelist(self.inputs.dicom_files)
stacks = dcmstack.parse_and_stack(src_paths)
self.out_list = []
for key, stack in stacks.iteritems():
nw = NiftiWrapper(stack.to_nifti(embed_meta=True))
const_meta = nw.meta_ext.get_class_dict(('global', 'const'))
out_path = self._get_out_path(const_meta)
if not self.inputs.embed_meta:
nw.remove_extension()
nb.save(nw.nii_img, out_path)
self.out_list.append(out_path)
return runtime
示例2: _run_interface
# 需要导入模块: from dcmstack.dcmmeta import NiftiWrapper [as 别名]
# 或者: from dcmstack.dcmmeta.NiftiWrapper import remove_extension [as 别名]
def _run_interface(self, runtime):
src_paths = self._get_filelist(self.inputs.dicom_files)
include_regexes = dcmstack.default_key_incl_res
if isdefined(self.inputs.include_regexes):
include_regexes += self.inputs.include_regexes
exclude_regexes = dcmstack.default_key_excl_res
if isdefined(self.inputs.exclude_regexes):
exclude_regexes += self.inputs.exclude_regexes
meta_filter = dcmstack.make_key_regex_filter(exclude_regexes, include_regexes)
stack = dcmstack.DicomStack(meta_filter=meta_filter)
for src_path in src_paths:
src_dcm = dicom.read_file(src_path, force=True)
stack.add_dcm(src_dcm)
nii = stack.to_nifti(embed_meta=True)
nw = NiftiWrapper(nii)
self.out_path = self._get_out_path(nw.meta_ext.get_class_dict(("global", "const")))
if not self.inputs.embed_meta:
nw.remove_extension()
nb.save(nii, self.out_path)
return runtime