dicom

Python convert .dcm to .png, images are too bright

做~自己de王妃 提交于 2020-02-24 11:14:45
问题 I have to convert some files which come by default as .dcm to .png , I've found some code samples to achieve that around here but the end results are too bright. Could anybody have a look at this, please? def convert_to_png(file): ds = pydicom.dcmread(file) shape = ds.pixel_array.shape # Convert to float to avoid overflow or underflow losses. image_2d = ds.pixel_array.astype(float) # Rescaling grey scale between 0-255 image_2d_scaled = (np.maximum(image_2d,0) / image_2d.max()) * 255.0 #

pydicom读取dicom文件报错

☆樱花仙子☆ 提交于 2020-02-21 06:09:02
之前采用pydicom读取dicom文件一切都很正常,不过最近读取一批数据的时候,会报错 读取代码 file = pydicom.read_file(filepath) data = file.pixel_array 问题就出在pixel_array这个属性上,报错如下 OSError Traceback (most recent call last) c:\python35\lib\site-packages\pydicom\pixel_data_handlers\pillow_handler.py in get_pixeldata(dicom_dataset) 196 fio = io.BytesIO(pixel_data) --> 197 decompressed_image = Image.open(fio) 198 except IOError as e: c:\python35\lib\site-packages\PIL\Image.py in open(fp, mode) 2571 raise IOError("cannot identify image file %r" -> 2572 % (filename if filename else fp)) 2573 OSError: cannot identify image file <_io.BytesIO

Load Dicom image and display it - using ClearCanvas library

对着背影说爱祢 提交于 2020-02-12 08:43:00
问题 This is a very narrow and specific question, but I know there are someone else out there using this, so I'll keep my fingers crossed and hope anyone of you pics this question up. I'm working on a WPF application where one part of it is a Dicom viewer. We'd like to use a 3rd party component to handle the Dicom stuff, and ClearCanvas is the one we've got the best impression of this far. We're able to load a Dicom file and fetch the attributes, but we're having problems putting the image data on

Load Dicom image and display it - using ClearCanvas library

扶醉桌前 提交于 2020-02-12 08:41:14
问题 This is a very narrow and specific question, but I know there are someone else out there using this, so I'll keep my fingers crossed and hope anyone of you pics this question up. I'm working on a WPF application where one part of it is a Dicom viewer. We'd like to use a 3rd party component to handle the Dicom stuff, and ClearCanvas is the one we've got the best impression of this far. We're able to load a Dicom file and fetch the attributes, but we're having problems putting the image data on

convert stack of DICOM Images into vti file

為{幸葍}努か 提交于 2020-02-06 19:00:13
问题 I've downloaded ActiViz.NET 5.8 to use it in my C# application, now the examples I downloaded show 3D by reading a vti file.. How can I create a vti file from a stack of images? Thank you 回答1: Simply use gdcm2vtk from the command line: $ gdcm2vtk DICOM_input_directory output.vti See gdcm2vtk man page. Of course GDCM is wrapped in C# language so the command line can be used from any Activiz.NET + GDCM application. On debian/linux, simply do: $ sudo apt-get install libvtkgdcm-tools On windows

DICOM C-StoreSCP: How to know in advance number of images SCU will send?

那年仲夏 提交于 2020-02-05 04:08:18
问题 I have DICOM C-StoreSCP application which receives DICOM images from my other C-StoreSCU application. My SCU always send one (and only one) and complete (all images from given study) study on one association. So SCP always know that all images received from SCU belong to single study. I know I can also check StudyIUID; but that is not my point of interest here. I want to know total number of images in study that is being transferred. Using this data, I want to display status like "Received 3

fo-dicom - How can I download dcm images from PACS and save them?

别等时光非礼了梦想. 提交于 2020-01-24 22:55:08
问题 I'm trying to download dcm image from PACS server, but this is generating an empty dcm file. Following is the code: public void VisoresPacsController(string ipAddress, string aeTitle, string accessId, int port) { /* this.ipAddress = ipAddress; this.aeTitle = aeTitle; this.accessId = accessId; this.port = port; visores.Add(new VisorCommandLine("Radiant", "")); ///new DicomCStoreRequest. */ DicomClient client = new DicomClient(); var query = DicomCFindRequest.CreateImageQuery("1.2.250.1.31.2

医学图像了解

孤街浪徒 提交于 2020-01-24 07:48:02
医学图像 医学图像是反映解剖区域内部结构或内部功能的图像,它是由一组图像元素——像素(2D)或立体像素(3D)组成的。医学图像是由采样或重建产生的离散性图像表征,它能将数值映射到不同的空间位置上。像素的数量是用来描述某一成像设备下的医学成像的,同时也是描述解剖及其功能细节的一种表达方式。像素所表达的具体数值是由成像设备、成像协议、影像重建以及后期加工所决定的 医学图像有四个关键成分——像素深度、光度表示、元数据和像素数据。这些成分与图像大小和图像分辨率有关 图像深度 (又称比特深度或颜色深度)是用来编码每个像素信息的比特数。比如说,一个8比特的光栅可以有256个从0到255数值不等的图像深度 光度表示 解释了像素数据如何以正确的图像格式(单色或彩色图片)显示。为了说明像素数值中是否存在色彩信息,我们将引入“每像素采样数”的概念。单色图像只有一个“每像素采样”,而且图像中没有色彩信息。图像是依靠由黑到白的灰阶来显示的,灰阶的数目很明显取决于用来储存样本的比特数。在这里,灰阶数与像素深度是一致的。医疗放射图像,比如CT图像和磁共振(MR)图像,是一个灰阶的“光度表示”。而核医学图像,比如正电子发射断层图像(PET)和单光子发射断层图像(SPECT),通常都是以彩色映射或调色板来显示的 元数据 是用于描述图像的信息。它可能看起来会比较奇怪,但是在任何一个文件格式中,除了像素数据之外

Dicom 基本知识-数据结构篇

蹲街弑〆低调 提交于 2020-01-19 03:13:59
阅读本文大概需要6分钟 'DICOM’数据是医疗影像的关键,一个 .dcm 文件保存了单次诊断的全部信息(病人信息+图像数据),通过读取解析 .dcm 文件可以获取所有信息。 DICOM 文件结构 打开任意一个 .dcm 文件,使用16进制打开,可以看到如下结构: 导言 导言部分128字节,可以直接跳过。 前缀 前缀标识的一个 dicm 文件,总共4个字节。 数据元素 在前缀后面就是真正的数据元素来。 从数据元素开始,均是以 key , value 的形式提供,每个 tag 就是 dicom 里面定义好的字典,我们在解析时根据需要只需关注特定的 tag 即可, dicom 全部的 tag 至少有 2000个。 好了, Dicom 基本数据结构就这样,刚开始学习时可以自己动手解析下,体验下上面说的几个步骤。实际工作或者软件开发中都是使用第三方开源库进行操作,比如比较著名的 C++ 系的 DCMTK , JAVA 系的 dcm4che , python 系的 pyDicom 等等,本文乃至以后的文章主要以 DCMTK 为主. DICOM-Tag说明 1 患者信息(整个SERIES一样) Tag 描述 例子 0010 0010 patient’s name(患者名字) zhangsan 0010 0020 patient ID(患者ID) 100034251 0010 0030

Error in Reading DICOM File: Number of bytes in PixelData not specified

本秂侑毒 提交于 2020-01-17 04:41:07
问题 I am using readDICOMFile in R to read DICOM file as following: dcmImages <- readDICOMFile("/home/darshil/Downloads/BREBIX/CT10 ponction foie/DEF. VEINEUX - 107205/IM-0001-0001.dcm",debug = TRUE, pixelData = FALSE) However, I get following error: Error in parsePixelData(fraw[(bstart + dcm$data.seek):fsize], hdr, endian, : Number of bytes in PixelData not specified; guess = 1 If I put pixelData=FALSE , it is successful in reading only the header. But I also want the Image part. I am using