当其他不重要的相同强度也存在时,如何从 MRI 图像中提取特定的感兴趣区域(非手动)?
我想从颈部图像矢状面的 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)
图像:
获得的结果:
。
我只想提取或区分特定的管状气管内通道。黑色的其他区域需要从结果中消除,并且对于这种类型的任何图像都必须自动完成此操作,这样我就不需要为不同的图像设置不同的参数。 感兴趣区域是黑色通道,即气管内区域:
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:
the 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:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论