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

Added ome-tiff inference pipeline #8

Merged
merged 4 commits into from
Apr 11, 2024
Merged

Added ome-tiff inference pipeline #8

merged 4 commits into from
Apr 11, 2024

Conversation

JLrumberger
Copy link
Collaborator

@JLrumberger JLrumberger commented Apr 4, 2024

What is the purpose of this PR?

This PR close #7 by implementing the required utility functions to run inference on ome.tiff files. The final implementation looks pretty different than the design doc. In the design doc, I proposed to implement .ome.tif versions of the following functions calculate_normalization, prepare_normalization_dict, predict_fovs. While implementing this, I figured that this is not nicely extendable, especially when thinking about additional data representations (eg. zarr, etc.) that we might need to treat in the future. Thus I decided to add a class MultiplexDataset that abstracts away the data representation and gives a common interface via class methods get_channel(fov: str, channel: str) and get_segmentation(fov: str) to the data.

How did you implement your changes

I added the following new classes:

  • LazyOMETIFFReader which extends pyometiffs OMETIFFReader to allow for lazy loading of single channels from an .ome.tiff files. This makes the ViewerWidget way more responsive for .ome.tiffs.
  • MultiplexDataset which abstracts away the different data representations of the .ome.tiff stacks and the one-folder-per-fov representation and offers a common interface via get_channel(fov: str, channel: str) and get_segmentation(fov: str).
  • Transformed the example dataset to .ome.tiff format and added a ome.tiff template notebook to showcase how inference can be done on this data representation.
  • Changed some bits in the Nimbus and ViewerWidget classes as well as in the normalization_dict preparation code to make it work with the MultiplexDataset.

Remaining issues

  • Add the .ome.tiff version of the example dataset to the ark repo & huggingface space. What do you think about that @noah?

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

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

Nice, the UI looks super clean. So now we don't actually need two separate notebooks, right? Since basically all of the downstream functionality is the same, it's just in the dataset class creation that things are specified slightly differently?

@JLrumberger
Copy link
Collaborator Author

JLrumberger commented Apr 10, 2024

Nice, the UI looks super clean. So now we don't actually need two separate notebooks, right? Since basically all of the downstream functionality is the same, it's just in the dataset class creation that things are specified slightly differently?

The difference between the two notebooks is just one line of code suffix=".tiff" -> suffix=".ome.tiff" and some of the text cells to explain how we assume that the data is organized in folders. I think it's a good idea to merge them into one notebook. What's your opinion on uploading an .ome.tiff version of the example dataset and making it available via ark?

@ngreenwald
Copy link
Member

Yeah, that sounds great. Then people can use the example dataset that better matches their own data structure.

@JLrumberger JLrumberger merged commit 5250d0b into main Apr 11, 2024
11 of 12 checks passed
@JLrumberger JLrumberger deleted the ome_tiff branch April 11, 2024 09:26
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.

Add ome-tiff inference script
2 participants