我是图像分析的新手(使用Python),我想在我的数据(CT扫描)上应用richardson_lucy deconvolution(来自skimage)。出于这个原因,我通过特定软件估算了体素数中的PSF。它的值大约是6.73体素,但我不知道如何将它用作函数中的参数。
I'm new in image analysis (with Python) and I would like to apply the richardson_lucy deconvolution (from skimage) on my data (CT scans). For this reason, I estimated the PSF in "number of voxels" by means of a specific software. Its value is roughly 6.73 voxels, but I don't know how to use it as a paramter in the function.
该函数使用PSF参数作为ndarray,所以我试过这种方式:
The function uses the PSF parameter as a ndarray, so I tried in this way:
from skimage import io from pylab import array img = io.imread ("Slice1.tif") import skimage.restoration as rst PSF = array (6.7) img_dbl = rst.richardson_lucy (img, PSF, iterations=10)它显示了这个错误: IndexError:数组的索引太多
在CT扫描中,两种不同材料之间的模糊可以链接到高斯PSF。如果您有更多关于去模糊的提示(可能比RL更好),请写下它们。
In CT scans, blurring between two different materials can be linked to a Gaussian PSF. If you have more tips for deblurring (maybe better than RL) just write them.
任何人都可以帮助我。
推荐答案遇到类似问题并仍在研究中。在我的情况下,如果我没有使用 np.uint8 作为类型,它就不起作用。 CT数据应该是16位,但只使用前12位(映射到[-1024,3096]之间的值。所以我必须将我的图像数据重新缩放到[0-255],然后才能获得除黑色或白色之外的任何值。
Have a similar problem and still researching it. In my case it didn't work if I didn't use np.uint8 as type. CT data should be 16 bit but only uses the first 12 bits (which are mapped to values between [-1024, 3096]. So I had to rescale my image data to [0-255] before getting anything than black or white out it.
如果我理解正确的话,PSF的总和应该总是1.我可以从你的问题中猜出,你认为点扩散函数是一个高斯有一个有意义的(95%的值?)传播6.7像素。在这种情况下你必须将PSF建模为高斯(这就是我来到这里)。
If I understood that correctly, the sum of the PSF should always be 1. What I can guess from your question is that you assume the point spread function to be a gaussian with a meaningful (95% of values?) spread of 6.7 pixels. In that case you would have to model the PSF as a gaussian (that's what I came here for).
您可以使用@FuzzyDuck在这篇文章中描述的方法创建一个。
You can create one with the method described by @FuzzyDuck in this post.
PSF = gkern(5,2)这将创建一个高斯5x5内核,其中和1使用@FuzzyDuck提出的方法,sigma为2.请注意,点扩散函数可以应用多次,因此您必须对这些值进行一些实验(或者使用算法来估算那个)。
This would create a gaussian 5x5 kernel with sum 1 using the proposed method by @FuzzyDuck with a sigma of 2. Note that point spread functions could be applied several times so you have to experiment a little bit with the values (or use an algorithm to approximate that).
更多推荐
图像的PSF(点扩散函数)(2D)
发布评论