Skip to content

File with large number of ROIs is not parsed correctly #13

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

Open
leeleavitt opened this issue Apr 30, 2019 · 5 comments
Open

File with large number of ROIs is not parsed correctly #13

leeleavitt opened this issue Apr 30, 2019 · 5 comments

Comments

@leeleavitt
Copy link

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.

@rbnvrw
Copy link
Member

rbnvrw commented Apr 30, 2019

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!

@rbnvrw rbnvrw added the bug label Apr 30, 2019
@leeleavitt leeleavitt reopened this May 6, 2019
@leeleavitt
Copy link
Author

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.

lee_metadat_ex.txt

@rbnvrw
Copy link
Member

rbnvrw commented May 10, 2019

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!

@rbnvrw rbnvrw changed the title Making it work for my nd2 files File with large number of ROIs is not parsed correctly May 10, 2019
@leeleavitt
Copy link
Author

leeleavitt commented May 16, 2019

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'
>>>

@rbnvrw
Copy link
Member

rbnvrw commented Sep 19, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants