Skip to content
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

[Bug]: invalid literal for int() 'Inf' for SI.hStackManager.framesPerSlice #1108

Open
2 tasks done
k1o0 opened this issue Oct 9, 2024 · 5 comments
Open
2 tasks done
Labels

Comments

@k1o0
Copy link

k1o0 commented Oct 9, 2024

What happened?

I am trying to convert ScanImage tif files acquired with a mesoscope to NWB, however I get the following ValueError:

line 118, in parse_metadata
    frames_per_slice = int(metadata["SI.hStackManager.framesPerSlice"])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Inf'

I think SI.hStackManager.framesPerSlice is Inf when SI.hStackManager.enable is False, i.e. when we are doing single plane imaging. It is an irrelevant variable unless you are doing volumetric imaging (i.e. multiple z-depths), in which cases you can define a number of frames to scan per slice. Am I using the correct converter class here or is this something that is not accounted for yet in the code?

Steps to Reproduce

from neuroconv.datainterfaces.ophys.scanimage.scanimageimaginginterfaces import ScanImageSinglePlaneImagingInterface

# File can be downloaded from 
# https://ibl.flatironinstitute.org/public/resources/SP060/2024-06-14/001/raw_imaging_data_00/2024-06-14_1_SP060_2P_00000_00001.tif
file_path = 'SP060/2024-06-14/001/raw_imaging_data_00/2024-06-14_1_SP060_2P_00000_00001.tif'
channel_name = "Channel 1"
interface = ScanImageSinglePlaneImagingInterface(file_path=file_path, channel_name=channel_name, verbose=True)
metadata = interface.get_metadata()

Traceback

No response

Operating System

Windows

Python Executable

Python

Python Version

3.10

Package Versions

No response

Code of Conduct

@k1o0 k1o0 added the bug label Oct 9, 2024
@pauladkisson
Copy link
Member

Hey @k1o0,

Thank you for the detailed description and example file. This sounds like a bug with the ScanImageTiffImagingExtractor from roiextractors, so I will re-raise the issue there and take a look!

@h-mayorquin
Copy link
Collaborator

Hi, @k1o0 for provenance, can you tell us more about your tiff file? was it produced by a certain microscope (e.g. thor lab? was it transformed? it is just good for us to know more context about the provenance of the tiff file.

@k1o0
Copy link
Author

k1o0 commented Oct 11, 2024

Hi, @k1o0 for provenance, can you tell us more about your tiff file? was it produced by a certain microscope (e.g. thor lab? was it transformed? it is just good for us to know more context about the provenance of the tiff file.

Thanks for working so quickly to fix this issue! We are using a Thorlabs 2p-RAM with the Dual-Plane Imaging Add-On, running Vidrio ScanImage 2020.1.2. The tiff file itself wasn't altered, however the ScanImage code was locally adapted slightly to include 2 additional fields in the SI header: SI.hDisplay.circleOffset and SI.hDisplay.circleDiameter. The file I provided was a single scanfield session in single-plane mode.

@h-mayorquin
Copy link
Collaborator

OK, thanks a lot.
We can close this when we make a release on roiextractors and update our requirements here on neuroconv.

@h-mayorquin
Copy link
Collaborator

h-mayorquin commented Oct 11, 2024

One last question, does the file has an accompanying XML file? In that case, could you share it as well?

[EDIT] Ah, that's a Bruker specific thing, forget about it.

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

No branches or pull requests

3 participants