Coder Social home page Coder Social logo

vsi2tif's Introduction

vsi2tif

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

Requirements (tested with Ubuntu 18.04 desktop)

Python 3.*

  • pyvips

Command line tools

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 sekro avatar smistad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sekro smistad

vsi2tif's Issues

Colors seem off after conversion

When I convert a VSI using this script, there is way more blue in the resulting image than when I convert using CellSens. I have been playing around with the bfconvert settings, but nothing seems to change it at all. Have you seen any problems like this?

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.