File with large number of ROIs is not parsed correctly
Hello, not sure how to use github very well, so i will just tell you the problem and my solution to this problem. in the raw_metadata.py file on line 245 it says number_of_timepoints = raw_roi_dict[six.b('m_vectAnimParams_Size')] This causes the function to break down so we replace this with number_of_timepoints = 0 And the function will run fine after this.
Hi @leeleavitt, thank you for taking the time to report a problem!
Can you tell me a bit more about your problem? What is the error message that you get when the function "breaks down" and what kind of ND2 file are you using (can you post the metadata?)?
Thank you!
This is my metadata. We have a lot of ROI's identified. I suspect this is the issue. Our data is a video file, where each frame is 2 images.
Thank you @leeleavitt. It still isn't clear to me what you mean by "it breaks down". Do you receive an error message or do you refer to the fact that rois contains a long list of elements that contain only empty elements, i.e.: {'timepoints': array([], dtype=float64), 'positions': array([], dtype=float64), 'sizes': array([], dtype=float64), 'shape': None, 'type': None}?
If it is the latter case, it seems that your particular ROIs are not parsed correctly. Can you maybe upload the ND2 that is not working to an online file sharing service such as https://www.file.io/ and send it to me? Thank you!
The file can be found here.
I appreciate the help. This package is amazing. Once you discover the issue, could you give me a run down? I'm very interested in getting involved on this project. Below i the error i am getting.
>>> os.chdir("Z:/Lee Leavitt/190208.29.m.m3.p1 pl14a testing")
>>> test = nd2reader.ND2Reader("testing_crop.nd2")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\reader.py",
line 21, in __init__
self._parser = Parser(self._fh)
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\parser.py",
line 35, in __init__
self._parse_metadata()
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\parser.py",
line 137, in _parse_metadata
self.metadata = self._raw_metadata.__dict__
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\raw_metadata
.py", line 26, in __dict__
return self.get_parsed_metadata()
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\raw_metadata
.py", line 55, in get_parsed_metadata
self._parse_roi_metadata()
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\raw_metadata
.py", line 229, in _parse_roi_metadata
roi_objects.append(self._parse_roi(current_roi))
File "C:\Users\Microscope_1\Anaconda3\lib\site-packages\nd2reader\raw_metadata
.py", line 245, in _parse_roi
number_of_timepoints = raw_roi_dict[six.b('m_vectAnimParams_Size')]
KeyError: b'm_vectAnimParams_Size'
>>>
I'm sorry, I did not have time to look at this issue but now I do. Could you please upload the file again? Sorry for the inconvenience!