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

draft of multi-tiff multi-page imaging extractor #323

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

bendichter
Copy link
Contributor

@bendichter bendichter commented May 10, 2024

This could be used on its own or used as a base type for more specialized extractors.

Depends on https://gin.g-node.org/CatalystNeuro/ophys_testing_data/pulls/21

bendichter and others added 2 commits May 10, 2024 13:20
…e used on its own or used as a base type for more specialized extractors
@bendichter bendichter changed the title upload draft of multi-tiff multi-page imaging extractor draft of multi-tiff multi-page imaging extractor May 10, 2024
@bendichter
Copy link
Contributor Author

I see it might be been simpler to use a MultiImagingExtractor. I'll look at that now

…actor' into multitiff_multipage_imaging_extractor
@bendichter
Copy link
Contributor Author

@CodyCBakerPhD I'm not sure what's going on here. This code runs perfectly well when I run it locally.

@bendichter
Copy link
Contributor Author

Oh, right, because the test data hasn't been merged yet, so there are no extractors. I'll add a check for that.

@CodyCBakerPhD
Copy link
Member

Here's what I propose for this approach:

i) A class called TiffFolderImagingExtractor: DirectoryPath that is the convenient approach for being friendly in handling a folder_path plus a parsing rule - basically what you have here - which I really like and think is the easier but more implicit approach, but is only guaranteed to work in situations we have tests for (which can rely a lot on users having really well organized and regular conventions)

ii) A class called MultiTiffMultiPageImagingExtractor that explicitly takes a file_paths: list[FilePath], and would have mainly programmatic usage (the user would use Python iteration to explicitly put together their list of files - such as a case where image contents are split across multiple subfolders). This could then be used as a fallback in any case where (i) might not work

I think each could have its own interface on NeuroConv, but GUIDE would only support (i)

While (ii) is technically possible in ROIExtractors out of the box by just making a list of TiffImagingExtractors and putting them in a MultiImagingExtractor, having a dedicated extractor could still be more convenient or findable

@bendichter WDYT?

Comment on lines +23 to +25
"split_1.tif",
"split_2.tif",
"split_3.tif",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some extra tests for this, at a minimum, should include cases of (a) multiple cameras/microscopes (the specifier for each device being something in the file name), and (b) multiple optic channels for a single one of those devices (the channel name/ID also being a part of the filename)

Not that I'm not saying the TiffFolderImagingExtractor should by default support multiple optic channels, or auto-detection of channel IDs from this pattern (that is a more complicated feature that could be done in a follow-up, or not at all); I just want to make sure that a single instance made from a pattern specification that restricts to only one channel from a folder that contains several correctly identifies list of files only for that channel

@bendichter
Copy link
Contributor Author

Yeah I think these are both good ideas

@bendichter
Copy link
Contributor Author

@CodyCBakerPhD the thing is I also want to create an extractor that handles a bunch of TIFF files that are not multi-page. What do you think of this naming scheme?

  • one multi-page TIFF file: TiffImagingExtractor(sampling_rate=sampling_rate) (already exists)
  • many 1-page TIFF files: MultiTiffImagingExtractor(file_paths=[...], sampling_rate=sampling_rate)
  • several multi-page TIFF files: MultiTiffImagingExtractor(file_paths=[...], multi_page=True, sampling_rate=sampling_rate)

Then you could have FolderTiffImagingExtractor(folder_path, pattern, sampling_rate, multi_page) where FolderTiffImagingExtractor wraps MultiTiffImagingExtractor

@bendichter
Copy link
Contributor Author

I think that would be the mosts straightforward syntax for the user. The issue is I don't really want to inherit from MultiImagingInterface for the "many 1-page TIFF files" case.

@CodyCBakerPhD
Copy link
Member

Sounds good to me

Quick question - can the detail about a file being multi-page be autodetected or is it really something that needs to be known prior to reading the file?

@bendichter
Copy link
Contributor Author

@CodyCBakerPhD I suppose you are right, we could auto-detect multi-page. I'll put together a draft of that. We might need to use __new__ for this

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

Successfully merging this pull request may close these issues.

2 participants