GithubHelp home page GithubHelp logo

smistad / vsi2tif Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreped/vsi2tif

0.0 2.0 0.0 13 KB

Simple method for converting the CellSens .vsi format to a pyramidal .tif

License: MIT License

Python 100.00%

vsi2tif's Introduction

vsi2tif

Simple method for converting the CellSens .vsi format to a pyramidal .tif.

Requirements (tested with Ubuntu 18.04 desktop)

Python 3.*

pyvips

Command line tools

vips (https://zoomadmin.com/HowToInstall/UbuntuPackage/libvips)\ install what comes with ubuntu: apt install libvips-tools

bftools https://docs.openmicroscopy.org/bio-formats/6.5.1/users/comlinetools/# (needs a JRE)

How to use

Before you run the script, be sure to install all requirements. Also, as you are using a JVM, it might be smart to set the defaults in the script to your needs - like memory limit, e.g:

input_file_type = 'vsi'
path_to_bfconvert = '../bftools/bfconvert'
java_env_var = {'BF_MAX_MEM': '4g'}
defaults = {
    'compression': 'lzw',
    'plane': 0,
    'tilesize': 1024,
    'quality': 85
}

If you see the example code, it requires that the path to bfconvert (from bftools) is predefined. The code includes some hard-coded hyperparamters which I have found to work well in my setup. This code is only meant to show a proof of concept. Feel free to adjust the code as you please.

CLI usage

usage:

vsi2tif.py [-h] [--compression COMPRESSION] [--plane PLANE] [--tilesize TILESIZE] [--quality QUALITY] [--keep_tmp_files] input output

positional arguments:
  input      folder with input files
  output     folder for output files

optional arguments:
  -h, --help            show this help message and exit
  --compression COMPRESSION
                        Compression to use for tiff - default lzw - use something that is compatible with bfconvert and libvips - no checks implemented
                        yet!
  --plane PLANE         Plane to use from VSI - default 0
  --tilesize TILESIZE   Tilesize to use during conversion and in final image - default 1024
  --quality QUALITY     Quality value for (if used by compression) final image - default 85
  --keep_tmp_files      If given files from vsi to bigtiff conversion won't be deleted

some additional info

  • script runs currently single threaded - not very fast for larger batches
  • info on processed files will be stored in one json processed_files_info.json in the output folder

vsi2tif's People

Contributors

andreped avatar smistad avatar sekro avatar

Watchers

James Cloos avatar  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.