1
$\begingroup$

I've been trying to find out a way to retrieve the Objective Power (or Magnification) of a Whole Slide Image file without downloading it first. I've seen that some WSI's Objective power might be 40x and others 20x, and I need a way to filter the ones I want to retrieve according with this parameter. However, I cannot figure out the query I need for this. Can anyone help me

Some details:

I'm using the GDC API (https://gdc.cancer.gov/developers/gdc-application-programming-interface-api) to retrieve Whole Slide Image files (in this case .svs files).

I want to retrieve this files according with its Objective Power, since images in the TCGA dataset (https://www.genome.gov/Funded-Programs-Projects/Cancer-Genome-Atlas) might have 20x or 40x of objective power.

One way to do this is to retrieve the whole image using the data endpoint of the GDC API and then use a library like Openslide to check the objective power:

import requests
from io import BytesIO
import openslide

# Set up the GDC API endpoint
endpoint = 'https://api.gdc.cancer.gov/data'

# Set up the query parameters
query = {
    'ids': ['my_file_id'],
}

# Send the request to the GDC API
response = requests.get(endpoint, params=query)

# Retrieve the binary data from the response
binary_data = BytesIO(response.content)

# Open the WSI file using the Openslide library
slide = openslide.open_slide(binary_data)

# Retrieve the Objective Power of the WSI
objective_power = slide.properties.get(openslide.PROPERTY_NAME_OBJECTIVE_POWER)

print('Objective Power:', objective_power)

However, retrieving the whole file takes too much time, so I would like to know if anybody knows of a field in the GDC API that allows me to check the objective power of a WSI without retrieving the file itself.

$\endgroup$
0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.