oxfordrse / electron-sight Goto Github PK
View Code? Open in Web Editor NEWSlide viewer for histology images
Slide viewer for histology images
Falls under #48
The app currently needs to store:
Where should this be stored?
I'm leaning towards 2 so I can learn how redux works....
to isolate individual cells, see #32 (comment)
can use opencv-js: https://docs.opencv.org/3.4/d5/d10/tutorial_js_root.html
this electron npm module might be useful as well: https://github.com/justadudewhohacks/opencv-electron
Put scale information in lower left corner, like the osd plugin in https://github.com/usnistgov/OpenSeadragonScalebar
The Annotation, Classifier and Predict classes all have onClick logic that should be moved to ApplicationState
@iamleeg, was this what you had in mind for ApplicationState?
at the moment most of the logic for the UI is in the Menu component. Should live in App.jsx
, and then the Menu.jsx
can just be stateless
npm test
results in failure:
> [email protected] test /home/mrobins/git/Electron-Sight
> mocha --require babel-core/register
/home/mrobins/git/Electron-Sight/node_modules/mocha/node_modules/yargs/yargs.js:1163
else throw err
^
Error: Cannot find module '../src/ApplicationState'
Require stack:
- /home/mrobins/git/Electron-Sight/test/test_application_state.js
- /home/mrobins/git/Electron-Sight/node_modules/mocha/lib/mocha.js
- /home/mrobins/git/Electron-Sight/node_modules/mocha/lib/cli/one-and-dones.js
- /home/mrobins/git/Electron-Sight/node_modules/mocha/lib/cli/options.js
- /home/mrobins/git/Electron-Sight/node_modules/mocha/bin/mocha
Sight does not support multiple files at once, so we should clear state when opening a new file.
so that user can go back and either change classifier parameters or add new data
After merging in #35, got the following error:
A JavaScript error occurred in the main process
Uncaught Exception:
ReferenceError: regeneratorRuntime is not defined
at /home/mrobins/git/Electron-Sight/src/index.js:46:46
at Object.<anonymous> (/home/mrobins/git/Electron-Sight/src/index.js:102:2)
at Object.<anonymous> (/home/mrobins/git/Electron-Sight/src/index.js:128:3)
at Module._compile (internal/modules/cjs/loader.js:693:30)
at Object.require.extensions.(anonymous function) [as .js] (/home/mrobins/git/Electron-Sight/node_modules/electron-compile/lib/require-hook.js:77:14)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at init (/home/mrobins/git/Electron-Sight/node_modules/electron-compile/lib/config-parser.js:294:16)
Perhaps related to babel/babel#8829
There is a C library VLFeat: http://www.vlfeat.org/ (BSD licence)
This has
going to try and compile this as a nodejs module using node-gyp so we can use it
An example would be exiting annotation mode
Final app will need to store multiple classifiers, annotations, and annotations+classifier results, need to create classes to store these
Possible candidates to use
https://github.com/Emigre/openseadragon-annotations
https://annotorious.github.io/demos/openseadragon-preview.html (can label annotations as well, but only squares supported; polygon support is beta).
Potential workflow:
for the classifier: it looks like the superpixels don't match up with features in the image, so the slic routine must be getting incorrect image data
For demo in Jan, Joshua recommended a separate plotting tab that would displace summary statistics of classified regions, potential plots include:
from meeting 13th Dec - @martinjrobins @jbull
Clinicians (Philip) very concerned with ease of creating annotation -
e.g. freehand drawing of region, which then is simplified to polygon, then add/edit points in polygon
paperjs has functionality for this, could integrate with app
Related to #4, openslide should have this information
Use mocha and chai to add unit tests.
OpenSeadragon cannot read whole slide images formats (from Aperio, Hamamatsu and so on)
But it can read DeepZoom.
So whole slide images must be first converted to Deepzoom.
The main tool for that is libvips, it relies on openslide to read whole slide images.
libvips defines a function vips_dzsave
int
vips_dzsave (VipsImage *in,
const char *name,
...);
Can also be used from the command line vips
utility
vips dzsave CMU-3.ndpi CMU-3.dzi
Someone asking for node.js bindings for openslide on the
openslide repo (openslide/openslide#204)
Main libvips developer John Cupitt suggests to use sharp
sharp('input.tiff')
.png()
.tile({
size: 512
})
.toFile('output.dz', function(err, info) {
// output.dzi is the Deep Zoom XML definition
// output_files contains 512x512 tiles grouped by zoom level
});
The documentation used to include installation instructions for installing sharp with openslide support but now no mention of openslide anymore...
I naively tried
sharp('CMU-3.ndpi')
.png()
.tile({
size: 512
})
.toFile('output.dz', function(err, info) {
// output.dzi is the Deep Zoom XML definition
// output_files contains 512x512 tiles grouped by zoom level
});
but doesn't produce any output.
In may 2017 jcupitt writes
@xmkevin, sharp can read all the formats that openslide can read,
you just need to enable openslide support. There are some notes in the README.
Somehow one may has to /enable openslide support/ and I'm not sure what that means. Potentially useful to figure it out because sharp, coupled with openslide seems to be able to do precisely what we are looking for.
Sept. 2017: Experimental node binding for libvips
(https://github.com/libvips/node-vips)
The gitHub repo provide an example reading a whole slide image with openslide:
var vips = require('vips');
// get a rect from a level
// autocrop trims off pixels outside the image bounds
var image = vips.Image.openslideload('somefile.svs', {level: 2, autocrop: true});
console.log('level size:', image.width, 'x', image.height);
// try 'vipsheader -a somefile.svs' at the command-line to see all the metadata
// fields you can get
console.log('associated images are:', image.get('slide-associated-images'));
// crop is left, top, width, height in pixels
// images are RGBA with premultiplication taken out
image.crop(100, 100, 1000, 1000).writeToFile('x.png');
// extract an associated image
image = vips.Image.openslideload('somefile.svs', {associated: 'label'});
image.writeToFile('label.png');
That also looks like exactly what we'd need.
!!! !!! Had to update libvips to the latest version.
Didn't work with the libvips-dev available in the ubuntu repo, so installed from source.
Now possible to read a slide using vips in javascript
const vips = require('vips');
var image = vips.Image.openslideload('CMU-3.ndpi')
dzsave
using javascript bindings// None of these work
var test = vips.Image.dzsave('CMU-3.ndpi', 'test.dz')
image.dzsave('output.dz')
vips.Image.dzsave('CMU-3.dzi')
dzsave
is only mentioned in lib/autogen.js
vips.Image.prototype.dzsave = function (filename, options) {
return vips.call('dzsave', this, filename, options);
};
vips.Image.prototype.dzsaveBuffer = function (options) {
return vips.call('dzsave_buffer', this, options);
};
Suggested workflow:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.