Skip to main content

A helper package to download example datasets used in various publications and deep-learning algorithms, including data featured in N2V, P(P)N2V, DivNoising, HDN, EmbedSeg, etc.

Project description

Microscopy Portfolio

License PyPI Python Version CI Datasets CI codecov

A helper package to download example datasets used in various publications by the Jug lab, including data featured in N2V, P(P)N2V, DivNoising, HDN, EmbedSeg, etc.

The complete list of datasets can be found here.

Installation

To install the portfolio in your conda environment, simply use pip:

$ pip install microscopy-portfolio

Usage

Follow the example notebook for details on how to use the package.

The portfolio can be instantiated as follow:

from microscopy_portfolio import Portfolio

portfolio = Portfolio()

You can explore the different datasets easily:

print(portfolio)
print(portfolio.denoising)
print(portfolio.denoising.N2V_SEM)

Finally, you can download the dataset of your choice:

from pathlib import Path

data_path = Path('data')
portfolio.denoising.N2V_SEM.download(data_path)

Add a dataset to the repository

To add a dataset, subclass a PortfolioEntry and enter the following information (preferably in one of the current categories, e.g. denoising_datasets.py):

class MyDataset(PortfolioEntry):
    def __init__(self) -> None:
        super().__init__(
            name="MyDataset",
            url="https://url.to.myfile/MyFile.zip",
            file_name="MyFile.zip",
            md5_hash="953a815333805a423b7019bd16cc3341",
            description="Description of the dataset.",
            license="CC-BY",
            citation="Citation of the dataset',
            files={
                "/folder/in/the/zip": ["file1.tif", "file2.tif"], # folder can be "."
            },
            size=13.0, # size in MB
        )

To obtain md5 hash of your file, you can run the following code:

from pathlib import Path
import hashlib

file_path = Path("path/to/myfile.zip")
hashlib.md5(open(file_path, "rb").read()).hexdigest()

Likewise, to get the size in MB of your file:

import os

os.path.getsize(file_path) / 1024 / 1024

Finally, add the file class to one of the categories (e.g. denoising) in portfolio.py:

class Denoising(IterablePortfolio):
    def __init__(self) -> None:
        self._N2V_BSD68 = N2V_BSD68()
        self._N2V_SEM = N2V_SEM()
        self._N2V_RGB = N2V_RGB()
        self._flywing = Flywing()

        # add your dataset as a private attribute
        self._myDataset = MyDataset()

        [...]

    # and add a public getter
    @property
    def MyDataset(self) -> MyDataset:
        return self._myDataset

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microscopy_portfolio-0.0.5.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

microscopy_portfolio-0.0.5-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file microscopy_portfolio-0.0.5.tar.gz.

File metadata

  • Download URL: microscopy_portfolio-0.0.5.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for microscopy_portfolio-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a37c4283b7ae24bb0475fc9b1766001155e391fb2f1b9c4401ef85239b2ca8a9
MD5 ad3ecb1f6d9bcb6b063fd267dfdad5cf
BLAKE2b-256 8f2ee583c9c4d015dd416c3b989b016a1ebf084099bb620a0d369268dae38898

See more details on using hashes here.

File details

Details for the file microscopy_portfolio-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for microscopy_portfolio-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 16ed654b1d0e4380847e4fd27c86490f2e55d56e8358e71f6a7c034ae5497b85
MD5 580f8ff54484b461b7f8e1f59a69fa65
BLAKE2b-256 9521f2dbcfed81d5b78be6dc4572d8f18abde6cafb90c04bd81cfb78a5d3d04e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page