0

我正在研究https://scikit-image.org/docs/dev/api/skimage.draw.html#skimage.draw.ellipse 以及skimage.draw.ellipsoid_stats(a, b, c)我引用的声明

计算半长轴与指定间距的网格尺寸对齐的椭圆体的分析表面积和体积。

但是查看他们的代码,没有关于引入间距的信息。也许我错过了一些东西。

我的问题是: - 如何在知道半径a, b, c和网格间距的情况下计算椭圆体的体积?我正在使用具有不同间距的 DICOM CT 卷。

def ellipsoid_stats(a, b, c):
    """
    Calculates analytical surface area and volume for ellipsoid with
    semimajor axes aligned with grid dimensions of specified `spacing`.
    Parameters
    ----------
    a : float
        Length of semimajor axis aligned with x-axis.
    b : float
        Length of semimajor axis aligned with y-axis.
    c : float
        Length of semimajor axis aligned with z-axis.
    Returns
    -------
    vol : float
        Calculated volume of ellipsoid.
    surf : float
        Calculated surface area of ellipsoid.
    """
    if (a <= 0) or (b <= 0) or (c <= 0):
        raise ValueError('Parameters a, b, and c must all be > 0')

    # Calculate volume & surface area
    # Surface calculation requires a >= b >= c and a != c.
    abc = [a, b, c]
    abc.sort(reverse=True)
    a = abc[0]
    b = abc[1]
    c = abc[2]

    # Volume
    vol = 4 / 3. * np.pi * a * b * c

    # Analytical ellipsoid surface area
    phi = np.arcsin((1. - (c ** 2 / (a ** 2.))) ** 0.5)
    d = float((a ** 2 - c ** 2) ** 0.5)
    m = (a ** 2 * (b ** 2 - c ** 2) /
         float(b ** 2 * (a ** 2 - c ** 2)))
    F = ellip_F(phi, m)
    E = ellip_E(phi, m)

    surf = 2 * np.pi * (c ** 2 +
                        b * c ** 2 / d * F +
                        b * d * E)

    return vol, surf
4

1 回答 1

0

scikit 函数以像素为单位为您提供结果 - 因此以像素为单位的表面积(如果您有 2D 图像)和以像素^2 为单位的体积。

对于图像,要将其转换为 CT 图像的 mm 和 mm^2,然后您需要查找 PixelSpacing 标签以获取以 mm 为单位的每个像素的大小,并使用它来转换单位.

如果您使用的是 pydicom,那么您可以使用 .PixelSpacing[0]。PixelSpacing 是一个 2 元素列表,但我知道的所有 CT 都具有相同的行/列像素间距,因此只需使用列表 PixelSpacing[0] 中的第一个元素就足够了。

于 2020-02-21T05:54:53.523 回答