Skip to content

Instantly share code, notes, and snippets.

@tech4GT
Created August 9, 2018 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tech4GT/92cabeb44c3f8464c501651e2d4f381e to your computer and use it in GitHub Desktop.
Save tech4GT/92cabeb44c3f8464c501651e2d4f381e to your computer and use it in GitHub Desktop.
GSOC 2018 work on Image Sequencer

Core Improvements and new module system

Project Info

Project Repository

Invert Module Repository

Grunt Plugin Repository

Pull requests

Public Lab Proposal Note

Summer of code proposal

NPM

Demo

Introduction

Image Sequencer is a sequential Image Processing and analysis system for browser, Node.js and the command line. It is non destructive in the sense that a new Image is created after each processing step. It is targeted towards people trying to run analysis on scientific imagery for their research.

The Modular Module System

A module is a single image processing step that is applied to all the Images loaded into sequenceer. Some of these modules are baked into sequencer by commiting their code into the sequencer source itself. To make this system more scalable I have implemented a new module system which allows for modules to be distributed via npm separately and consumed into sequencer dynamically.

An example of this is the new Invert module

The following commands can be used to install modules which are distributed via npm:

CLI

sequencer --install-module "invert image-sequencer -invert"

This command installs the npm package image-sequencer-invert then adds it as a dependency of Image Sequencer locally and loads this new module into sequencer for usage.

Node.js

sequencer.saveNewModule("path to files")
sequencer.loadNewModule("module name")

In the Browser context the modules can be included as script files.

Coding a Module

A Module must follow a basic format which makes it compatible with Image Sequencer. This summer I worked on minimizing the amount of code required inside a module, a lot of redundancy was eliminated and the default UI functions are now called automatically rather than the module having to call them.

Old Module Structure: New Module Structure:

The New String Syntax

Image Sequencer encodes the applied sequence of steps and their settings into a compact string which is then appended to the URL. Following are the methods associated with stringifying and JSONifying a sequence.

sequencer.toString() // String for the sequence currently loaded 
sequencer.importString() // Imports the stringified sequence
sequencer.toJSON() // returns the current sequence in JSON
sequencer.importJSON() // imports a JSON sequence

A simple exaple of a stringified sequence is channel{channel:green},blur{blur:2}

Sequences can also be saved. In the browser the following button can be used Inside the cli the new --save-sequence option can be used

Meta Modules

With the work done this summer it is now possible to reuse module code by consuming various modules into one meta-module. These meta-modules have their own meta-data and their inputs are the inputs of their constituent steps. I have made a Colorbar meta module which adds a colorbar to the image.

See it in action here colorbar{}

A meta module expands itself into its constituent steps giving them proper inputs at runtime itself which enables them to be loaded from the URL itself.

Other Improvements

A lot of other goals were achieved which include:

Optimizing sequencer.run method so all the steps are not re-run every time steps are added or removed.

Named exports in the CLI which enable output Images to be exported to a desired location with a desired name and a desired extension

sequencer -i "./something.png" -o "./example.jpg" -s "invert"

An addition to the UI which enables the user to see the pixel value of an ndvi image by hovering on a particular location

A grunt plugin which enables Image sequence4r to be run with grunt - grunt-image-sequencer

Contributing

During the later part of my project I created various FTO issues and we were lucky to welcome some newcomers on the project.

List of all first timer issues

For contribution guidelines please checkout contributing.md

For further reading please do checkout the Readme

Conclusion

I was able to accomplish a lot of core work this summer which itself adds some great features and sets the platform for future work. I would like to thank google and publiclab for this awesome opportunity which made my summer a blast. Also thanks to all the mentors who have been supporting and reviewing my work.

For now I would continue to work on Image Sequencer but now that summer is over I will shift my focus more towards boosting our community and welcoming even more people to the project. Once again thanks a lot to everyone involved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment