-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
🧰 Task
Currently there are two paths, and they have crossover and need to figure out the best way. I need to reduce the duplicated logic here. And probably find a way to also use determine_plugin() from bioio a bit more cleanly for shared logic, because this would be more consistent than grabbing the first in the list (bioio grabs the most recently installed)
ndevio/src/ndevio/_plugin_manager.py
Lines 262 to 288 in 12a4775
report = self.feasibility_report # Try preferred reader first if ( preferred_reader and preferred_reader in report and report[preferred_reader].supported ): logger.info( "Using preferred reader: %s for %s", preferred_reader, self.path, ) return self._get_reader_module(preferred_reader) # Try any installed reader that supports the file for name, support in report.items(): if name != "ArrayLike" and support.supported: logger.info( "Using reader: %s for %s (preferred not available)", name, self.path, ) return self._get_reader_module(name) logger.warning("No working reader found for: %s", self.path) return None Lines 78 to 109 in 12a4775
preferred_reader = ( preferred_reader or settings.ndevio_Reader.preferred_reader # type: ignore ) # Only use ReaderPluginManager for file paths, not arrays if isinstance(image, str | Path): manager = ReaderPluginManager(image) reader = manager.get_working_reader(preferred_reader) if reader: return reader # No reader found - raise with helpful message if enabled if settings.ndevio_Reader.suggest_reader_plugins: # type: ignore raise UnsupportedFileFormatError( reader_name="ndevio", path=str(image), msg_extra=manager.get_installation_message(), ) else: # Re-raise without suggestions raise UnsupportedFileFormatError( reader_name="ndevio", path=str(image), ) else: # For arrays, use bioio's built-in plugin determination try: return nImage.determine_plugin(image).metadata.get_reader() except UnsupportedFileFormatError: # Re-raise for non-file inputs raise
Metadata
Metadata
Assignees
Labels
No labels