我试着对大脑图像做一些基本的阈值处理。我试图找出肿瘤与大脑的比率,然后根据以下比率进行一些基本的过滤:
每个像素的强度/对侧脑组织强度
有没有办法手动获取这个背景脑像素的强度,然后计算每个像素的比率,然后才能看到这个阈值的哪个像素是"in“和"out”?
提前感谢
发布于 2022-02-22 20:31:23
当你说手动的时候,你只是用一个数字来表示背景强度?
如果是这样的话,剩下的可能是这样的:
import SimpleITK as sitk
# reading input as float so we can do floating point math
input_image = sitk.ReadImage("your_file_here.nii", sitk.sitkFloat32)
background_intensity = 42.0 # whatever value you've selected
ratio_image = input_image / background_intensity
# make a binary threshold image for ratios greater than 2.0, or whatever ratio you select
thresholded_binary_image = ratio_image > 2.0如您所见,使用SimpleITK,您可以在图像和常量数字之间执行数学和二进制操作。
如果您想要自动确定背景值,可以检查图像的直方图。
https://stackoverflow.com/questions/71209855
复制相似问题