-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error due to NaN matrix during non-stable registration #66
Comments
Hi the nested error messages are not relevant. I guess the issue might be related to some random dead pixels in the FOV. I would suggest: 1. Make sure the frames are correctly read. MIN1PIPE currently can only fast read some data formats and other compressed formats can lead to errors. 2. You can try loading the variable "reg" from "_reg.mat" before doing the motion correction, or variable "frame_all" form "_frame_all.mat", and compute the max to see if there are any dead pixels of extremely high value (you will see bright yellow pixels if there are any). In general, MIN1PIPE should be able to handle corner dead pixels, but if there is such pixel and you want a quick fix, I suggest you manually crop the rows and/or the columns before running MIN1PIPE. 3. If that is not the case, I suggest you go to line 99 of "nonstable_section.m", set a break point, and first check variable "maskc". It can be that maskc is off the target and captures too small a region. Let me know if any of the cases happen and then we can proceed. Thanks! |
Thanks for the quick reply. I don't see any obvious 'dead pixels' when I plot the max. I also thought that remove_dp fixes all dead pixels? Am I assuming incorrectly? Alternatively, could it be due to dropped frames? How does min1pipe handle dropped frames? Thanks again for the help. |
@yrleftbrain As I said, remove_dp can remove dead pixels but no guarantee on all occasions (no single algorithm can do that). There is no impact of dropping frames. I also suggested other options so please try out all of them first. |
Thanks. When I check maskc with a file that typically throws the error, it is a 630x630 (size of image) matrix of zeros. |
@yrleftbrain Yes so that's the problem. Usually this comes from some dead pixel in the FOV that dominate the mask computation. The corner/edge dead pixels should be handled well, but a random dead pixel in the center (for example) of FOV might be causing this. And again the reason why that is not handled well is there is no reason to assume the intensities of the center pixels (good pixels can also be of very high intensity values). So this time please check again carefully the maximum projection: if overall FOV looks pretty dim, then it indicates some dead pixels somewhere in the FOV. You can find the max pixel location and then zoom into that area. |
Thanks a lot for helping me find the issue. I ended up writing up a script to deal with dead pixels that weren't fixed by remove_dp. It works wonderfully now. Thanks again. |
Hi,
I'm getting the following error on a few files:
Error using imregionalmax
Expected input number 1, I, to be non-NaN.
Error in imregionalmax (line 67)
validateattributes(varargin{1}, {'numeric','logical'}, {'real','nonsparse','nonnan'},...
This occurs during motion correction, specifically during non-stable registration. I can't find the issue, and I was wondering if you had some insight that may help. The matrix is of NaNs, and I'm not sure how this is being created. Thanks so much.
The text was updated successfully, but these errors were encountered: