Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import argparse
- import code # for code.interact(local=dict(globals(), **locals()) ) debugging
- import glob
- import numpy as np
- import os
- import webknossos
- import webknossos.dataset
- ######################
- # Make a wkw out of a tiff stack
- def main():
- cfg = handle_args()
- files=sorted(glob.glob(os.path.join(cfg.src, "*.tiff")))
- dataset = webknossos.Dataset(dataset_path=cfg.dest, voxel_size=(8,8,8), name=cfg.dset_name, exist_ok=False)
- dataset.add_layer_from_images(images=files, layer_name="seg", batch_size=cfg.batch_size, category=webknossos.dataset.SEGMENTATION_CATEGORY)
- def handle_args():
- parser = argparse.ArgumentParser(description="This does a thing")
- parser.add_argument("src", help="Directory containing tiff stack")
- parser.add_argument("dest", help="Target directory")
- parser.add_argument("--dset_name", default="export_1720537802", help="Webknossos name for dataset")
- parser.add_argument("--batch_size", default=32, type=int, help="Batch size for ingest")
- parser.add_argument("--verbose", help="Be noisier")
- ret = parser.parse_args()
- return ret
- #####
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement