JinghaoLu / MIN1PIPE

A MINiscope 1-photon-based Calcium Imaging Signal Extraction PIPEline.
GNU General Public License v3.0
56 stars 25 forks source link

error: Insufficient number of outputs from right hand side of equal sign to satisfy assignment. (dominant_patch) #59

Open ChrisK-M opened 3 years ago

ChrisK-M commented 3 years ago

For one of my msCam directories, line 16 in the dominant_patch code gives me the error: "Insufficient number of outputs from right hand side of equal sign to satisfy assignment." (similar error to one of the closed issues, but different source.)

Insights from my troubleshooting efforts:

Should these 0.5-valued msktt matrices be able to ever occur?

When regionprops does return an empty structure, how best to adjust code to catch that? I'm tempted to just have mask refer to the entire image in those cases, but not really understanding how all the parts do their full magic together, I don't know if that is a correct workaround or that it has negative side7-effects

Thanks for any insights, Chris

JinghaoLu commented 3 years ago

Hi Chris, sorry it takes so long to reply. I have been preparing for my dissertation recently intensely. For the issue you mentioned, it is actually caused by a dead pixel in your video (139,223) that is super bright, so that when rescaling the image pixel range, it underestimate all the other pixels. This results in the processed image for calculating the dominant patch to include none info.

The simple workaround might be to insert a line of code between line 9 and 10 to remove/soften the bad pixel, either using imgaussfilt or medfilt2. This should not and does not usually happen, but if that is more and more common, I might need to add some code to ensure this issue is handled well in the future.

For the purpose of this part, it is actually another layer of filter to remove the spatially unrealistic false positives that are outside of the focal area within the FOV (for example, the dirt or edge of the grin lens reflecting light but is outside of the illuminated center area).

Hope this answer is still in time for you. Thanks!

ChrisK-M commented 3 years ago

Thank you very much for your response. We'll give it a go with adjusted code. Good luck on the dissertation!

On Tue, Jun 22, 2021 at 11:22 AM JinghaoLu @.***> wrote:

Hi Chris, sorry it takes so long to reply. I have been preparing for my dissertation recently intensely. For the issue you mentioned, it is actually caused by a dead pixel in your video (139,223) that is super bright, so that when rescaling the image pixel range, it underestimate all the other pixels. This results in the processed image for calculating the dominant patch to include none info.

The simple workaround might be to insert a line of code between line 9 and 10 to remove/soften the bad pixel, either using imgaussfilt or medfilt2. This should not and does not usually happen, but if that is more and more common, I might need to add some code to ensure this issue is handled well in the future.

For the purpose of this part, it is actually another layer of filter to remove the spatially unrealistic false positives that are outside of the focal area within the FOV (for example, the dirt or edge of the grin lens reflecting light but is outside of the illuminated center area).

Hope this answer is still in time for you. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JinghaoLu/MIN1PIPE/issues/59#issuecomment-866132915, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUEDHHFNL2EMDNTG23Y4C4LTUC2C3ANCNFSM45DRBGOQ .