Skip to content

Commit

Permalink
docs: Fix grammar and links (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska authored and dannyrb committed Oct 25, 2019
1 parent a0071e4 commit c29c4fa
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ documentation/
docs/_book
docs/api.md
dist/
.DS_Store
4 changes: 2 additions & 2 deletions docs/advanced/enabled-element-data.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Cornerstone supports storing and retrieving arbitrary Enabled Element Data within the HTML data- fields of an Element
description: Cornerstone supports storing and retrieving arbitrary Enabled Element Data within the HTML data- fields of an Element.
---

# Enabled Element Data

> Cornerstone supports storing and retrieving arbitrary **Enabled Element Data**
> Cornerstone supports storing and retrieving arbitrary **Enabled Element Data**.
2 changes: 1 addition & 1 deletion docs/advanced/enabled-element-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Basics:
* An Enabled Element can have more than one Layer.
* Each Layer is similar to an Enabled Element - They each have their own *Image* and *Viewport*, off-screen rendering Canvas, etc...
* Only a single Layer can be active at a time.
* Layers have properties for visibility and opacity, and are uniquely referenced by a Layer ID
* Layers have properties for visibility and opacity, and are uniquely referenced by a Layer ID.

When a Layer is Active:
* The layer's *Image* is available at enabledElement.image
Expand Down
14 changes: 7 additions & 7 deletions docs/advanced/image-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ description: Cornerstone stores Images inside the Image Cache to keep track of m

# Image Cache

> Cornerstone stores **Images** inside the **Image Cache** to keep track of memory usage.
> Cornerstone stores **[Images](../concepts/images.md)** inside the **Image Cache** to keep track of memory usage.
When the Promise within an Image Load Object resolves, the resulting Image is stored in an Object in the Image Cache module by Cornerstone. This is set up to operate as a least-recently-used (LRU) cache.
When the Promise within an [Image Load Object](../api.md#imageloadobject) resolves, the resulting Image is stored in an Object in the Image Cache module by Cornerstone. This is set up to operate as a least-recently-used (LRU) cache.

Initially, when loadImage is called, the cache is populated with a placeholder for the cached image with a recorded size of 0. When the Promise tracking the image loading has resolved, the recorded size is updated with the actual size in bytes. If the loading fails, the placeholder is removed from the cache.
Initially, when [loadImage](../api.md#loadimage) is called, the cache is populated with a placeholder for the cached image with a recorded size of 0. When the Promise tracking the image loading has resolved, the recorded size is updated with the actual size in bytes. If the loading fails, the placeholder is removed from the cache.

Developers can:
* Set the maximum cache size, default 1 GB ([setMaximumSizeBytes](../api#setMaximumSizeBytes))
* Manually purge the cache of all images ([purgeCache](../api#purgeCache))
* Retrieve a summary of the cache ([getCacheInfo](../api#getCacheInfo))
* Change the recorded cache size of a specific Image ([changeImageIdCacheSize](../api#changeImageIdCacheSize))
* Set the maximum cache size, default 1 GB ([setMaximumSizeBytes](../api.md#setmaximumsizebytes))
* Manually purge the cache of all images ([purgeCache](../api.md#purgecache))
* Retrieve a summary of the cache ([getCacheInfo](../api.md#getcacheinfo))
* Change the recorded cache size of a specific Image ([changeImageIdCacheSize](../api.md#changeimageidcachesize))
6 changes: 2 additions & 4 deletions docs/advanced/legacy-browser-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ description: Cornerstone can be made to support legacy browsers by incorporating
You **may** need to include polyfills for these features, depending on which browsers you target.

* [Promises](https://caniuse.com/#feat=promises) represent the eventual result of an asynchronous operation. These are used by [Image Loaders](../concepts/image-loaders.md). You will need to polyfill Promises to use Internet Explorer 11.
* [Promises](https://caniuse.com/#feat=promises) represent the eventual result of an asynchronous operation. These are used by [Image Loaders](../concepts/image-loaders.md). You will need to polyfill Promises to use Internet Explorer 11. Here is [a lightweight Promise polyfill](https://github.com/taylorhakes/promise-polyfill) which is MIT Licensed.

Here is [a lightweight Promise polyfill](https://github.com/taylorhakes/promise-polyfill) which is MIT Licensed.

* [requestAnimationFrame](https://caniuse.com/#feat=requestanimationframe) is a method for efficiently running animations. We are currently [check for its availability ourselves within Cornerstone](https://github.com/cornerstonejs/cornerstone/blob/master/src/internal/requestAnimationFrame.js), but may remove this in the future. There are many options for a [requestAnimationFrame polyfill in this gist by Paul Irish](https://gist.github.com/paulirish/1579671).
* [requestAnimationFrame](https://caniuse.com/#feat=requestanimationframe) is a method for efficiently running animations. We currently [check for its availability ourselves within Cornerstone](https://github.com/cornerstonejs/cornerstone/blob/master/src/internal/requestAnimationFrame.js), but may remove this in the future. There are many options for a [requestAnimationFrame polyfill in this gist by Paul Irish](https://gist.github.com/paulirish/1579671).

* [performance.now](https://caniuse.com/#feat=high-resolution-time) is used for high-resolution timing for performance monitoring within Cornerstone. We are currently [avoiding errors ourselves within Cornerstone](https://github.com/cornerstonejs/cornerstone/blob/master/src/internal/now.js#L11), but may remove this in the future. Here is a [performance.now polyfill](https://gist.github.com/paulirish/5438650).

Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/modality-lut-and-voi-lut.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Cornerstone supports both Value of Interest (VOI) and Modality Look

# Modality LUT and VOI LUT

> Cornerstone supports both Value of Interest (VOI) and Modality Lookup Tables
> Cornerstone supports both Value of Interest (VOI) and Modality Lookup Tables.
Lookup tables define transformations from stored pixel values to presentation pixel values.

Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/retrieving-pixel-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Cornerstone supports retrieval of stored and transformed pixels fro

# Retrieving Pixel Data

> Cornerstone supports retrieval of stored and transformed pixels from Images
> Cornerstone supports retrieval of stored and transformed pixels from Images.
* [getPixels](../api#getPixels)
* [getStoredPixels](../api#getStoredPixels)
* [getPixels](../api.md#getpixels)
* [getStoredPixels](../api.md#getstoredpixels)
2 changes: 1 addition & 1 deletion docs/advanced/webgl-rendering-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: Cornerstone supports an optional WebGL rendering pipeline for incre

# WebGL Rendering Pipeline

> Cornerstone supports an optional WebGL rendering pipeline for increased performance
> Cornerstone supports an optional WebGL rendering pipeline for increased performance.
2 changes: 1 addition & 1 deletion docs/concepts/metadata-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To handle these scenarios, Cornerstone provides infrastructure for the definitio
Here is a simple example of a Metadata Provider which returns an Object containing Image Plane metadata for a single specific image (Image Id: 'ct://1'):

````javascript
function metaDataProvider(type, imageId)
function metaDataProvider(type, imageId) {
if (type === 'imagePlaneModule') {
if (imageId === 'ct://1') {
return {
Expand Down
6 changes: 3 additions & 3 deletions docs/concepts/pixel-coordinate-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ description: The Pixel Coordinate System is used when referring to individual pi

The Pixel Coordinate System is used when referring to individual pixels in the image and supports sub-pixel precision. The origin of the coordinate system is such that 0.0,0.0 is the top left corner of the top left pixel in the image and columns, rows would be the bottom right corner of the bottom right pixel in the image. A coordinate of .5,.5 is therefore the center of the top left pixel.

1. The function pageToPixel() can be used to convert coordinates obtained from browser events to coordinates
1. The function [pageToPixel()](../api.md#pagetopixel) can be used to convert coordinates obtained from browser events to coordinates
in the pixel coordinate system.
2. The function setToPixelCoordinateSystem() can be used to set the canvas context to the pixel coordinate system. This is useful when handling the CornerstoneImageRendered event to draw geometry on top of the image.
2. The function [setToPixelCoordinateSystem()](../api.md#settopixelcoordinatesystem) can be used to set the canvas context to the pixel coordinate system. This is useful when handling the CornerstoneImageRendered event to draw geometry on top of the image.
3. This coordinate system matches that specified in the DICOM Grayscale Softcopy Presentation State Graphic Annotation module for graphics drawn using the PIXEL annotation units.
4. Use Math.ceil() to convert from the pixel coordinate system to the integer pixel number (for looking up the pixel value in the pixel data)
4. Use `Math.ceil()` to convert from the pixel coordinate system to the integer pixel number (for looking up the pixel value in the pixel data).
16 changes: 9 additions & 7 deletions docs/concepts/rendering-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ description: Viewport (e.g. windowing, pan, zoom) changes for Cornerstone Enable

> Viewport (e.g. windowing, pan, zoom, etc...) changes for Cornerstone Enabled Elements are updated through a rendering loop based on [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame).
The rendering loop make use of the [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) (RAF) method in most modern browsers. If RAF is not available, it is shimmed with a 16 ms timer using setTimeout and clearTimeout.
The rendering loop make use of the [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) (RAF) method in most modern browsers. If RAF is not available, it is shimmed with a 16 ms timer using `setTimeout` and `clearTimeout`.

The rendering loop is enabled on an element-by-element basis when elements are enabled or disabled for use with Cornerstone.

The workflow is as follows:
1. A draw() callback is registered with RAF;
2. draw() is called by the browser just after a frame is displayed on screen;

1. A [draw()](../api.md#draw) callback is registered with RAF;
2. [draw()](../api.md#draw) is called by the browser just after a frame is displayed on screen;
3. Once called,
* if the element was scheduled for re-rendering, it is rendered and draw() is re-registered with RAF;
* if the element was scheduled for re-rendering, it is rendered and [draw()](../api.md#draw) is re-registered with RAF;
* if the element was **not** scheduled for re-rendering, no work is performed and the callback is re-registered with RAF;
* if the element was disabled(), the callback is **not** re-registered, ending the rendering loop.
* if the element was disabled, the callback is **not** re-registered, ending the rendering loop.

This means that:
* cornerstone.draw() and cornerstone.invalidate() do not trigger immediate rendering the viewport. Instead, they flag the image as needing re-rendering;
* Each cornerstone element register its own RAF loop;

* [draw()](../api.md#draw) and [invalidate()](../api.md#invalidate) do not trigger immediate rendering of the viewport. Instead, they flag the image as needing re-rendering;
* Each cornerstone element registers its own RAF loop;
* If the rendering time exceeds 16 ms on a 60 Hz system, rendering frames are skipped;
* Only one render per frame is possible, even if render time is much lower than 16 ms;
* All interactions (e.g. windowing, pan, zoom, etc...) are combined and rendered in the next frame.
2 changes: 1 addition & 1 deletion docs/concepts/viewports.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Each Enabled Element has a Viewport which describes how the Image s

# Viewports

> Each [Enabled Element](enabled-elements.md) has a **Viewport** which describes how the [Image](images.md) should be rendered.
> Each [Enabled Element](enabled-elements.md) has a **[Viewport](../api.md#viewport)** which describes how the [Image](images.md) should be rendered.
The viewport parameters for an enabled element can be obtained via the [getViewport()](../api.md#getviewport) function and set using the [setViewport()](../api.md#setviewport) function. The available properties for the Viewport can be found in the [Viewport object definition](../api.md#viewport) in the API documentation.

Expand Down
2 changes: 1 addition & 1 deletion src/invalidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import triggerEvent from './triggerEvent.js';
import EVENTS from './events.js';

/**
* Sets the invalid flag on the enabled element and fire an event
* Sets the invalid flag on the enabled element and fires an event
* @param {HTMLElement} element The DOM element enabled for Cornerstone
* @returns {void}
* @memberof Drawing
Expand Down
2 changes: 1 addition & 1 deletion src/invalidateImageId.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getEnabledElementsByImageId } from './enabledElements.js';
import drawImage from './internal/drawImage.js';

/**
* Forces the image to be updated/redrawn for the all enabled elements
* Forces the image to be updated/redrawn for all enabled elements
* displaying the specified imageId
*
* @param {string} imageId The imageId of the Cornerstone Image Object to redraw
Expand Down

0 comments on commit c29c4fa

Please sign in to comment.