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

[STORY] Analysis the .svs file using QuPath. #328

Open
anzhao opened this issue Sep 17, 2024 · 3 comments
Open

[STORY] Analysis the .svs file using QuPath. #328

anzhao opened this issue Sep 17, 2024 · 3 comments
Assignees
Labels
pipelines story a unit of work

Comments

@anzhao
Copy link

anzhao commented Sep 17, 2024

Metadata

Image

@anzhao anzhao self-assigned this Sep 17, 2024
@github-actions github-actions bot added pipelines story a unit of work labels Sep 17, 2024
@anzhao
Copy link
Author

anzhao commented Sep 18, 2024

The patient ID and other information is under the label of associated images under the Image tab in QuPath. We can use Optical Character Recognition (OCR) library such as Keras-OCR to extract the info we needed. Image

@anzhao
Copy link
Author

anzhao commented Sep 20, 2024

The complete workflow of auto-extract the Patient ID and other info from the label of associated images under the Image tab within a svs file:

1. Extract the Slide Label Image:

import openslide

# Open the .svs file
slide = openslide.OpenSlide('an.svs')

# Extract the slide label image
label_image = slide.associated_images['label']

# Save the label image for the next step Optical Character Recognition (OCR) processing
label_image.save('patient_id.png')

2. Perform OCR on the Extracted Image

#!/usr/bin/env python3
import keras_ocr

# Create the pipeline
pipeline = keras_ocr.pipeline.Pipeline()

# Read the image
images = [keras_ocr.tools.read('patient_id.png')]

# Perform OCR and Recognize text in images
prediction_groups = pipeline.recognize(images)

# Print the recognized text
for predictions in prediction_groups:
    for text, box in predictions:
        print(text)

@anzhao
Copy link
Author

anzhao commented Oct 2, 2024

The single slide image produce six DICOMs, when I open them using QuPath, it all display correctly.

Image

Image

Image

@tclose tclose moved this from In Progress to Done in AIS Master Project Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pipelines story a unit of work
Projects
Status: Done
Development

No branches or pull requests

1 participant