Skip to content

Provide more friendly memory error for TiffImagingExtractor #352

@h-mayorquin

Description

@h-mayorquin

This is related to
catalystneuro/neuroconv#995

Check out the lines:

except ValueError:
warn(
"memmap of TIFF file could not be established. Reading entire matrix into memory. "
"Consider using the ScanImageTiffExtractor for lazy data access."
)
with tifffile.TiffFile(self.file_path) as tif:
self._video = tif.asarray()

Sometimes this will fail because there is not enough memory.

Two options:

  1. You can wrap this into something like this:
    https://github.com/catalystneuro/neuroconv/blob/ef656a0f13607ec661b091b9569e326fc91af8db/src/neuroconv/tools/spikeinterface/spikeinterface.py#L520-L548

Where we provide a friendlier error message and the suggestion that is currently a warning.

  1. Another option is to delay this intialization until get_video gets called. This is likely to be a small call and the error and will avoid most problems.

I suggest 1 because is easier but I think memmaps should not be dangling with the object so I think 2 is better long-term. We had some problems because of this in spikeinterface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions