DICOM图像到BMP图像的转换

DICOM图像到BMP图像的转换
DICOM图像到BMP图像的转换

BMP格式结构详解

位图文件(B it m a p-File,BMP)格式是Windows采用的图像文件存储格式,在Windows环境下运行的所有图像处理软件都支持这种格式。Windows 3.0以前的BMP位图文件格式与显示设备有关,因此把它称为设备相关位图(d evice-d ependent b itmap,DDB)文件格式。Windows 3.0以后的BMP位图文件格式与显示设备无关,因此把这种BMP位图文件格式称为设备无关位图(d evice-i ndependent b itmap,DIB)格式,目的是为了让Windows能够在任何类型的显示设备上显示BMP位图文件。BMP位图文件默认的文件扩展名是BMP或者bmp。 6.1.2 文件结构 位图文件可看成由4个部分组成:位图文件头(bitmap-file header)、位图信息头(bitmap-information header)、彩色表(color table)和定义位图的字节阵列,它们的名称和符号如表6-01所示。 表6-01 BMP图像文件组成部分的名称和符号 位图文件的组成结构名称符号 位图文件头(bitmap-file header)BITMAPFILEHEADE R bmfh 位图信息头(bitmap-information header)BITMAPINFOHEADE R bmih 彩色表(color table)RGBQUAD aColors[] 图像数据阵列字节BYTE aBitmapBits[ ] 位图文件结构可综合在表6-02中。 表6-02 位图文件结构内容摘要 偏移量域的名称大小内容 图像文件头0000h标识符 (Identifie r) 2 bytes两字节的内容用来识别位图的类型: ‘BM’ : Windows 3.1x, 95, NT, linux ‘BA’ :OS/2 Bitmap Array ‘CI’ :OS/2 Color Icon ‘CP’ :OS/2 Color Pointer ‘IC’ : OS/2 Icon ‘PT’ :OS/2 Pointer 0002h File Size 1 dword用字节表示的整个文件的大小 0006h Reserved 1 dword保留,设置为0 000Ah Bitmap Data Offset 1 dword从文件开始到位图数据开始之间的数据(bitmap data)之间的偏移量 000Eh Bitmap Header Size 1 dword位图信息头(Bitmap Info Header)的长度,用来 描述位图的颜色、压缩方法等。下面的长度表示: 28h - Windows 3.1x, 95, NT, … 0Ch - OS/2 1.x F0h - OS/2 2.x 0012h Width 1 dword位图的宽度,以像素为单位 0016h Height 1 dword位图的高度,以像素为单位 001Ah Planes 1 word位图的位面数 图像001Ch Bits Per Pixel 1 word每个像素的位数 1 - Monochrome bitmap

Dicom文件中图像参数详解

DICOM文件可以大致分为两部分: 一部分:与图像相关的元信息,包括患者信息,检查信息,序列信息,图像信息等等。 另一部分:图像的像素数据。 在解析DICOM文件中的像素数据的时候,我们先需要读取以下图像相关信息: 以下是某个CT影像中的图像信息示例: (0028,0002) Samples per Pixel VR: US Length: 2 Value: 1 (0028,0004) Photometric Interpretation VR: CS Length: 12 Value: MONOCHROME2 (0028,0010) Rows VR: US Length: 2 Value: 512 (0028,0011) Columns VR: US Length: 2 Value: 512 (0028,0030) Pixel Spacing VR: DS Length: 22 Value: 0.48828125\0.48828125 (0028,0100) Bits Allocated VR: US Length: 2 Value: 16 (0028,0101) Bits Stored VR: US Length: 2 Value: 12 (0028,0102) High Bit VR: US Length: 2 Value: 11 (0028,0103) Pixel Representation VR: US Length: 2 Value: 0 (0028,1050) Window Center VR: DS Length: 12 Value: 00100\00100 (0028,1051) Window Width VR: DS Length: 12 Value: 00500\00500 (0028,1052) Rescale Intercept VR: DS Length: 6 Value: -1000 (0028,1053) Rescale Slope VR: DS Length: 2 Value: 1 (0028,2110) Lossy Image Compression VR: CS Length: 2 Value: 01 (0028,2112) Lossy Image Compression Ratio VR: DS Length: 8 Value: 6.228918 1.(0028,0002) Samples per Pixel 每一个像素的取样数,一般来说,CT,MR,DR等灰度图像都是1,而彩超等彩**图像都是3,分别表示R, G, B三个颜色通道。 2.(0028,0004) Photometric Interpretation 我们经常碰到的Photometric Interpretation有以下几种类型: Monochrome2 一般的灰度图像都采用这种,Pixel值越大,图像就越白。

24位BMP图像

#include #include void main() { FILE *fpIn,*fpOut; /////////////////////////// struct RGBQUAD { unsigned char rgbBlue; unsigned char rgbGreen; unsigned char rgbRed; unsigned char rgbReserved; } bicolor; char bfty[2]; short bfreserved1,biplanes,bibitcount; long bfsize,bfoffbit,bisize,biwidth,biheight; long bicompression,bisizeimage,bix,biy,biclrused,biclrimportant; char *cR; int iCol,iRow; int i,j; int iWidth; char *lpsData; int iL; short sTemp; //////////////////////////////////// fpIn=fopen("F:/课堂学习/遥感数字图像处理/data/AA","rb"); fpOut=fopen("F:/课堂学习/遥感数字图像处理/data/Tm23.bmp","wb"); //D:\??\??????????\Data\data iCol=600; iRow=600; bfty[0]='B'; bfty[1]='M'; bfsize=54+iCol*iRow*3; bfreserved1=0; bfoffbit=54; ///////////////// bisize=40; biwidth=iCol; biheight=iRow; biplanes=1; bibitcount=24; bicompression=0;

BMP图像格式详解

BMP格式图像文件详析 首先请注意所有的数值在存储上都是按“高位放高位、低位放低位的原则”,如12345678h放在存储器中就是7856 3412)。下图是导出来的开机动画的第一张图加上文件头后的16进制数据,以此为例进行分析。T408中的图像有点怪,图像是在电脑上看是垂直翻转的。在分析中为了简化叙述,以一个字(两个字节为单位,如424D就是一个字)为序号单位进行,“h”表示是16进制数。 424D 4690 0000 0000 0000 4600 0000 2800 0000 8000 0000 9000 0000 0100*1000 0300 0000 0090 0000 A00F 0000 A00F 0000 0000 0000 0000 0000*00F8 0000 E007 0000 1F00 0000 0000 0000*02F1 84F1 04F1 84F1 84F1 06F2 84F1 06F2 04F2 86F2 06F2 86F2 86F2 ...... BMP文件可分为四个部分:位图文件头、位图信息头、彩色板、图像数据阵列,在上图中已用*分隔。 一、图像文件头 1)1:图像文件头。424Dh=’BM’,表示是Windows支持的BMP 格式。

2)2-3:整个文件大小。4690 0000,为00009046h=36934。 3)4-5:保留,必须设置为0。 4)6-7:从文件开始到位图数据之间的偏移量。4600 0000,为00000046h=70,上面的文件头就是35字=70字节。 5)8-9:位图图信息头长度。 6)10-11:位图宽度,以像素为单位。8000 0000,为00000080h=128。 7)12-13:位图高度,以像素为单位。9000 0000,为00000090h=144。 8)14:位图的位面数,该值总是1。0100,为0001h=1。 二、位图信息头 9)15:每个像素的位数。有1(单色),4(16色),8(256色),16(64K色,高彩色),24(16M色,真彩色),32(4096M色,增强

dicom读取方法

Dicom格式文件解析器 学数字图像与通讯,这里讲的暂不涉及通讯那方面的问题只讲*.dcm 也就是diocm格式文件的读取,读取本身是没啥难度的无非就是字节码数据流处理。只不过确实比较繁琐。 分析 整体结构先是128字节所谓的导言部分,说俗点就是没啥意义的破数据跳过就是了,然后是dataElement依次排列的方式就是一个dataElement接一个dataElement的方式排到文件结尾通俗的讲dataElement就是指tag 就是破Dicom标准里定义的数据字典。tag是4个字节表示的前两字节是组号后两字节是偏移号比如0008,0018。所有dataElement在文件中都是按tag排序的 比如0002,0001 0002,0002 0003,0011 文件整体结构如下: 又把论文里的这图贴上来总结的很好。单个dataElement的结构如下: 显示VR:VR为OB OW OF UT SQ UN的元素结构 显示VR:VR为普通类型时元素结构(少了预留那一行) 隐式VR 时元素结构

要问VR是啥东东,值表示法啥叫值表示法啊俺不懂 int string short ushort 懂不就是这个意思,Dicom标准真坑爹非要整个怪怪的概念。 VR总共27个跟c#值类型对应关系我都写好了: 1string getVF(string VR, byte[] VF) 2 { 3string VFStr = string.Empty; 4switch (VR) 5 { 6case"SS": 7 VFStr = BitConverter.ToInt16(VF, 0).ToString(); 8break; 9case"US": 10 VFStr = BitConverter.ToUInt16(VF, 0).ToString(); 11 12break; 13case"SL": 14 VFStr = BitConverter.ToInt32(VF, 0).ToString(); 15 16break; 17case"UL": 18 VFStr = BitConverter.ToUInt32(VF, 0).ToString(); 19 20break; 21case"AT": 22 VFStr = BitConverter.ToUInt16(VF, 0).ToString(); 23 24break; 25case"FL": 26 VFStr = BitConverter.ToSingle(VF, 0).ToString(); 27 28break; 29case"FD": 30 VFStr = BitConverter.ToDouble(VF, 0).ToString(); 31 32break; 33case"OB": 34 VFStr = BitConverter.ToString(VF, 0); 35break; 36case"OW": 37 VFStr = BitConverter.ToString(VF, 0);

DICOM标准及医学影像设备

DICOM标准 1.定义 DICOM(Digital Imaging and Communications in Medicine)即医学数字成像和通信,是医学图像和相关信息的国际标准(ISO 12052)。它定义了质量能满足临床需要的可用于数据交换的医学图像格式。 2.历史 在1970年代,随着以CT为代表的数字成像诊断设备在临床得到广泛应用,美 国放射学院(ACR)和国家电气制造协会(NEMA)在1983年成立了一个联合委员会,以制定相应规范。 ACR-NEMA联合委员会于1985年发布了最初的1.0版本(ACR-NEMA Standards Publications No.300-1985),又分别于1986年10月和和1988年1月发布了校订No.1和校订No.2。1988年该委员会推出2.0版本(ACR-NEMA Standards Publications NO.300-1988),到1993年发布的DICOM标准3.0,已发展成为医学影像信息学领域的国际通用标准。 3.目的 (1)推动不同制造商的设备间数字图像信息通信标准的建立。 (2)促进和扩展图片归档及通讯系统(PACS),使它可以与其它医院信息系统进行交互。 (3)允许广泛分布于不同地理位置的诊断设备创建统一的诊断信息数据库。 4.意义 DICOM标准中涵盖了医学数字图像的采集、归档、通信、显示及查询等几乎所有信息交换的协议;以开放互联的架构和面向对象的方法定义了一套包含各种类 型的医学诊断图像及其相关的分析、报告等信息的对象集;定义了用于信息传递、交换的服务类与命令集,以及消息的标准响应;详述了唯一标识各类信息对象的 技术;提供了应用于网络环境(OSI或TCP/IP)的服务支持;结构化地定义了制造厂 商的兼容性声明。 DICOM标准的推出与实现,大大简化了医学影像信息交换的实现,推动了远程放射学系统、图像管理与通信系统(PACS)的研究与发展,并且由于DICOM的开放性与互联性,使得与其它医学应用系统(HIS、RIS等)的集成成为可能。

bmp图像的读取

BMP图像文件由三部分组成:位图文件头数据结构,它包含BMP图像文件的类型、显示内容等信息;位图信息数据结构,它包含有BMP图像的宽、高、压缩方法,以及定义颜色等信息。 位图文件主要分为如下3个部分: 1、文件信息头BITMAPFILEHEADER 结构体定义如下: typedef struct tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER; 其中: 2、位图信息头BITMAPINFOHEADER

结构体定义如下: typedef struct tagBITMAPINFOHEADER { DWORD biSize; LONG biWidth; LONG biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; LONG biXPelsPerMeter; LONG biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER; 其中:

BMP头文件格式以及C语言读取头文件(二) 具体数据举例: 如某BMP文件开头: 424D 4690 0000 0000 0000 4600 0000 2800 0000 8000 0000 9000 0000 0100*1000 0300 0000 0090 0000 A00F 0000 A00F 0000 0000 0000 0000 0000*00F8 0000 E007 0000 1F00 0000 0000 0000*02F1 84F1 04F1 84F1 84F1 06F2 84F1 06F2 04F2 86F2 06F2 86F2 86F2 .... .... BMP文件可分为四个部分:位图文件头、位图信息头、彩色板、图像数据阵列,在上图中已用*分隔。 一、图像文件头 1)1:(这里的数字代表的是"字",即两个字节,下同)图像文件头。424Dh=’BM’,表示是Windows支持的BMP格式。 2)2-3:整个文件大小。4690 0000,为00009046h=36934。 3)4-5:保留,必须设置为0。 4)6-7:从文件开始到位图数据之间的偏移量。4600 0000,为00000046h=70,上面的文件头就是35字=70字节。 5)8-9:位图图信息头长度。 6)10-11:位图宽度,以像素为单位。8000 0000,为00000080h=128。 7)12-13:位图高度,以像素为单位。9000 0000,为00000090h=144。 8)14:位图的位面数,该值总是1。0100,为0001h=1。 二、位图信息头 9)15:每个像素的位数。有1(单色),4(16色),8(256色),16(64K 色,高彩色),24(16M色,真彩色),32(4096M色,增强型真彩色)。1000为0010h=16。 10)16-17:压缩说明:有0(不压缩),1(RLE 8,8位RLE压缩),2(RLE 4,4位RLE压缩,3(Bitfields,位域存放)。RLE简单地说是采用像素数+像素值的方式进行压缩。T408采用的是位域存放方式,用两个字节表示一个像素,位域分配为r5b6g5。图中0300 0000为00000003h=3。 11)18-19:用字节数表示的位图数据的大小,该数必须是4的倍数,数值上等于位图宽度×位图高度×每个像素位数。0090 0000为 00009000h=80×90×2h=36864。

DICOM图像最大密度投影

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%% Share Information %%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%% Tag:Matlab, Medical Imaging, DICOM %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 标题:DICOM图像最大密度投影 %% 内容:对DICOM图像最大密度投影 %% 作者:Destiny %% 日期:2012-10-05 %% 是否转载:否 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%% MIP %%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %For initial P = zeros(249,512); %To store the final result CP = zeros(1,512); %To store the line-image after projection % for each image on coronal plane %For read all images automaticly filename = dir('*.dcm'); [r c]=size(filename); %Maximum Intensity Projection for a = 1:r %For each image, read it by using dicominfo() an dicomread() %str = sprintf(filename(a).name); info=dicominfo(filename(a).name); Y = dicomread(info); %Get the image size [m,n] = size(Y); %For each DICOM image, find its maximum value in coronal plane CP = max(Y,[],1); %For final result, add line-images into the matrix P with the size %249*512 P(r-a+1,:) = CP; end figure,imshow(P,[])%Here use [] to show P, % make P's minumum values into 0, % while Maximum values into 255.

BMP图像的读写(8位和24位)

南通大学计算机科学与技术学院 《数字图像处理》课程实验 报告书 实验名 BMP文件的读写(8位和24位) 班级计 121 姓名张进 学号 1213022016 2014年6月 16 日

一、实验内容 1、了解BMP文件的结构 2、8位位图和24位位图的读取 二、BMP图形文件简介 BMP(Bitmap-File)图形文件是Windows采用的图形文件格式,在Windows环境下运行的所有图象处理软件都支持BMP图象文件格式。Windows系统内部各图像绘制操作都是以BMP为基础的。Windows 3.0以前的BMP图文件格式与显示设备有关,因此把这种BMP 图象文件格式称为设备相关位图DDB(device-dependent bitmap)文件格式。Windows 3.0以后的BMP图象文件与显示设备无关,因此把这种BMP图象文件格式称为设备无关位图DIB(device-independent bitmap)格式(注:Windows 3.0以后,在系统中仍然存在DDB位图,象BitBlt()这种函数就是基于DDB位图的,只不过如果你想将图像以BMP格式保存到磁盘文件中时,微软极力推荐你以DIB格式保存),目的是为了让Windows能够在任何类型的显示设备上显示所存储的图象。BMP位图文件默认的文件扩展名是BMP或者bmp(有时它也会以.DIB或.RLE作扩展名)。 位图文件可看成由4个部分组成:位图文件头(bitmap-file header)、位图信息头(bitmap-information header)、彩色表(color table)和定义位图的字节阵列,它具有如下所示的形式。 位图文件结构内容摘要

BMP文件格式

BMP文件格式 简介 BMP(Bitmap-File)图形文件是Windows采用的图形文件格式,在Windows环境下运行的所有图象处理软件都支持BMP图象文件格式。Wi ndows系统内部各图像绘制操作都是以BMP为基础的。Windows 3.0以前的BMP图文件格式与显示设备有关,因此把这种BMP图象文件格式称为设备相关位图DDB(device-dependent bitmap)文件格式。Windows 3.0以后的BMP图象文件与显示设备无关,因此把这种BM P图象文件格式称为设备无关位图DIB(device-independent bitmap)格式(注:Windows 3.0以后,在系统中仍然存在DDB位图,象BitBl t()这种函数就是基于DDB位图的,只不过如果你想将图像以BMP格式保存到磁盘文件中时,微软极力推荐你以DIB格式保存),目的是为了让Windows能够在任何类型的显示设备上显示所存储的图象。BMP位图文件默认的文件扩展名是BMP或者bmp(有时它也会以.DIB 或.RLE作扩展名)。 此图用WinHex软件打开后结果如下:(在介绍完bmp文件格式后会具体分析这些数字,最后也有matlab对此图的分析)注:此图是24位真彩色图。 文件结构 位图文件可看成由4个部分组成:位图文件头(bitmap-file header)、位图信息头(bitmap-information header)、彩色表(color table)和定义位图的字节阵列,它具有如下所示的形式。

位图文件结构可综合在表6-01中。表01 位图文件结构内容摘要

构件详解 1. 位图文件头 位图文件头包含有关于文件类型、文件大小、存放位置等信息,在Windows 3.0以上版本的位图文件中用BITMAPFILEHEADER结构来定义: typedef struct tagBITMAPFILEHEADER { /* bmfh */ UINT bfType; DWORD bfSize; UINT bfReserved1; UINT bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER; 其中: bfType 说明文件的类型.(该值必需是0x4D42,也就是字符'BM'。我们不需要判断OS/2的位图标识,这么做现在来看似乎已经没有什么意义了,而且如果要支持OS/2的位图,程序将变得很繁琐。所以,在此只建议你检察'BM'标识) bfSize 说明文件的大小,用字节为单位bfReserved1 保留,必须设置为0

BMP图像格式分析

BMP图像格式分析 BMP图像文件格式是微软公司为其Windows环境设置的标准图像格式,而且 Windows系统软件中还同时内含了一系列支持BMP图像处理的API函数,随着Windows 在世界范围内的不断普及,BMP文件格式无疑也已经成为PC机上的流行图像文件格式。它的主要特点可以概括为:文件结构与PCX文件格式类似,每个文件只能存放一幅图像;图像数据是否采用压缩方式存放,取决于文件的大小与格式,即压缩处理成为图像文件的一个选项,用户可以根据需要进行选择。其中,非压缩格式是BMP图像文件所采用的一种通用格式。但是,如果用户确定将BMP文件格式压缩处理,则Windows设计了两种压缩方式:如果图像为16色模式,则采用RLE4压缩方式,若图像为256色模式,则采用RLE8压缩方式。同时,BMP 图像文件格式可以存储单色、16色、256色以及真彩色四种图像数据,,其数据的排列顺序与一般文件不同,它以图像的左下角为起点存储图像,而不是以图像的左上角为起点;而且BMP图像文件格式中还存在另外一个与众不同的特点,即其调色板数据所采用的数据结构中,红、绿、蓝三种基色数据的排列顺序也恰好与其它图像文件格式相反。总之,BMP图像文件格式拥有许多适合于Windows环境的新特色,而且随着Windows版本的不断更新,微软公司也在不断改进其BMP 图像文件格式,例如:当前BMP图像文件版本中允许采用32位颜色表,而且针对32位Windows 的产生,相应的API 函数也在不断地报陈出新,这些无疑都同时促成了BMP文件格式的不断风靡。但由于BMP文件格式只适合于Windows上的应用软件,而对于DOS环境中的各种应用软件则无法提供相应的支持手段,因此这无疑是阻碍BMP文件格式的流通程度超过PCX文件格式的一个重要因素。 Windows中定义了两种位图文件类型,即一般位图文件格式与设备无关位图文件格式。其中,由于设备无关位图(DIB)文件格式具有更强的灵活性与完整的图像数据、压缩方式等定义。BMP图像文件的结构可以分为如下三个部分:文件头、调色板数据以及图像数据。其中文件头的长度为固定值54个字节;调色板数据对所有不超过256色的图像模式都需要进行设置,即使是单色图像模式也不例外,但是对于真彩色图像模式,其对应的BMP文件结构中却不存在相应调色板数据的设置信息;图像数据既可以采用一定的压缩算法进行处理,也可以不必对图像数据进行压缩处理,这不仅与图像文件的大小相关,而且也与对应的图像处理软件是否支持经过压缩处理的BMP图像文件相关。以下将分别介绍BMP图像文件结构中的这三个重要组成部分。特别值得注意的是:BMP 图像文件结构设计得相当简单,这无疑有利于图像文件的处理速度,但是同时也使得 BMP图像文件格式具有一定的局限性,即一个BMP图像文件只能存储一幅图像。 BMP图像文件的文件头定义 Windows中将BMP图像文件的文件头分成两个数据结构,其中一个数据结构中包含BMP文件的类型、大小和打印格式等信息,称为BITMAPFILEHEADERl另外一个数据结构中则包含BMP文件的尺寸定义等信息,称为BITMAPINFOHEADERl 如果图像文件还需要调色板数据,则将其存放在文件头信息之后。 BITMAPFIlEHEADER数据结构在Windows.h中的定义为: typedef struCttagBITMAPFIlEHEADER { WORD bftype; DWORD bfsiZe: WORD bfReservedl; WORD bgReserved2: DWORD bfoffBits: }BITMAPFILEHEADER; 其中,bfrype在图像文件存储空间中的数据地址为0,数据类型为unsignedchar,内容为固定值“BM”,用于标志文件格式,表示该图像文件为BMP文件。 bfsize的数据地址为2,类型为unsignedlong,它以字节为单位,定义位图文件的大小。 bfReservedl与bfReserved2的数据地址分别为6和8,数据类型则都为unsignedint,二者都是BMP文件的保留字,没有任何意义,其值必须为0. bfoffBits的数据地址为10,数据类型为unsignedlong,它以字节为单位,指示图像数据在文件内的起始地址,即图像数

Bmp图像存储格式

摘要:本文简单介绍了位图文件的两种存储格式,并且在VC++6.0下实现了读取位图文件中的数据,用SetPixel()函数在窗口中重现图像,最后在 程序中实现了一种存储格式到另一种存储格式的转换。 关键字:BMP、灰度位图、24位真彩色位图、存储格式 一、前言 BMP(Bitmap的缩写)图像是指文件名后缀为BMP的位图图像。位图图像在计算机中使用很广泛,例如在windows中,记事本、写字板中的文字就是用位图图像表示出来的。许多以其它格式存储的图像,就是在位图图像的基础上,进行优化处理后得到的,例如JPEG图像等。 在数字图像处理中,许多算法就是针对24位真彩色位图或灰度位图设计的。因此,很有必要介绍一下位图文件的这两种存储格式。 二、24位真彩色图像存储格式 把下图的24位真彩色图像格式在16位编辑器(例如VC编辑器)中打开,可以看到图像的二进制数据。 24位真彩色的二进制数据为: 这是24位真彩色位图文件数据一部分。这一部分数据包括位图文件头、位图信息头和位图阵列三部分。 (一)位图文件头 位图文件头用来记录标志文件大小的一些信息,在文件中占14个字节,存储的内容如下: 字节 1 2 3 4 5 6 7 8 9 10 11 12 13 14 000000 42 4D CC B4 02 00 00 00 00 00 36 00 00 00 其中: 42 4D 为位图的标志,即ASCII码为BM CC B4 02 表示位图文件的总字节数,换算成十进制为 (02B4CC)H=(177356)10,即这副图像的大小为177356字节。 00 00 00 00 00 为保留字节,用来存储文件大小的数据。 36 00 00 00 00 表示位图阵列的起始位置,(36)H=(54)10即54字节开始为位 图阵列。 (二) 位图信息头 位图信息头记录和位图相关的一些信息,在文件中占40个字节,存储的内容如下: 字节 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 00000 0 2 8 00001 6 0 2 C 1 C 5 1 1 8 00003 2 0 1 2 B 1 2 B 00004 8 0 其中:

DICOM图像读取

Windows平台下多层DICOM图像读取与显示的方法 【摘要】目的实现Windows环境下读取与显示多层DICOM格式图像,为医学图像三维配准与重建等后处理提供数据。方法针对DICOM文件格式,在Visual C++6.0下设计了简化的图像类结构,将多层DICOM图像的相关数据读入到动态数组中,并转换成BMP位图实现在Windows环境下不同层图像间的切换显示。结果选取CT、MR、PET等不同模态的DICOM图像进行实验,均可正确读取。结论通过解析DICOM图像文件存储格式,实现了多层DICOM图像文件的读取与不同层间的切换显示。本程序运行于Windows环境,不依赖于具体DICOM工作站,便于科研教学使用。 【关键词】多层DICOM图像读取;图像显示;医学图像后处理;数据元素;窗宽窗位 A method of reading and displaying multi-slice DICOM images under Windows ZHU Zhi-liang,YANG Ye,WANG Bei-lei,et al.Biomedical and Multimedia Information Technology Group,Northeastern University,Shenyang110004,China [Abstract]Objective To implement reading and displaying multi-slice DICOM images under Windows environment.Methods According to the format of DICOM file,we designed the simplified DICOM class under Visual C++6.0.We read the information of multi-slices DICOM images into dynamic array and translated the DICOM file into BMP file to realize switched displaying of DICOM image under Windows environment.Results We tested with several DICOM images from different modalities,all images could be properly read and displayed.Conclusion The software of this article realizes the reading and switched displaying of multi-slice DICOM images.It runs under Windows that was independent on DICOM image work station and can provide data for medical image of3-dimensional registration and reconstruction. [Key words]read of multi-slice DICOM images;image display;medical image postprocess;data element;window center-window width 医学数字成像和传输(Digital Imaging and Communications in Medicine,DICOM)[1]是用于医学图像存储和通信的国际标准,规范了医学图像及各种数字信息在异构系统和设备之间存储、传送时的文件格式和语义描述,为不同的医学影像设备提供了一个一致性的接口,以实现数字影像在各种医学影像设备间的交换传输。随着DICOM标准的不断发展,现在生产的各种医疗设备(如CT、PET、MRI等)都已采用DICOM30标准的数字接口。 目前,多数DICOM图像浏览软件都基于UNIX平台且仅能读取与显示一幅图像,而在科研和教学中常需要在Windows环境下显示处理DICOM图像。另外,对医学图像进行后处理如三维配准及重建之前,首先要得到多层DICOM图像的信息,故本文对在Windows 环境下读取与显示多层DICOM图像的方法进行了初步研究,现将结果阐述如下。 1资料与方法 11DICOM文件格式DICOM文件是采用面向对象的方法来设计和编码的,每个文件有一个信息对象(IOD)与之相关联,信息对象的属性由数据元素来表示,而且对象的属性只能编码一次,用UID标识符来唯一标识[2]。DICOM文件一般可分为文件头和数据集两部分。文件头又有两部分:开头有128个字节的同步码,通常以十六进制的00填充;紧随其后4个字节的ASCII码“DICM”是所有DICOM数据文件的标识符。数据集是一些数据元的有序集合,其中包含诸如受检者信息、成像的技术参数、医生诊断信息、图像数据等资料。数据元一般由标签(TAG)、值表示(value representation,VR)、值长度(value

DICOM图像浏览器

Image Viewer using Digital Imaging and Communications in Medicine (DICOM) Trupti N. Baraskar Department of Information Technology, Maharashtra Institute of Technology, Pune University, Maharashtra, India Email: trupti_001@https://www.360docs.net/doc/5516269263.html,, baraskartn@https://www.360docs.net/doc/5516269263.html, Mobile No. +91-9922789956, +91-20-25462867 Abstract- Digital Imaging and Communications in Medicine is a standard for handling, storing, printing, and transmitting information in medical imaging. The National Electrical Manufacturers Association holds the copyright to this standard. It was developed by the DICOM Standards committee. The other image viewers cannot collectively store the image details as well as the patient's information. So the image may get separated from the details, but DICOM file format stores the patient's information and the image details. Main objective is to develop a DICOM image viewer. The image viewer will open .dcm i.e. DICOM image file and also will have additional features such as zoom in, zoom out, black and white inverter, magnifier, blur, B/W inverter, horizontal and vertical flipping, sharpening, contrast, brightness and .gif converter are incorporated. Keyword - Digital Imaging and Communication in Medicine (DICOM), National Electrical Manufacturers Association (NEMA), Information Object Definitions (IOD), Value Representation (VR). I.Introduction DICOM stands for Digital Imaging and Communication in Medicine. The DICOM standard addresses the basic connectivity between different imaging devices and also the workflow in a medical imaging department. The DICOM standard was created by the National Electrical Manufacturers Association (NEMA) and it also addresses distribution and viewing of medical images. The standard comprises of 16 parts [1] and it is freely available at the NEMA website: https://www.360docs.net/doc/5516269263.html,./dicom.html[2] .Within the innards of the standard are also contained a detailed specification of the file format for images. The latest version of the document is as of 2008[3]. In this article present a viewer for DICOM images DICOM Image File Format This present a brief description of the DICOM image file format. Like other image file formats, a DICOM file consists of a header, followed by pixel data. The header comprises of the patient name and other patient particulars and image details. Important in the image details are the image dimensions - width, height and image bits per pixel. All these details are hidden inside the DICOM file in the form of tags and their values. Before it gets into tags and values, a brief about DICOM itself and related terminology is in place. In what follows, this explains only those terms and concepts related to a DICOM file. In particular, this does not discuss the communication and network aspects of the DICOM standard. Everything in DICOM is an object - medical device, patient, etc. An object, as in object oriented programming is characterized by attributes. DICOM objects are standardized according to IODs (Information Object Definitions). An IOD is a collection of attributes describing a data object. In other words, an IOD is a data abstraction of a class of similar real world objects which defines the nature and attributes relevant to that class [4]. DICOM has also standardized on the most commonly used attributes and these are listed in the DICOM data dictionary [6]. An application which does not find a needed attribute name in this standardized list may add its own private entry, termed as a private tag; proprietary attributes are therefore possible in DICOM. Examples of attributes are study date, patient name, modality, transfer syntax UID, etc. As it can be seen, the attributes require different data types for correct representation. This “data type” is termed as Value Representation (VR) in DICOM. There are 27 such VRs defined[5], and these are AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, OB, OF, OW, PN, SH, SL, SQ, SS, ST, TM, UI, UL, UN, US, and UT. For example, DT represents Date Time, a concatenated date time character string in the format YYYYMMDDHHMMSS.FFFFFF&ZZXX. An important characteristic of VR is its length, which should always be even. Characterizing an attribute are its tag, VR, VM (Value Multiplicity) and value. A tag is a 4 byte value which uniquely identifies that attribute. A tag is divided into two parts, the Group Tag and the Element Tag, each of which is of length 2 bytes. For example, the tag 0010 0020 (in hexadecimal) represents Patient ID, with a VR of LO (Long String). In this example, 0010 (hex) is the group tag, and 0020 (hex) is the element tag. The DICOM data dictionary gives a list of all the standardized group and element tags. Also important is to know whether a tag is mandatory or not. For data element type, five categories are defined - Type 1, Type 1C, Type 2, Type 2C, and Type 3. One more important concept is transfer syntax. In simple terms, it tells whether a device can accept the data sent by another device. Each CP1324,I nt e r nat i onal Conf e r e nc e on M e t hods and M ode l s i n Sc i e nc e and Te c hnol ogy (I CM 2ST-10) e di t e d by R. B. Pa t e l a nd B. P. Si ngh ? 2010 A m e r i c a n I ns t i t ut e of Phys i c s 978-0-7354-0879-1/10/$30.00

相关主题
相关文档
最新文档