Source code for neuroconv.datainterfaces.ophys.caiman.caimandatainterface

import warnings

from pydantic import FilePath

from ..basesegmentationextractorinterface import BaseSegmentationExtractorInterface


[docs] class CaimanSegmentationInterface(BaseSegmentationExtractorInterface): """Data interface for CaimanSegmentationExtractor.""" display_name = "CaImAn Segmentation" associated_suffixes = (".hdf5",) info = "Interface for CaImAn segmentation data."
[docs] @classmethod def get_source_schema(cls) -> dict: """ Get the source schema for the CaImAn segmentation interface. Returns ------- dict The schema dictionary containing input parameters and descriptions for initializing the CaImAn segmentation interface. """ source_metadata = super().get_source_schema() source_metadata["properties"]["file_path"]["description"] = "Path to .hdf5 file." return source_metadata
[docs] @classmethod def get_extractor_class(cls): from roiextractors import CaimanSegmentationExtractor return CaimanSegmentationExtractor
def __init__( self, file_path: FilePath, *args, verbose: bool = False ): # TODO: change to * (keyword only) on or after August 2026 """ Parameters ---------- file_path : FilePath Path to .hdf5 file. verbose : bool, default False Whether to print progress """ # Handle deprecated positional arguments if args: parameter_names = [ "verbose", ] num_positional_args_before_args = 1 # file_path if len(args) > len(parameter_names): raise TypeError( f"__init__() takes at most {len(parameter_names) + num_positional_args_before_args + 1} positional arguments but " f"{len(args) + num_positional_args_before_args + 1} were given. " "Note: Positional arguments are deprecated and will be removed on or after August 2026. " "Please use keyword arguments." ) positional_values = dict(zip(parameter_names, args)) passed_as_positional = list(positional_values.keys()) warnings.warn( f"Passing arguments positionally to CaimanSegmentationInterface.__init__() is deprecated " f"and will be removed on or after August 2026. " f"The following arguments were passed positionally: {passed_as_positional}. " "Please use keyword arguments instead.", FutureWarning, stacklevel=2, ) verbose = positional_values.get("verbose", verbose) super().__init__(file_path=file_path) self.verbose = verbose