alan-turing-institute / empiarreader

Reader for EMPIAR datasets
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

Make example notebook #15

Closed mooniean closed 1 year ago

JatGreer commented 1 year ago

In case it helps, here's a minimal code snippet I extracted from the notebook you sent me last year. It still depends on importing scivision to access the data though, so I guess that needs to be updated to use empiarreader utilities anyway. Not sure if it still works with updates to empiarreader though


import scivision
import logging

import numpy as np
import matplotlib.pyplot as plt

from matplotlib.colors import LogNorm
from matplotlib.patches import Rectangle

# The repository containing this notebook itself provides a Scivision datasource, describing some synthetic data, which we use in the first example.
cat = scivision.load_dataset("./")
list(cat.keys())

cat.synthetic_soup.description
# We now look at the second entry in the catalog, one_empiar_dataset, which points to an entry in the EMPIAR archive.
# In this example, we load the entry 10050, which has the micrographs (i.e., the EM-acquired images) of the small protein complex Prx3.

keys = list(cat.one_empiar_dataset.keys())
keys

empiar_10050 = cat.one_empiar_dataset["VPP_Prx3_7.3res"]
empiar_10050

image = empiar_10050.read_partition(0)
image_part = image.sel(frame=0)[512:, 512:]

plt.imshow(
    np.clip(image_part, 0, 100)
)