Python loader for the Endoscopic Content Area (ECA) dataset.
Project description
Endoscopic Content Area (ECA) dataset
A simple python loader for the Endoscopic Content Area (ECA) dataset. An implementation of the hausdorff distance, optimised for content areas, is also included in the package.
Installation
To use this dataset, first ensure you have a synapse account, then simply install from pip...
pip install ecadataset
and run the download command...
ecadataset download -d path/to/dataset
You'll be prompted for your synapse credentials and the data will be downloaded. You may also check an existing copy of the dataset with the check command...
ecadataset check -d path/to/dataset
Usage
import matplotlib.pyplot as plt
from ecadataset import ECADataset, DataSource, AnnotationType, content_area_hausdorff
# Create dataset object...
dataset = ECADataset(
# Path to the directory containing the dataset.
data_directory="path/to/dataset",
# Options are: DataSource.CHOLEC, DataSource.ROBUST, and DataSource.BOTH.
data_source=DataSource.BOTH,
# Options are: AnnotationType.AREA, AnnotationType.MASK, and AnnotationType.BOTH.
annotation_type=AnnotationType.BOTH,
# Whether to use cropping to provide additonal samples without a content area.
include_cropped=True,
# Whether to include information about where the frame was taken from.
include_source_info=True
)
# Iterate through the first 10 samples, slicing is supported...
for image, area, mask, info in dataset[:10]:
# Circular content area represented as (x, y, r) or None if no area present...
print("Content area: ", area)
# Origin information in the form (dataset, video, frame)...
print("Sample source: ", info)
# Image and mask are returned as PIL images...
plt.subplot(121)
plt.imshow(image)
plt.subplot(122)
plt.imshow(mask)
plt.show()
# Guessing the content area circle and scoring it against the ground truth...
width, height = image.size
area_guess = (width//2, height//2, width//2)
score, _ = content_area_hausdorff(area_guess, area, (height, width))
print(score)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ecadataset-0.3.4.tar.gz
(25.9 kB
view details)
Built Distribution
File details
Details for the file ecadataset-0.3.4.tar.gz
.
File metadata
- Download URL: ecadataset-0.3.4.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7ec8bc1bd2793cfd37dda525642bd6d581cbd365ba4eac4ee5d2c7c2f3252a4 |
|
MD5 | 9941edc40e5525878d84aede1d929087 |
|
BLAKE2b-256 | 85e3d2a8561d92bef4f539e9a17401d26de9c4eb90c82c4bf04add7ffa92c274 |
File details
Details for the file ecadataset-0.3.4-py3-none-any.whl
.
File metadata
- Download URL: ecadataset-0.3.4-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51924034f7614fae38d44df4dfbf77ad4098705b6115cfb63446966a40b784ff |
|
MD5 | be31ecc8b897eafdd03a1d80d5859649 |
|
BLAKE2b-256 | 5f0f996ac562047eb4ba89a333422d1887a553ffbea49d36ae2c264203e9da88 |