当其他不重要的相同强度也存在时,如何从 MRI 图像中提取特定的感兴趣区域(非手动)?

发布于 2025-01-12 22:52:25 字数 1680 浏览 0 评论 0原文

我想从颈部图像矢状面的 MRI 中提取气管内区域,但在应用阈值、轮廓检测和二值掩蔽等图像处理技术之后

我发现还有其他不需要的区域,它们与所需的感兴趣区域一起被提取。

import cv2 as cv
import numpy as np

img = cv.imread('sam_mri01.jpg')
cv.imshow('pre1',img)

image_contours = np.zeros((img.shape[1],
                           img.shape[0], 1),
                          np.uint8)

binary_img = np.zeros((img.shape[1],
                         img.shape[0], 1),
                        np.uint8)

for channel in range(img.shape[2]):
    ret, thresh_img = cv.threshold(img[:, :, channel],
                               25, 255,
                                     cv.THRESH_BINARY)
    cv.imshow('pre3', thresh_img)
    contours = cv.findContours(thresh_img, 1, 1)[0]
    cv.drawContours(image_contours,
                    contours, -1,
                    (255,255,255), 1)
    cv.imshow('pre4',image_contours)

contours = cv.findContours(image_contours, cv.RETR_LIST,
                           cv.CHAIN_APPROX_SIMPLE)[0]

cv.drawContours(binary_img, [max(contours, key = cv.contourArea)],
                -1, (255, 255, 255), -1)
    
cv.imshow('result', binary_img)
cv.imwrite('result.jpg',binary_img) 
cv.waitKey(0)

图像:

颈部侧视图图像(mri)

获得的结果:

获得的结果

我只想提取或区分特定的管状气管内通道。黑色的其他区域需要从结果中消除,并且对于这种类型的任何图像都必须自动完成此操作,这样我就不需要为不同的图像设置不同的参数。 感兴趣区域是黑色通道,即气管内区域:

the black color Channel which is the endtracheal region

I want to extract the endotracheal region from the MRI of the Sagittal plane of the neck image, but after applying image processing techniques like thresholding, contour detection and binary masking,

I could find that there are other undesired regions as well which are being extracted along with the required region of interest.

import cv2 as cv
import numpy as np

img = cv.imread('sam_mri01.jpg')
cv.imshow('pre1',img)

image_contours = np.zeros((img.shape[1],
                           img.shape[0], 1),
                          np.uint8)

binary_img = np.zeros((img.shape[1],
                         img.shape[0], 1),
                        np.uint8)

for channel in range(img.shape[2]):
    ret, thresh_img = cv.threshold(img[:, :, channel],
                               25, 255,
                                     cv.THRESH_BINARY)
    cv.imshow('pre3', thresh_img)
    contours = cv.findContours(thresh_img, 1, 1)[0]
    cv.drawContours(image_contours,
                    contours, -1,
                    (255,255,255), 1)
    cv.imshow('pre4',image_contours)

contours = cv.findContours(image_contours, cv.RETR_LIST,
                           cv.CHAIN_APPROX_SIMPLE)[0]

cv.drawContours(binary_img, [max(contours, key = cv.contourArea)],
                -1, (255, 255, 255), -1)
    
cv.imshow('result', binary_img)
cv.imwrite('result.jpg',binary_img) 
cv.waitKey(0)

The image:

image of side view of neck(mri)

the result obtained:

result obtained.

I want only the particular tube-like endotracheal channel to be extracted or differentiated. the other regions in black need to be eliminated from the result and this has to be done automatically for any image of this type so that I don't need to set different parameters for different images.
The region of interest is the black coloured channel which is the endotracheal region:

the black coloured channel which is the endotracheal region

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文