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

Extracted Image from original dataset not the same as image stored in hdf5 #6

Open
euwern opened this issue Feb 26, 2019 · 0 comments

Comments

@euwern
Copy link

euwern commented Feb 26, 2019

I grab the image from Camelyon16 dataset according to the provided meta.csv file, but the extracted image isn't the same as the image found in hdf5.

Is there anything wrong with my approach of extracting image from the dataset based on the given meta?

import openslide
import pandas as pd
import h5py
from PIL import Image

img_id = 0 

df = pd.read_csv('../../dataset/pcam/camelyonpatch_level_2_split_test_meta.csv')

fn = df['wsi'][img_id][-8:]

slide = openslide.open_slide('/mnt/datasets/CAMELYON16/testing/images/%s.tif' % fn)

x = df['coord_x'][img_id] 
y = df['coord_y'][img_id]
img = slide.read_region((x, y), 2, (96, 96))
img.save('pcam_sample/%s_1.tif' % fn)

data = h5py.File('../../dataset/pcam/camelyonpatch_level_2_split_test_x.h5', 'r')
img2 = Image.fromarray(data['x'][img_id])
img2.save('pcam_sample/%s_2.tif' % fn)

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

No branches or pull requests

1 participant