Giter Site home page Giter Site logo

mobie-utils-python's Introduction

Build Status Anaconda-Server Badge

mobie-utils-python

A python library to generate projects for MoBIE.

Installation

From conda:

$ conda install -c conda-forge mobie_utils

For development:

You can set up (and activate) a conda environment with all dependencies from environment.yaml:

$ conda env create -f environment.yaml
$ conda activate mobie

and install the library via

$ pip install -e .

Usage

The library contains functionality to generate MoBIE projects, add data to it and create complex views. For complete examples, please check out the examples:

Below is a short code snippet that shows how to use it in a python script.

import mobie

# root folder for the mobie project
mobie_root = "/path/to/project-datasets/data"
# name of the dataset to be added
dataset_name = "my_dataset"

# file path and key for the input data
# key can be an internal path for hdf5 or zarr/n5 containers
# or a file pattern for image stacks
data_path = "/path/to/input_data.h5"
data_key = "/internal/h5/path"

# resolution of this initial data (in micrometer), chunks size and factors for downscaling
resolution = (.5, .25, .25)
chunks = (64, 128, 128)
scale_factors = [[1, 2, 2], [2, 2, 2], [2, 2, 2]]

mobie.add_image(data_path, data_key,
                mobie_root, dataset_name, image_name,
                resolution, chunks, scale_factors)

From the command line

The package also installs some command line scripts that can create MoBIE projects, add data to it and more:

  • mobie.add_image add image data to MoBIE dataset. Initialize the dataset if it does not exist yet.
  • mobie.add_registered_source apply registration in elastix format and add the resulting data to MoBIE dataset.
  • mobie.add_segmentation add segmentation image data to MoBIE dataset.
  • mobie.add_traces add data containing traces (= skeletonized objects).
  • mobie.validate_project validate that a MoBIE project follows the spec
  • mobie.validate_dataset validate that a MoBIE dataset follows the spec
  • mobie.add_remote_metadata adds the required metadata for accessing the data via s3.

Run <COMMAND-NAME> --help to get more information on how to use them.

Updating MoBIE projects

This library also provides functionality to update MoBIE projects to new specification versions. Updating is performed with the command line function mobie.migrate_project. Its only mandatory argument is the filepat to the project data:

mobie.migrate_project data

Warning: this command will update the metadata files without creating backups. You should either run this on projects within git, or create a manual backup of your project.

The most recent update is from version 0.2.1 to 0.3.0. Previous version updates can be performed by passing the -v flag to the migrate_project command.

As most likely the specs for the project metadata files change during an update, you need to purge the cached specs files by deleting them in the .mobie folder in your $HOME directory.

Citation

If you use the MoBIE framework in your research, please cite the MoBIE publication.

mobie-utils-python's People

Contributors

constantinpape avatar martinschorb avatar tibuch avatar imagejan avatar jhennies avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.