Skip to content

Commit

Permalink
switched extract_extra_metadata to local implementation to avoid neur…
Browse files Browse the repository at this point in the history
…oconv dependency
  • Loading branch information
pauladkisson committed Sep 14, 2023
1 parent d3f25b8 commit a2e0caf
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import numpy as np
from pprint import pprint

from neuroconv.datainterfaces.ophys.scanimage.scanimageimaginginterface import extract_extra_metadata

from ...extraction_tools import PathType, FloatType, ArrayType, get_package
from ...imagingextractor import ImagingExtractor

Expand All @@ -24,6 +22,22 @@ def _get_scanimage_reader() -> type:
).ScanImageTiffReader


def extract_extra_metadata(
file_path,
) -> dict: # TODO: Refactor neuroconv to reference this implementation to avoid duplication
ScanImageTiffReader = _get_scanimage_reader()
io = ScanImageTiffReader(str(file_path))
extra_metadata = {}
for metadata_string in (io.description(iframe=0), io.metadata()):
metadata_dict = {
x.split("=")[0].strip(): x.split("=")[1].strip()
for x in metadata_string.replace("\n", "\r").split("\r")
if "=" in x
}
extra_metadata = dict(**extra_metadata, **metadata_dict)
return extra_metadata


class ScanImageTiffMultiPlaneImagingExtractor(
ImagingExtractor
): # TODO: Refactor to avoid copy-paste from ScanImageTiffImagingExtractor
Expand Down

0 comments on commit a2e0caf

Please sign in to comment.