- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我试图用 Python 完成的事情(请记住,我对 Python 比较陌生):
到目前为止,我已经能够读取 dicom 图像并通过使用 pydicom 和 numpy 将它们转换为数组。我还能够通过几个 for 循环提取像素和坐标值,并将该列表导出为 .csv。但是必须有更好的方法来保持某种质量控制,因为当我尝试重新生成图像时(通过使用另一组 for 循环),我没有得到原始图像。
我需要这两个函数在不同的 python 脚本中分别运行。
这是我目前所拥有的:
#Raster through all pixels and copy each value and coordinates to arrays
rc_cntr = 0
for r in range(0,img_rows):
for c in range(0,img_cols):
pixel = dcmarray[r, c]
rArray[rc_cntr] = r
cArray[rc_cntr] = c
zArray[rc_cntr] = z_cntr
imgArray[rc_cntr] = dcmarray[r,c]
rc_cntr = rc_cntr + 1;
#Combine arrays into one file
XYZV = numpy.column_stack([rArray,cArray,zArray, imgArray])
numpy.savetxt(output_path,XYZV,'%0i','\t') #Save XYZV files for each image
如有任何帮助,我们将不胜感激。
干杯 AFH
最佳答案
我对DICOM不是很熟悉,但是看pydicom docs我认为以下应该有效:
import dicom
import numpy as np
ds = dicom.read_file('your_file.dcm')
planes, rows, cols = ds.NumberofFrames, ds.Columns, ds.Rows
image = ds.pixel_array # should have shape (planes, rows, cols)
# to get data and coords to write to CSV
image_data = image.ravel()
z, y, x = np.meshgrid(np.arange(planes), np.arange(rows), np.arange(cols),
indexing='ij').T
# to write CSV read image back into DICOM file
planes, rows, cols = np.ptp(z)+1, np.ptp(y)+1, np.ptp(x)+1
image = np.zeros((planes, rows, cols), dtype=image_data.dtype)
image[z, y, x] = image_data
ds.NumberofFrames, ds.Columns, ds.Rows = planes, rows, cols
ds.PixelData = image.tostring()
ds.save_as('another_file.dcm')
关于python - 将 DICOM 图像转换为 XYZ 坐标及其值的列表 - Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17824949/
我正在尝试将一个 DICOM 实例(在我的例子中是一个图像)从一个应用程序发送到一个服务器。但不知何故,它并没有发生。 日志显示某些标签丢失。 那么在 DICOM 关联(在我的例子中是 C-STORE
我所说的方向是指例如从患者的头部到底部或从他的底部到头部。到目前为止,我所看到的胸部 CT 扫描表明,实例编号 1 切片通常是从 body 上部向下的第一个切片,但我不知道这是标准的一部分还是我应该做
我知道单帧和多帧 dicom 图像文件。我想了解电影 dicom 图像,还有其他 dicom 图像格式。 最佳答案 正如您提到的,Alon 在他的评论中提到,DICOM 文件格式支持单帧和多帧像素数据
在处理 DICOM 研究、系列和媒体概念时,我想知道这些值是对所有数据都是唯一的,还是仅对它们所属的患者而言是唯一的。 换句话说;我可以让 2 名患者的研究/系列/sop 实例 uid 对这两名患者具
我有两个 图片 来自同一系列,但两个图像具有相同的 实例编号 6. 有可能吗????根据我的理解,系列实例编号对于该系列中的图像来说是唯一的。所以请帮助我......无论如何,是否可以从模态工作站??
我需要在像 firefox/chrome 这样的浏览器上显示 DICOM 图像。我遇到了这个名为 DWV 的查看器 - https://github.com/ivmartel/dwv . 我想知道是否
我遇到了在私有(private)标签中包含序列的 DICOM 对象;该序列中的每个项目都包含其自己的特定字符集 (0008,0005)。所有特定字符集元素都具有相同的值。 我还发现这些额外的特定字符集
如何识别 dicom 图像是否为压缩格式?还想知道如何读取压缩图像像素数据? 最佳答案 您可以使用命令行工具转储此类信息,例如 gdcminfo: $ gdcminfo 012345.002.050.
是否可以通过读取该研究中文件的 DICOM 头来找到 DICOM 研究中的图像数量? 我正在开发一个 Java 应用程序,它接收来自不同来源的 DICOM 研究。我只是想检查一份研究是否已经完全收到。
我必须从文件夹中选择所有有效的 DICOM 文件。我可以递归地从具有 *.DCM 扩展名的文件夹中选择所有文件。但是任何带有 *.DCM 的文件也会被拾取,并且此类文件不是有效的 DICOM 文件。
我有一堆 DICOM 冠状图像,我使用图像位置(患者)(0020,0032) 标签按正确的顺序对图像进行排序。 然而,该堆栈还包含一个“概述”图像,显示如何从轴向堆栈生成冠状切片 - 请参阅附件。 显
我一直在处理每个大约 4 MB 的 dicom 文件,但我最近收到了一些每个 280 KB 的文件。我不确定这是因为它们来自不同的 CT 扫描仪,还是新的 dicom 在给我之前被压缩了。有没有办法找
为了创建匿名化/去识别化工具,我想从 DICOM 文件中删除/覆盖所有不必要的标签/属性。我在互联网上搜索过,但没有找到 DICOM 文件必须使用哪些标签的明确列表。 我发现有多种类型,类型1是强制的
我有一堆 DICOM 冠状图像,我使用图像位置(患者)(0020,0032) 标签按正确的顺序对图像进行排序。 然而,该堆栈还包含一个“概述”图像,显示如何从轴向堆栈生成冠状切片 - 请参阅附件。 显
我一直在处理每个大约 4 MB 的 dicom 文件,但我最近收到了一些每个 280 KB 的文件。我不确定这是因为它们来自不同的 CT 扫描仪,还是新的 dicom 在给我之前被压缩了。有没有办法找
为了创建匿名化/去识别化工具,我想从 DICOM 文件中删除/覆盖所有不必要的标签/属性。我在互联网上搜索过,但没有找到 DICOM 文件必须使用哪些标签的明确列表。 我发现有多种类型,类型1是强制的
对不起,如果这是非常基本的,我是 DICOM 的新手。我知道 DICOM 文件有多个部分,例如:患者、研究、系列和实例(图像)。 现在要与设备通信,它需要一个传输语法,它告诉通信模式,如 Little
我在解释 DICOM 规范时遇到困难。具体来说,如果我有两个 DICOM 文件,每个文件都表示来自单个 CT 系列(同一研究)的独特 CT 切片。这两个文件都将包含 Patient 模块,因此理论上它
几天以来,我一直在使用 FO-DICOM 处理 DICOM 文件。 我正在使用一组 dicom 文件进行测试,并且我一直在打印“光度解释”和“每像素样本”值,以便更好地了解我正在处理的图像类型。 结果
AFAIK 没有 bool 值表示,我需要在私有(private)标记中指定 bool 值 true/false。 我想到了SH (短字符串),说 TRUE或 FALSE .是否有标准或广泛使用的方法
我是一名优秀的程序员,十分优秀!