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

Reuse code for metadata #72

Merged
merged 5 commits into from
Aug 23, 2023
Merged

Reuse code for metadata #72

merged 5 commits into from
Aug 23, 2023

Conversation

CGDogan
Copy link
Contributor

@CGDogan CGDogan commented Aug 19, 2023

Summary

There were four copies of OpenSlide metadata code which I need to refactor for BioFormats. Now there's only two but not one because I'm keeping NCISlideUtil untouched.

Testing

Visited http://127.0.0.1:4010/loader/data/one/fileinimagesfolder.tif, http://127.0.0.1:4010/loader/data/many/[%22fileinimagesfolder%22]. Isolated from Omniload.py, ran the modified code:

#import OmniLoad

import dev_utils
# get fields openslide expects
def openslidedata(manifest):
    for img in manifest:
        img['location'] = img.get("path", "") or img.get("location", "") or img.get("filename", "") or img.get("file", "")
        metadata = dev_utils.getMetadata(img['location'], False, True)
        print(metadata)
        for k, v in metadata.items():
          if k not in img:
            img[k] = v
        # required values which are often unused
        img['study'] = img.get('study', "")
        img['specimen'] = img.get('specimen', "")
    return manifest

print(openslidedata([{"path": "/tiff/file.tiff"}]))

Questions

I hope it's OK to leave NCISlideUtil? That accesses some metadata I couldn't find documentation for so I won't be able to find BioFormats equivalents.

Copy link
Member

@birm birm left a comment

Choose a reason for hiding this comment

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

This looks good. Glad to see this cleaned this up!
I added an optional suggestion, let me know if you'd prefer to merge without it.

SlideServer.py Outdated Show resolved Hide resolved
@birm birm merged commit 9238a0b into camicroscope:develop Aug 23, 2023
@CGDogan CGDogan deleted the metadatapatch branch August 23, 2023 15:44
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