bilgelm / dynamicpet

Dynamic positron emission tomography (PET) analysis
MIT License
6 stars 8 forks source link

"Ill conditioned matrix" while trying to run kineticmodel SRTM #135

Open cepa995 opened 1 week ago

cepa995 commented 1 week ago

Hi,

I have successfully managed to clone and install your package, and I tried out SRTM method on my own data where as a reference mask I've used whole brain mask (for testing purposes).

Problem I am running into is that during the computation of DVR, while trying to fit Linear Regression model, it always seems to hit the LinAlgException where the b cannot be solved due to Ill-conditioned matrix, specifically at lines 254:

image

as well as line 311:

image

Although this may be "just a warning", could you help me understand the root of this issue and how can I address it? Why, and what matrix exactly is ill-conditioned?

Thanks!

bilgelm commented 4 hours ago

Hi @cepa995, thanks for your question!

Both of these computations are performed per voxel. I'm imaging that the warnings you're seeing are being generated at a small number of voxels relative to the number of voxels in the brain mask – perhaps some background voxels that got included in the mask you're using, or a voxel in or near the ventricles, or some other voxel where there isn't a clear time activity curve. The ill-conditioned matrix warning could also be stemming from voxels (especially voxels in the reference region) where the time activity curve (TAC) is very close to the mean TAC in the reference region. This would mean that the 2nd and 3rd columns of the matrix x are almost collinear, making it difficult to solve the linear system.