小编Van*_*en_的帖子

Python 中的 DICOM 切片厚度

我正在开发一个项目,需要将 3D .stl 文件切片为一堆 DICOM 切片,并且我需要获取切片之间的距离。我已经弄清楚如何使用 Autodesk Meshmixer 在每个 DICOM 文件中包含真实的 .stl 尺寸(以毫米为单位);但是,我似乎无法获得切片之间的正确距离/厚度。

我使用 ImageJ 读取 DICOM 堆栈,体素深度(切片之间的距离,如果我没记错的话)与 X 轴上的像素尺寸相同。我想让体素深度等于 Z 轴上的切片高度

图片1 图2

正如您在最后一个屏幕截图中看到的,z 值是任意的。

这是我迄今为止所做的代码的摘要:

import numpy as np
import pyvista as pv
import os
import cv2
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from PIL import Image
import pydicom
import datetime
import time

# Load .stl
stl_file = pv.read(stl_path)

# Dimensions of the 3d file
xmin, xmax, ymin, ymax, zmin, zmax = stl_file.bounds

# Number of slices
num_slices = …
Run Code Online (Sandbox Code Playgroud)

python dicom slice python-imaging-library pydicom

2
推荐指数
1
解决办法
835
查看次数

标签 统计

dicom ×1

pydicom ×1

python ×1

python-imaging-library ×1

slice ×1