dcm2niix将 dicom序列转为nifti。

dcm2nii 与dcm2niix

网址NITRC。
dcm2nii是一个流行的工具,用于将扫描仪制造商使用的复杂格式(DICOM、PAR/REC)转换为许多科学工具使用的简单NIfTI格式。dcm2nii适用于所有的模式(CT、MRI、PET、SPECT)和序列类型。
注意:dcm2nii通常包含在MRIcron下载中。MRIcron有windows的版本和mac os的版本。
dcm2niix最新的版本——dcm2niix

Use

from nipype.interfaces.dcm2nii import Dcm2niix
def transform(input_path, out_path, name):converter = Dcm2niix()converter.inputs.source_dir = input_pathconverter.inputs.compression = 5converter.inputs.out_filename = nameconverter.inputs.output_dir = out_path# converter.inputs.merge_imgs = Trueconverter.cmdlineconverter.run()

Inputs:

https://nipype.readthedocs.io/en/latest/interfaces/generated/nipype.interfaces.dcm2nii.html

[Mandatory]
source_names: (a list of items which are a pathlike object or stringrepresenting an existing file)A set of filenames to be converted. Note that the current version(1.0.20180328) of dcm2niix converts any files in the directory. Toonly convert specific files they should be in an isolated directoryargument: ``%s``, position: -1mutually_exclusive: source_dir
source_dir: (a pathlike object or string representing an existingdirectory)A directory containing dicom files to be convertedargument: ``%s``, position: -1mutually_exclusive: source_names[Optional]
out_filename: (a unicode string)Output filename template (%a=antenna (coil) number, %c=comments,%d=description, %e=echo number, %f=folder name, %i=ID of patient,%j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=nameof patient, %p=protocol, %s=series number, %t=time, %u=acquisitionnumber, %v=vendor, %x=study ID; %z=sequence name)argument: ``-f %s``
output_dir: (a pathlike object or string representing an existingdirectory, nipype default value: .)Output directoryargument: ``-o %s``
bids_format: (a boolean, nipype default value: True)Create a BIDS sidecar fileargument: ``-b``
anon_bids: (a boolean)Anonymize BIDSargument: ``-ba``requires: bids_format
compress: ('y' or 'i' or 'n' or '3', nipype default value: y)Gzip compress images - [y=pigz, i=internal, n=no, 3=no,3D]argument: ``-z %s``
merge_imgs: (a boolean, nipype default value: False)merge 2D slices from same seriesargument: ``-m``
single_file: (a boolean, nipype default value: False)Single file modeargument: ``-s``
verbose: (a boolean, nipype default value: False)Verbose outputargument: ``-v``
crop: (a boolean, nipype default value: False)Crop 3D T1 acquisitionsargument: ``-x``
has_private: (a boolean, nipype default value: False)Text notes including private patient detailsargument: ``-t``
compression: (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9)Gz compression level (1=fastest, 9=smallest)argument: ``-%d``
comment: (a unicode string)Comment stored as NIfTI aux_fileargument: ``-c %s``
ignore_deriv: (a boolean)Ignore derived, localizer and 2D imagesargument: ``-i``
series_numbers: (a list of items which are a unicode string)Selectively convert by series number - can be used up to 16 timesargument: ``-n %s...``
philips_float: (a boolean)Philips precise float (not display) scalingargument: ``-p``
to_nrrd: (a boolean)Export as NRRD instead of NIfTIargument: ``-e``
args: (a unicode string)Additional parameters to the commandargument: ``%s``
environ: (a dictionary with keys which are a bytes or None or a valueof class 'str' and with values which are a bytes or None or avalue of class 'str', nipype default value: {})Environment variables

Outputs:

converted_files: (a list of items which are a pathlike object orstring representing an existing file)
bvecs: (a list of items which are a pathlike object or stringrepresenting an existing file)
bvals: (a list of items which are a pathlike object or stringrepresenting an existing file)
bids: (a list of items which are a pathlike object or stringrepresenting an existing file)

参数 out_filename

当然可以自定义。

filename (%a=antenna (coil) name, %b=basename, %c=comments, %d=description,%e=echo number, %f=folder name, %i=ID of patient, %j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=name of patient, %p=protocol, %r=instance number, %s=series number, %t=time, %u=acquisition number, %v=vendor, %x=study ID; %z=sequence name;
default '%f_%p_%t_%s')

shell 命令行

dcm2niix -f "%f_%p_%t_%s" -p y -z y "/home/user/DicomDir"
  • argument: -p
    philips_float: (a boolean)
    Philips precise float (not display) scaling

  • argument: -z %s
    compress: (‘y’ or ‘i’ or ‘n’ or ‘3’, nipype default value: y)
    Gzip compress images - [y=pigz, i=internal, n=no, 3=no,3D]

保存的 json文件相关条目

{"Modality": ,"MagneticFieldStrength": ,"ImagingFrequency": ,"Manufacturer": ,"ManufacturersModelName": ,"InstitutionName": ,"InstitutionalDepartmentName": ,"DeviceSerialNumber": ,"StationName": ,"BodyPartExamined": ,"PatientPosition": ,"ProcedureStepDescription": ,"SoftwareVersions": ,"MRAcquisitionType":,"SeriesDescription": ,"ProtocolName": ,"ScanningSequence": ,"SequenceVariant": ,"ScanOptions": ,"ImageType": ,"SeriesNumber": ,"AcquisitionTime": "AcquisitionNumber": ,"PhilipsRescaleSlope": ,"PhilipsRescaleIntercept": ,"PhilipsScaleSlope": ,"UsePhilipsFloatNotDisplayScaling": ,"SliceThickness": ,"SpacingBetweenSlices": ,"SAR": ,"EchoTime": ,"RepetitionTime": ,"FlipAngle": ,"CoilString": ,"PercentPhaseFOV": ,"EchoTrainLength": ,"PhaseEncodingSteps": ,"AcquisitionMatrixPE": ,"ReconMatrixPE": ,"PixelBandwidth": ,"ImageOrientationPatientDICOM": ,"InPlanePhaseEncodingDirectionDICOM": ,"ConversionSoftware": "dcm2niix","ConversionSoftwareVersion": "v1.0.20190902"
}

一共保存了44个条目。
包括跟扫描相关的参数,以及转换软件相关的参数。

【医疗影像处理】dcm2niix python3 使用相关推荐

  1. 医疗影像处理:去除医疗影像中背景的影响2D/3D【numpy-code】| CSDN博文精选

    BDTC大会官网:https://t.csdnimg.cn/q4TY 作者 | chestnut-- 来源 | CSDN博客 在医疗影像中特别是CT影像,包含大量的背景,在进行器官分割时,首先去除背景 ...

  2. 【计算机视觉】新冠肺炎COVID-19 CT影片阳性检测,感染区域分割,肺部分割,智慧医疗实践,医疗影像处理示例

    引言 新型冠状病毒肺炎(Corona Virus Disease 2019,COVID-19),简称"新冠肺炎",世界卫生组织命名为"2019冠状病毒病".截止 ...

  3. 关于xtk.js的使用(医疗影像处理插件)

    由于公司项目需要,我学习了xtk.js,用于显示obj.vtk.mtl等文件中的内容.效果如图: xtk.js能够实现obj文件的显示.3D影像的视口改变.影像移动.放大缩小,并能够适配平板端. 我主 ...

  4. 医疗影像处理入门篇读入*.mhd数据解析ElementSpacing参数

    关于Dicom数据 使用pydicom包即可,网上有很多写的比较详细的,我就不搬运了,不了解的还请自行百度 读取*.mhd数据 有一些数据集提供的是mhd格式的数据,还有一些是*.nii.gz的数据, ...

  5. 【转】医学影像处理相关知识整理(一)

    转自:医学影像处理相关知识整理(一) - 知乎 Segmentation to RT structure 近日做医疗影像处理相关的内容,感慨于这方面资料不全.散碎,遂记录自己获得的一些资料以供日后查阅 ...

  6. nnFormer (Not-aNother transFORMER): 基于交叉Transformer结构的3D医疗影像分割网络

    关注公众号,发现CV技术之美 文章链接:https://arxiv.org/abs/2109.03201 开源代码和模型:https://github.com/282857341/nnForme ▊  ...

  7. 生物医学工程专业及医疗IT相关网站

    1.生物医学工程(Biomedical Engineering/BME): 生物医学工程(BME)是一门由理.工.医相结合的边缘学科,是多种工程学科向生物医学渗透的产物,是运用现代自然科学和工程技术的 ...

  8. 体素科技丁晓伟:医疗影像的哲学三问

    撰文 | 邱陆陆 医疗,是「死生亦大矣」层面的讨论.这个鲜少「跟风」.转变审慎到近乎迟滞的行业,领域内研究通常要落后工程技术业界五年. 而这一次深度学习的高热从自然影像蔓延到医疗影像,只用了不到两年. ...

  9. 深圳市大数据研究院(医疗大数据实验室)招聘博士/硕士/博士后/科研助理

    点击下方卡片,关注"CVer"公众号 AI/CV重磅干货,第一时间送达 点击进入-> AI算法岗求职群 深圳市大数据研究院下属的医疗大数据实验室项目组面向海内外招聘博士后.博 ...

  10. CV竞赛项目研究:脊柱疾病诊断(天池,GPU赛道,2020年9月)

    目录 0 总的感受 当前阶段,竞赛还是2个关键: get点: 1 简介 1.1 需求 1.2 数据集 1.2.1 MRI数据 第6名:"我是一个搬砖工",南加州.上交大,2人. 1 ...

最新文章

  1. 中国芯片首富捐资200亿办大学!落地宁波镇海,拟名「东方理工」
  2. C/C++中各种类型int、long、double、char表示范围(最大最小值)
  3. 在线实时大数据平台Storm集成redis开发(分布锁)
  4. 如何将图片中的一个任意四边形区域的图像转化为矩形【附源码】
  5. Nginx 实现网站 http、https 配置
  6. Intel保护机制:特权级别:Protection Rings
  7. [Spring实战系列](19)Servlet不同版本之间的区别
  8. 国际象棋游戏界面和简易棋谱规则-最新Python学习成果
  9. Python标准库:内置函数ascii(object)
  10. ExtJS笔记 Grids
  11. 修改Unity中Lua文件的默认打开程序
  12. mysql innodb_large_prefix_那些从MySQL5.6升级到5.7的坑--innodb_large_prefix-阿里云开发者社区...
  13. 电力载波通信模块JST-HPLC-S-C在物联网通信领域的应用
  14. Python做人工智能?让电脑自己学会玩游戏,实战带你入门机器学习
  15. html5ie11缩放,IE 11 页面缩放后再次打开不能保存之前的缩放比例
  16. 计算一点绕另一点旋转n度后的坐标
  17. 数据导入(excel读取,存储进数据库【多表】)
  18. android2.3.5中阿拉伯文字符显示顺序不是从右至左显示
  19. 软件测试流程规范简介(不同公司流程规范不一样,仅供参考)
  20. ajax 异步刷新表格

热门文章

  1. 关于哈希,分布式哈希表,一致性哈希
  2. OpenGL学习笔记(一)OpenGL坐标变换
  3. MOSS中集成各个子网站的数据到一个页面,做决策支持页面的首选: Web Capture
  4. Unplugged In Newyork
  5. 软件测试的知识点总结
  6. POJ 2728 Desert King:最优比率生成树
  7. Python使用日常
  8. ArchLinux安装配置
  9. C#使用结构来传递多个参数
  10. ubuntu下成功配置LAMP 并安装PHPMyadmin