我正在尝试开发一种自动脑肿瘤分割算法。我目前正在使用“使用对称性的边界框方法”算法,由B提出。 Saha、N. Ray、R. Greiner、A. Murtha、H. 张。我对他们的代码进行了很大的改进和扩展,现在可以成功地自动分割出肿瘤(质量不错)。
但是,他们提供的代码有一个缺点。如果肿瘤是黑色的,那么它会检测到错误的一侧。
任何人都可以从编程/理论上提供建议,我应该如何解决这个问题。
正如我在评论中所写的(并在这里再次写下以供将来的问答):
在自动检测步骤之后,您可以尝试做一些小检查,以验证您是否感染了肿瘤。这可以通过检查感兴趣区域的直方图的均匀性来完成。肿瘤区域似乎不如健康组织均匀。
请注意,这取决于图像的一般属性。有时,大脑中的常规组织也可能具有较低的同质性(例如您在编辑之前附加的文件中的“image2”)。
@Adiel 提供的建议非常完美,非常感谢他。不过,我在这里提供代码来查找和比较两个图像的同质性(Matlab 的代码)。这可能会帮助像我这样的其他人。
homogeniety1= graycoprops(uint8(left),'Homogeneity'); %left box of image
homogeniety2= graycoprops(uint8(right),'Homogeneity'); %right box of image
homogeniety1 = struct2cell(homogeniety1); % converting the homogeniety struct to
homogeniety2 = struct2cell(homogeniety2); % cell (help to get value in the struct)
if homogeniety1{1}<homogeniety2{1} % finally comparing the value
// some stuff
end
在您的代码中,感兴趣区域图像本身检测到错误的区域,因此区域的下限和上限值可能存在问题。如果您可以提供代码,那么建议会更准确。
示例代码:
# Normalize the intensity using histogram equalization
normalized_image = cv2.equalizeHist(image)
# Fine-tune these parameters based on your images
lower_bound = 100
upper_bound = 200
# Apply adaptive thresholding with adjusted bounds
adaptive_threshold = cv2.adaptiveThreshold(normalized_image, 255,
cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY,
blockSize=11, C=2)
# Apply a binary mask to focus on the region of interest
roi_image = cv2.bitwise_and(normalized_image, normalized_image, mask=adaptive_threshold)