Code Monkey home page Code Monkey logo

simplified-io's Introduction

Simplified-IO

Read, write, type convert images using simple methods.

There are currently at least 3 ways to open an image in ImageJ:

- using the ij library (aka ImageJ1)
- using the SCIFIO library (part of ImageJ2)
- using the BioFormats library (for instrument specific images)

When opening images with Fiji this is handled behind the scene for the user, including having to switch between legacy ImageJ1 ImagePlus objects and ImageJ2 ImgPlus objects. However there are plenty of situations (like writing scripts or plug-ins) where one has to deal with image reading and writing directly.

This small library attempts to hide some of the complexities by standardizing on the use of ImgPlus objects as input and output to very simple open and save methods. There are 4 public static methods available:

To read:

ImgPlus<?> readImage = SimplifiedIO.openImage( "/path/to/myimage.tif" );

To read and convert data type in one step:

ImgPlus< DoubleType > readImageDouble = SimplifiedIO.openImage( "/path/to/myimage.tif" , new DoubleType() );

To save (the saved image type is dictated by the file name extension):

SimplifiedIO.saveImage( readImage, "/path/to/mynewimage.tif" );

Additionally, a type conversion method is also available:

ImgPlus< DoubleType > readImageDouble = SimplifiedIO.convert( readImage, new DoubleType() );

All methods throw a runtime SimplifiedIOException which covers fatal errors encountered while opening or saving an image (e.g. FileNotFoundException, IOException, unsupported format, etc).

A number of test images of various formats were used for testing. For convenience, these can be found in the test-images directory.

How to use in your own code?

Simplified-IO is intended for use in your SciJava projects, e.g. your Fiji Plugins.

If you don't know better, you should start with a pom.xml that uses pom-scijava as parent POM.

Within it you can then include the following dependency in order to enable Simplified-IO:

<dependency>
    <groupId>sc.fiji</groupId>
    <artifactId>simplified-io</artifactId>
    <version>1.0.1</version>
</dependency>

Footnote: please determine the latest version via https://maven.scijava.org/#nexus-search;quick~simplified-io. At some point in the future we hope that the SciJava parent POM will take care of this and you can drop the version-tag altogether.

This all means little to you? You might want to check out https://imagej.net/Learnathon

simplified-io's People

Contributors

fjug avatar maarzt avatar tpietzsch avatar

Watchers

 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.