放射科的CT大多数是5 mm,有时需要插值成1 mm,这里是医工所的曹老师写的代码,在此做个记录,学习一下。

clear;clc;
%程序功能:读取dicom文件,并将其插值为1mm
folderPath = 'Y180521\';
outFolderPath = 'out\';folderInfo = dir(folderPath);
fileNum = size(folderInfo,1)-2;
outFileNum = 0;
fileIndex = [];
instanceNumber = [];
for i = 1:fileNum%读取相邻两张图片fileName = folderInfo(i+2).name;filePath = strcat(folderPath, fileName);
%     ImgB = dicomread(filePath);  % 这里似乎不需要,只需要头文件信息ImgInfoB = dicominfo(filePath);%存储信息
%     disp(ImgInfoB.InstanceNumber);instanceNumber(end+1,1) = ImgInfoB.InstanceNumber;  % end+1后的,1可省略
end
startInstanceNumber = min(instanceNumber);  % 细心,注意设置起始number
for i = 0:(fileNum-2)%读取相邻两张图片fileIndexB = find(instanceNumber == (startInstanceNumber + i));    fileNameB = folderInfo(fileIndexB+2).name;filePathB = strcat(folderPath, fileNameB);ImgB = dicomread(filePathB);ImgInfoB = dicominfo(filePathB);%存储信息fileIndexT = find(instanceNumber == (startInstanceNumber + i + 1));fileNameT = folderInfo(fileIndexT+2).name;filePathT = strcat(folderPath, fileNameT);ImgT = dicomread(filePathT);ImgInfoT = dicominfo(filePathT);%存储信息%线性插值ImgD = double(ImgT - ImgB) * 0.2;Img1 = int16(round(ImgD * 1 + double(ImgB)));Img2 = int16(round(ImgD * 2 + double(ImgB)));Img3 = int16(round(ImgD * 3 + double(ImgB)));Img4 = int16(round(ImgD * 4 + double(ImgB)));%保存结果filePath = strcat( outFolderPath,num2str(i*5),'.DCM');ImgInfoB.InstanceNumber = i * 5 + 1;ImgInfoB.SliceThickness = 1;ImgInfoB.Filename = filePath;dicomwrite(ImgB,filePath,ImgInfoB);%写入Dicom图像filePath = strcat( outFolderPath,num2str(i*5+1),'.DCM');ImgInfoB.InstanceNumber = i * 5 + 2;ImgInfoB.SliceThickness = 1;ImgInfoB.Filename = filePath;ImgInfoB.SliceLocation = ImgInfoB.SliceLocation - 1;ImgInfoB.ImagePositionPatient(3,1) = ImgInfoB.ImagePositionPatient(3,1)-1;dicomwrite(Img1,filePath,ImgInfoB);%写入Dicom图像filePath = strcat( outFolderPath,num2str(i*5+2),'.DCM');ImgInfoB.InstanceNumber = i * 5 + 3;ImgInfoB.SliceThickness = 1;ImgInfoB.Filename = filePath;ImgInfoB.SliceLocation = ImgInfoB.SliceLocation - 1;ImgInfoB.ImagePositionPatient(3,1) = ImgInfoB.ImagePositionPatient(3,1)-1;dicomwrite(Img2,filePath,ImgInfoB);%写入Dicom图像filePath = strcat( outFolderPath,num2str(i*5+3),'.DCM');ImgInfoB.InstanceNumber = i * 5 + 4;ImgInfoB.SliceThickness = 1;ImgInfoB.Filename = filePath;ImgInfoB.SliceLocation = ImgInfoB.SliceLocation - 1;ImgInfoB.ImagePositionPatient(3,1) = ImgInfoB.ImagePositionPatient(3,1)-1;dicomwrite(Img3,filePath,ImgInfoB);%写入Dicom图像filePath = strcat( outFolderPath,num2str(i*5+4),'.DCM');ImgInfoB.InstanceNumber = i * 5 + 5;ImgInfoB.SliceThickness = 1;ImgInfoB.Filename = filePath;ImgInfoB.SliceLocation = ImgInfoB.SliceLocation - 1;ImgInfoB.ImagePositionPatient(3,1) = ImgInfoB.ImagePositionPatient(3,1)-1;dicomwrite(Img4,filePath,ImgInfoB);%写入Dicom图像filePath = strcat( outFolderPath,num2str((i+1)*5+1),'.DCM');ImgInfoT.InstanceNumber = (startInstanceNumber + i) * 5 + 1;ImgInfoT.SliceThickness = 1;ImgInfoT.Filename = filePath;dicomwrite(ImgT,filePath,ImgInfoT);%写入Dicom图像
end

CT dicom 5mm层厚插值成1mm-20201110相关推荐

  1. 层间距离对ct图像的影响_多层螺旋CT螺距、层厚和重建间隔关系及对图像质量影响...

    多层螺旋 CT 螺距.层厚和重建间隔关系及对图像质量影响 周泽俊 ; 胡永胜 ; 高斌 ; 巢惠民 [期刊名称] <中国医疗设备> [年 ( 卷 ), 期] 2008(023)008 [摘 ...

  2. 【转】CT层厚、层间距、层间隔的概念是什么,MRI的层厚、层间距、曾间隔是什么

    CT层厚指扫描层的厚度.CT层间距指两个扫描层面中心之间的距离.CT层间隔指两层之间的距离. 做CT打比方就是把胡萝卜切成片,观察每片的结构. 那胡萝卜需要切多厚呢?这个葫芦卜片的厚度就是这个扫描层厚 ...

  3. 【转】CT中的“层“与“排“的区别

    转自:CT中的"层"与"排"的区别 自从离开医院,专业培训磁共振,有差不多5年时间没有接触CT了.影像技术及影像医学诊断说到底是一门经验技术累积学科,这种学科的 ...

  4. CT中的层与排的区别

    转载自https://www.sohu.com/a/253957045_100012192 今天在整理一些CT的内容,自己回顾一遍,再查一些资料,重新写一遍,也是对知识的温故知新. CT术语中的&qu ...

  5. VTK根据几个点插值成样条曲线,然后以样条曲线为中心线,生成圆柱体管道

    VTK根据几个点插值成样条曲线,然后以样条曲线为中心线,生成圆柱体管道 #include "vtkActor.h" #include "vtkCamera.h" ...

  6. SimpleITK使用深度学习识别肺癌CT DICOM数据集

    肺癌数据集DICOM :https://wiki.cancerimagingarchive.net/display/Public/LIDC-IDRI 首先用SimpleITK把mhd图片读入,对每个切 ...

  7. ITK读取CT DICOM,如何设置窗位和窗宽?

    关键字: dicom itk CT 不清晰 窗位 窗宽 碎碎念: 最近忽然要用到ITK读取DICOM,在听到任务之前,我连ITK和DICOM是个啥东西都不知道.当然,刚听到任务的时候,我脑子里也只有& ...

  8. dicom文件_DICOM数据转成NIfTI数据

    使用MRIcron工具中的dcm2nii命令,还可以可视化NIfTI数据. $ sudo apt install mricron 使用命令行操作: ## 查看帮助文档 使用dcm2nii工具转换成NI ...

  9. 链路层基本问题 : 封装成帧、差错检测、流量控制

    一.封装成帧 1.MAC帧 类型字段 (2个字节): 用来标志上一层使用的是什么协议,以便把收到的MAC帧的数据上交给上一层的这个协议. 数据字段 (46-1500): 正式名称是MAC客户数据字段最 ...

最新文章

  1. UE:增强现实AR可视化基本概念
  2. 全长转录组测序在植物中的应用研究进展 赵陆滟,曹绍玉,龙云树,张应华,许俊强
  3. python用merge匹配和左连接_左手用R右手Python系列——数据合并与追加
  4. 免费教材丨第47期:业界大牛中文教学视频《深度学习:进阶》第21-24讲
  5. 如何在linux下创建一个可运行shell脚本?
  6. OmniVision的CMOS 图像传感器技术发展路线
  7. 4095: 韩信点兵
  8. 程序员要找到自己的兴趣所在
  9. 【数据结构】二叉树题目代码总结 (快速排序与汉诺塔的非递归 、判断完全二叉树 、二叉链表交换左右孩子 、01背包问题)
  10. 微信收款播报器提示服务器断开,微信收款语音提醒开启后收不到语音提醒怎么办? 专家详解...
  11. 没有对手的人生是孤单的
  12. DiskPart-删除磁盘分区
  13. 数据库作业:第四章:数据库安全性 习题
  14. Linux中常见的指令(三):几个查看文件内容的指令,ctrl+c的理解
  15. 抖音如何吸引精准流量?短视频引流应该怎么做
  16. 基于TF-IDF的简单搜索引擎的实现
  17. Pyyaml-yaml.load反序列化漏洞
  18. c语言佛像答案,课程网上考试题库试题(带答案):茶文化赏析
  19. IntelliJ IDEA 2020.1发布,你要的都在这!
  20. Express实现生成二维码接口

热门文章

  1. 监控体系之一监控数据采集
  2. Linux的浏览器怎么打拳皇,Fedora 9也用xmame下玩拳皇[多图]
  3. npm难以安装包的解决方法
  4. HDU 4921 Map(状态压缩)
  5. OLED屏幕字库的建立
  6. 使用Rufus工具制作Windows To Go——超详细,小白也能学会
  7. 强势出击!兑现诺言,完成FTP远程备份数据完美批处理
  8. 微信阅读量10万+文章是怎样炼成的?
  9. 蓝桥杯嵌入式|第十三届蓝桥杯嵌入式省赛程序设计试题及其题解
  10. phalapi框架实现腾讯云直播混流