Skip to content

Commit

Permalink
Updated backlog/roadmap
Browse files Browse the repository at this point in the history
Improved naming for image loading:
  loadImage() now just loads the image and does not cache it
  loadAndCacheImage() loads and caches the image
updated examples to use new
  • Loading branch information
chafey committed May 6, 2014
1 parent b591d68 commit b1f6c47
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dist/cornerstone.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! cornerstone - v0.3.0 - 2014-05-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
/*! cornerstone - v0.3.0 - 2014-05-06 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
.cornerstone-enabled-image {

/* prevent text selection from occurring when dragging the mouse on the div */
Expand Down
24 changes: 19 additions & 5 deletions dist/cornerstone.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! cornerstone - v0.3.0 - 2014-05-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
/*! cornerstone - v0.3.0 - 2014-05-06 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
var cornerstone = (function (cornerstone) {

"use strict";
Expand Down Expand Up @@ -901,7 +901,7 @@ var cornerstone = (function (cornerstone) {
// Loads an image given an imageId and returns a promise which will resolve
// to the loaded image object or fail if an error occurred. The loaded image
// is not stored in the cache
function loadImageNoCache(imageId) {
function loadImage(imageId) {
if(imageId === undefined) {
throw "loadImage: parameter imageId must not be undefined";
}
Expand All @@ -922,13 +922,27 @@ var cornerstone = (function (cornerstone) {
// Loads an image given an imageId and returns a promise which will resolve
// to the loaded image object or fail if an error occurred. The image is
// stored in the cache
function loadImage(imageId) {
function loadAndCacheImage(imageId) {
if(imageId === undefined) {
throw "loadAndCacheImage: parameter imageId must not be undefined";
}

var imagePromise = cornerstone.imageCache.getImagePromise(imageId);
if(imagePromise !== undefined) {
return imagePromise;
}

imagePromise = loadImageFromImageLoader(imageId);
if(imagePromise === undefined) {
throw "loadAndCacheImage: no image loader for imageId";
}

var imagePromise = loadImageNoCache(imageId);
cornerstone.imageCache.putImagePromise(imageId, imagePromise);

return imagePromise;
}


// registers an imageLoader plugin with cornerstone for the specified scheme
function registerImageLoader(scheme, imageLoader) {
imageLoaders[scheme] = imageLoader;
Expand All @@ -944,7 +958,7 @@ var cornerstone = (function (cornerstone) {
// module exports

cornerstone.loadImage = loadImage;
cornerstone.loadImageNoCache = loadImageNoCache;
cornerstone.loadAndCacheImage = loadAndCacheImage;
cornerstone.registerImageLoader = registerImageLoader;
cornerstone.registerUnknownImageLoader = registerUnknownImageLoader;

Expand Down
2 changes: 1 addition & 1 deletion dist/cornerstone.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/cornerstone.min.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docs/backlog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Backlog:

Beyond v1.0:
------------
* [ASM.JS](http://asmjs.org/) version of storedPixelDataToCanvasImageData and generateLut
* Packaging/build related
* AMD wrapper to make it easier to use with AMD loaders
* more viewport functionality
* pseudo color tables (for PET, MRI)
* [ASM.JS](http://asmjs.org/) version of storedPixelDataToCanvasImageData and generateLut
* [Native Client](https://developers.google.com/native-client/dev/) version of storedPixelDataToCanvasImageData
and generateLut
* Cine clip support via HTML5 video tag
Expand Down
6 changes: 0 additions & 6 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Phase 6 (in progress - target by May 15 for SIIM)
--------------------
* API documentation
* Testing for other browsers and platforms (automated if possible)
* Packaging/build related
* AMD wrapper to make it easier to use with AMD loaders
* more viewport functionality
* pseudo color tables (for PET, MRI)
* Code cleanup / refactoring / documentation


Phase 5 (completed April 17, 2014)
---------------------
Expand Down
6 changes: 3 additions & 3 deletions example/imageCache/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1>

$('#addImage').click(function() {
var imageId = "colorImageLoader://" + imageNum++;
cornerstone.loadImage(imageId);
cornerstone.loadAndCacheImage(imageId);
});

setInterval(function() {
Expand All @@ -94,7 +94,7 @@ <h1>
var canvas = document.createElement('canvas');

// Loads an image given an imageId
function loadImage(imageId) {
function loadImage (imageId) {

var width = 256;
var height = 256;
Expand Down Expand Up @@ -175,7 +175,7 @@ <h1>

// load image and display it
var imageId = "colorImageLoader://1";
cornerstone.loadImage(imageId).then(function(image) {
cornerstone.loadAndCacheImage(imageId).then(function(image) {
cornerstone.displayImage(element, image);

// add event handlers to mouse move to adjust window/center
Expand Down
1 change: 1 addition & 0 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h1>
<li><a href="nonSquarePixels/index.html">Non square pixels</a></li>
<li><a href="colorImage/index.html">Color Images</a></li>
<li><a href="scrollzoompanwl/index.html">All features (scroll, zoom, pan, window/level, html overlays, resize, invert, interpolation)</a></li>
<li><a href="imageCache/index.html">Image Cache</a></li>
</ul>


Expand Down
6 changes: 3 additions & 3 deletions example/multiimage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ <h1>
var mr3 = cornerstone.enable(document.getElementById('ct1'));

// load and display the images
cornerstone.loadImage('example://1').then(function(image) {
cornerstone.loadAndCacheImage('example://1').then(function(image) {
cornerstone.displayImage(mr1, image);
});
cornerstone.loadImage('example://2').then(function(image) {
cornerstone.loadAndCacheImage('example://2').then(function(image) {
cornerstone.displayImage(mr2, image);
});
cornerstone.loadImage('ctexample://1').then(function(image) {
cornerstone.loadAndCacheImage('ctexample://1').then(function(image) {
cornerstone.displayImage(ct1, image);
});
});
Expand Down
2 changes: 1 addition & 1 deletion example/scrollzoompanwl/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h1>

// updates the image display
function updateTheImage(imageIndex) {
return cornerstone.loadImage(imageIds[imageIndex]).then(function(image) {
return cornerstone.loadAndCacheImage(imageIds[imageIndex]).then(function(image) {
currentImageIndex = imageIndex;
var viewport = cornerstone.getViewport(element);
cornerstone.displayImage(element, image, viewport);
Expand Down
22 changes: 18 additions & 4 deletions src/imageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var cornerstone = (function (cornerstone) {
// Loads an image given an imageId and returns a promise which will resolve
// to the loaded image object or fail if an error occurred. The loaded image
// is not stored in the cache
function loadImageNoCache(imageId) {
function loadImage(imageId) {
if(imageId === undefined) {
throw "loadImage: parameter imageId must not be undefined";
}
Expand All @@ -56,13 +56,27 @@ var cornerstone = (function (cornerstone) {
// Loads an image given an imageId and returns a promise which will resolve
// to the loaded image object or fail if an error occurred. The image is
// stored in the cache
function loadImage(imageId) {
function loadAndCacheImage(imageId) {
if(imageId === undefined) {
throw "loadAndCacheImage: parameter imageId must not be undefined";
}

var imagePromise = cornerstone.imageCache.getImagePromise(imageId);
if(imagePromise !== undefined) {
return imagePromise;
}

imagePromise = loadImageFromImageLoader(imageId);
if(imagePromise === undefined) {
throw "loadAndCacheImage: no image loader for imageId";
}

var imagePromise = loadImageNoCache(imageId);
cornerstone.imageCache.putImagePromise(imageId, imagePromise);

return imagePromise;
}


// registers an imageLoader plugin with cornerstone for the specified scheme
function registerImageLoader(scheme, imageLoader) {
imageLoaders[scheme] = imageLoader;
Expand All @@ -78,7 +92,7 @@ var cornerstone = (function (cornerstone) {
// module exports

cornerstone.loadImage = loadImage;
cornerstone.loadImageNoCache = loadImageNoCache;
cornerstone.loadAndCacheImage = loadAndCacheImage;
cornerstone.registerImageLoader = registerImageLoader;
cornerstone.registerUnknownImageLoader = registerUnknownImageLoader;

Expand Down

0 comments on commit b1f6c47

Please sign in to comment.