Code Monkey home page Code Monkey logo

stitchm's Introduction

StitchM

StitchM stitches together mosaic images taken in Cockpit (Micron) into a universally readable format, currently '.ome.tiff'.

The current output is an 16bit greyscale image when stitching the mosaic. Markers exported from Cockpit can be added as rectangular ROIs within the OME metadata stored in the image header. ROIs can be imported and displayed using bioformats in FIJI/ImageJ.

Installation

Using pip: python -m pip install StitchM Available on PyPI and conda-forge. To use conda-forge, you may need to setup your conda by following instructions found here.

Using StitchM:

  • Command line script interface (accessible via StitchM or stitchm, use argument --help for more details)
  • Drag and drop shortcut (created using StitchM setup --windows-shortcut) that processes mosaic .txt file and optional marker file if dragged on together, but cannot do batch processing of directories
  • Module entry point (python -m stitch_m), which takes the paths of the mosaic and marker files in any order
  • Imported package: import stitch_m or from stitch_m import stitch_and_save, stitch, save

Motivation

To make a mosaic image that can be easily viewed and can be used for automatic alignment with a separate grid image (using gridSNAP).

Features

  • Creates OME-TIFF file from Cockpit's saved mosaic .txt file, which links to an .mrc file
    • OME metadata
    • Slight exposure trimming to remove extreme highlights
    • Image normalisation to fit data type
    • Optional filtering to remove fluorecence images (default can be changed in config file)
  • Supports adding regions of interests (ROIs) to metadata using a .txt file containing markers, as can be saved from Cockpit
  • Various default behaviours can be changed by editing a user config file (created using StitchM setup --config)

Copyright

StitchM is licensed under a BSD license, please see LICENSE file. Copyright (c) 2019-2021, Diamond Light Source Ltd. All rights reserved.

Additional information

StitchM uses OME metadata.

As Cockpit creates the images and accompanying files, so was referenced for the creation of this software. Cockpit is licensed under GNU and can be found at https://github.com/MicronOxford/cockpit

stitchm's People

Contributors

thomasmfish avatar peterc-dls avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

iandobbie

stitchm's Issues

Some data can generate a divide by zero.

I have a data set that generates the following error.

/Users/ian/src/StitchM/stitch_m/image_normaliser.py:66: RuntimeWarning: divide by zero encountered in true_divide
rescaled_images = corrected_images * (new_max / corrected_max)

presumably the corrected_max is zero. I can provide the data but it is unfortunately a multi GB file.

Latest version dies with error

StitchM -m green-60x-mosaic.txt
WARNING:root:Cannot find path /Users/ian/Documents/projects/Zaber/mosaic/C:\MUI_DATA\bioc0882\green-60x-mosaic.mrc
WARNING:root:mrc file with the same name in the current directory will be used
WARNING:root:Cannot find path /Users/ian/Documents/projects/Zaber/mosaic/C:\MUI_DATA\bioc0882\green-60x-mosaic.mrc
WARNING:root:mrc file with the same name in the current directory will be used
/Users/ian/Library/Python/3.9/lib/python/site-packages/mrcfile/mrcinterpreter.py:209: RuntimeWarning: Map ID string not found - not an MRC file, or file is corrupt
warnings.warn(msg, RuntimeWarning)
/Users/ian/Library/Python/3.9/lib/python/site-packages/mrcfile/mrcinterpreter.py:219: RuntimeWarning: Unrecognised machine stamp: 0x00 0x00 0x00 0x00
warnings.warn(str(err), RuntimeWarning)
ERROR:root:Error has occurred while stitching or saving mosaic. Please see traceback for more info.
Traceback (most recent call last):
File "/Users/ian/Library/Python/3.9/lib/python/site-packages/stitch_m/run.py", line 55, in _stitch
metadata_creator = MetadataMaker(tiff_filename, unstitched, stitcher.get_brightfield_list())
TypeError: init() missing 1 required positional argument: 'datatype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/ian/Library/Python/3.9/lib/python/site-packages/stitch_m/run.py", line 94, in main_run
mosaic, metadata, tiff_file = _stitch(config, mosaic, markers, normalise)
File "/Users/ian/Library/Python/3.9/lib/python/site-packages/stitch_m/run.py", line 65, in _stitch
arg_string = ", ".join((str(mosaic or None), str(markers or None), str(normalise)))
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Processing failed! Press enter to exit

There appears to be no way to control the normalisation.

I have a pure fluorescence mosaic that I want to stitch. It works fine but the normalisation is totally broken. All the regions with any fluorescence are totally saturated after normalisation. I suggest you add a flag to turn off normalisation.

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.