Skip to content

Commit

Permalink
feat: pdf render as pngs (#290)
Browse files Browse the repository at this point in the history
* feat: pdf render as pngs

* fix: ci

* Update docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
daron1337 and github-actions[bot] authored Jan 16, 2024
1 parent 01fb823 commit bc4b826
Show file tree
Hide file tree
Showing 157 changed files with 233,670 additions and 2,088 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
steps:
# CLone repo at current branch
- name: Clone repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.head_ref }}
token: ${{ secrets.GIT_TOKEN }}

# Setup node environment
- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: "14"
node-version: "20"

# Install node modules
- name: Install node modules
Expand All @@ -33,7 +33,7 @@ jobs:
# Clone template
- name: Clone docdash template
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: clenemt/docdash
path: ./template/docdash/
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This is a basic workflow to help you get started with Actions

name: CI-Release

# Controls when the action will run. Triggers the workflow on push or pull request
Expand All @@ -18,11 +16,13 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Setup node environment
- name: Setup Node.js environment
uses: actions/[email protected]
uses: actions/setup-node@v4
with:
node-version: "20"

# Clean examples and docs file
- name: Clean examples and docs file
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

## Dicom Image Toolkit for CornerstoneJS

### Current version: 2.1.0
### Current version: 2.1.1

### Latest Published Release: 2.1.0
### Latest Published Release: 2.1.1

This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.

Expand Down
5 changes: 3 additions & 2 deletions dist/imaging/imageRendering.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ export declare function loadAndCacheImages(series: Series, callback: (payload: {
* @function renderDICOMPDF
* @param {Object} seriesStack - The original series data object
* @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
* @param {Boolean} convertToImage - An optional flag to convert pdf to image, default is false
* @returns {Promise} - Return a promise which will resolve when pdf is displayed
*/
export declare const renderDICOMPDF: (seriesStack: Series, elementId: string | HTMLElement) => Promise<true>;
export declare const renderDICOMPDF: (seriesStack: Series, elementId: string | HTMLElement, convertToImage?: boolean) => Promise<true>;
/**
* Render an image (png or jpg) from File on a html div using cornerstone
* @instance
Expand All @@ -51,7 +52,7 @@ export declare const renderDICOMPDF: (seriesStack: Series, elementId: string | H
* @param {String} elementId - The html div id used for rendering or its DOM HTMLElement
* @returns {Promise} - Return a promise which will resolve when image is displayed
*/
export declare const renderFileImage: (file: File, elementId: string | HTMLElement) => Promise<unknown> | undefined;
export declare const renderFileImage: (file: File, elementId: string | HTMLElement) => Promise<true>;
/**
* Render an image (png or jpg) from web url on a html div using cornerstone
* @instance
Expand Down
9 changes: 9 additions & 0 deletions dist/imaging/loaders/fileLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ export declare const populateFileManager: (file: File) => void;
* @return {String} current file image id
*/
export declare const getFileImageId: (file: File) => string | null;
/**
* Return the common data file manager
* @instance
* @function getFileManager
* @returns {Object} the file manager
*/
export declare const getFileManager: () => {
[key: string]: string;
};
27 changes: 27 additions & 0 deletions dist/imaging/parsers/pdf.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** @module imaging/parsers/pdf
* @desc This file provides functionalities for
* managing pdf files using pdfjs-dist library
*/
import { pdfType } from "../types";
/**
* This module provides the following functions to be exported:
* convertToPNG(pdf, pageNumber)
* generateFiles(fileURL)
*/
/**
* Convert a pdf page to a png image in base64 format
* @instance
* @function convertToPNG
* @param {pdfType} pdf - The pdf object
* @param {number} pageNumber - The page number to be converted
* @returns {string} The png image in base64 format
*/
export declare const convertToPNG: (pdf: pdfType, pageNumber: number) => Promise<string>;
/**
* Generate an array of files from a pdf file
* @instance
* @function generateFiles
* @param {string} fileURL - The url of the pdf file
* @returns {File[]} An array of files
*/
export declare const generateFiles: (fileURL: string) => Promise<File[]>;
10 changes: 5 additions & 5 deletions dist/imaging/tools/custom/contourTool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,15 @@ export class ContoursTool {
*/
fireModifiedEvent(element: any, measurementData: any): void;
fireCompletedEvent(element: any, measurementData: any): void;
set spacing(arg: any);
set spacing(value: any);
get spacing(): any;
set activeHandleRadius(arg: any);
set activeHandleRadius(value: any);
get activeHandleRadius(): any;
set completeHandleRadius(arg: any);
set completeHandleRadius(value: any);
get completeHandleRadius(): any;
set alwaysShowHandles(arg: any);
set alwaysShowHandles(value: any);
get alwaysShowHandles(): any;
set invalidColor(arg: any);
set invalidColor(value: any);
get invalidColor(): any;
/**
* Ends the active drawing loop and removes the polygon.
Expand Down
2 changes: 1 addition & 1 deletion dist/imaging/tools/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare const initializeCSTools: (settings?: ToolSettings, style?: ToolStyle) =>
/**
* Create stack object to sync stack tools
* @function csToolsCreateStack
* @param {HTMLElement} element - The target hmtl element.
* @param {HTMLElement} element - The target html element.
* @param {Array?} imageIds - Stack image ids.
* @param {String} currentImageId - The current image id.
*/
Expand Down
5 changes: 3 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference path="../decs.d.ts" />
declare const VERSION: string;
import cornerstone from "cornerstone-core";
import cornerstoneTools from "cornerstone-tools";
Expand Down Expand Up @@ -28,8 +29,8 @@ import { buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, get
import { getDicomImageId, cacheImage, cacheImages } from "./imaging/loaders/dicomLoader";
import { loadReslicedImage } from "./imaging/loaders/resliceLoader";
import { loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache } from "./imaging/loaders/multiframeLoader";
import { fileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId } from "./imaging/loaders/fileLoader";
import { getFileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId } from "./imaging/loaders/fileLoader";
import { getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB } from "./imaging/imageColormaps";
import { saveAnnotations, loadAnnotations } from "./imaging/tools/io";
import { addMouseKeyHandlers, removeMouseKeyHandlers, toggleMouseToolsListeners } from "./imaging/tools/interaction";
export { VERSION, cornerstone, cornerstoneTools, parseDicom, segModule, cornerstoneDICOMImageLoader, checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory, getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor, store, parseECG, renderECG, unrenderECG, syncECGFrame, updateECGFrame, getDefaultECGLayout, getImagePresets, setImagePreset, setImageCustomPreset, getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata, buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage, exportImageToBase64, anonymize, buildLayer, updateLayer, getActiveLayer, setActiveLayer, initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, updateLoadedStack, readFile, readFiles, parseDataSet, clearImageParsing, clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, resetViewports, updateViewportData, toggleMouseToolsListeners, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, resliceSeries, getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB, parseContours, updateLarvitarManager, populateLarvitarManager, getLarvitarManager, getLarvitarImageTracker, resetLarvitarManager, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager, buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions, loadReslicedImage, getDicomImageId, cacheImage, cacheImages, loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache, fileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId, addDiameterTool, addContoursTool, addMaskEditingTool, getCurrentMaskData, addStackStateToElement, addSeedsTool, clearMeasurements, getToolState, clearToolStateByName, updateDiameterTool, addToolStateSingleSlice, clearCornerstoneElements, syncToolStack, updateStackToolState, setSegmentationConfig, csToolsCreateStack, csToolsUpdateImageIds, csToolsUpdateImageIndex, initializeCSTools, setToolsStyle, addDefaultTools, addTool, setToolActive, setToolDisabled, setToolEnabled, setToolPassive, exportAnnotations, DEFAULT_TOOLS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool, saveAnnotations, loadAnnotations, addMouseKeyHandlers, removeMouseKeyHandlers, initSegmentationModule, addSegmentationMask, setActiveLabelmap, setActiveSegment, undoLastStroke, redoLastStroke, setBrushProps, hexToRgb, rgbToHex, clearSegmentationState, deleteMask, enableBrushTool, disableBrushTool, toggleContourMode, toggleVisibility, getActiveLabelmapBuffer };
export { VERSION, cornerstone, cornerstoneTools, parseDicom, segModule, cornerstoneDICOMImageLoader, checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory, getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor, store, parseECG, renderECG, unrenderECG, syncECGFrame, updateECGFrame, getDefaultECGLayout, getImagePresets, setImagePreset, setImageCustomPreset, getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata, buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage, exportImageToBase64, anonymize, buildLayer, updateLayer, getActiveLayer, setActiveLayer, initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, updateLoadedStack, readFile, readFiles, parseDataSet, clearImageParsing, clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, resetViewports, updateViewportData, toggleMouseToolsListeners, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, resliceSeries, getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB, parseContours, updateLarvitarManager, populateLarvitarManager, getLarvitarManager, getLarvitarImageTracker, resetLarvitarManager, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager, buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions, loadReslicedImage, getDicomImageId, cacheImage, cacheImages, loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache, getFileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId, addDiameterTool, addContoursTool, addMaskEditingTool, getCurrentMaskData, addStackStateToElement, addSeedsTool, clearMeasurements, getToolState, clearToolStateByName, updateDiameterTool, addToolStateSingleSlice, clearCornerstoneElements, syncToolStack, updateStackToolState, setSegmentationConfig, csToolsCreateStack, csToolsUpdateImageIds, csToolsUpdateImageIndex, initializeCSTools, setToolsStyle, addDefaultTools, addTool, setToolActive, setToolDisabled, setToolEnabled, setToolPassive, exportAnnotations, DEFAULT_TOOLS, dvTools, getDefaultToolsByType, setDefaultToolsProps, registerExternalTool, saveAnnotations, loadAnnotations, addMouseKeyHandlers, removeMouseKeyHandlers, initSegmentationModule, addSegmentationMask, setActiveLabelmap, setActiveSegment, undoLastStroke, redoLastStroke, setBrushProps, hexToRgb, rgbToHex, clearSegmentationState, deleteMask, enableBrushTool, disableBrushTool, toggleContourMode, toggleVisibility, getActiveLabelmapBuffer };
77,552 changes: 77,129 additions & 423 deletions dist/larvitar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/larvitar.js.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/documentation/-_anonymous_-Hammer.defaults.cssProps.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/documentation/-_anonymous_-Hammer.defaults.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/AttrRecognizer.defaults.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/PanRecognizer.defaults.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/PinchRecognizer.defaults.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Polyfills.EventTarget.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/PressRecognizer.defaults.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/RotateRecognizer.defaults.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/SwipeRecognizer.defaults.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/Tools.Annotation.AngleTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.ArrowAnnotateTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.BidirectionalTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.CircleRoiTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.CobbAngleTool.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/Tools.Annotation.ContoursTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.DiameterTool.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/Tools.Annotation.EllipticalRoiTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.FreehandRoiTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.LengthTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.ProbeTool.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/Tools.Annotation.RectangleRoiTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.TextMarkerTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Annotation.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/documentation/Tools.Base.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/Tools.Brush.BrushTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Brush.ThresholdsBrushTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Brush.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.CircleScissorsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.CorrectionScissorsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.CrosshairsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.DoubleTapFitToWindowTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.DragProbeTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.EraserTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.FreehandRoiSculptorTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.FreehandScissorsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.MagnifyTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.OrientationMarkersTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.Overlay.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.PanMultiTouchTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.PanTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.PolylineScissorsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.RectangleScissorsTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.RotateTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.RotateTouchTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.ScaleOverlayTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.StackScrollMouseWheelTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.StackScrollMultiTouchTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.StackScrollTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.WwwcRegionTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.WwwcTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.ZoomMouseWheelTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.ZoomTool.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/Tools.ZoomTouchPinchTool.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/index.html

Large diffs are not rendered by default.

77,554 changes: 77,130 additions & 424 deletions docs/documentation/larvitar.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-EnabledElementLayers.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-EnabledElements.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/module-ImageCache.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-ImageLoader.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-Internal.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-Metadata.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-Objects.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-PixelCoordinateSystem.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-Polyfills.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-ViewportSettings.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-WebGLRendering.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-Drawing.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-Manipulators.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-Mixins.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-ThirdParty.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-Tools.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-Util.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-WebGLTextureCache-_.html

Large diffs are not rendered by default.

210 changes: 105 additions & 105 deletions docs/documentation/module-WebGLTextureCache.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/documentation/module-imaging_imageAnonymization.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/documentation/module-imaging_imageColormaps.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/documentation/module-imaging_imageContours.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/documentation/module-imaging_imageIo.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/documentation/module-imaging_imageLayers.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/documentation/module-imaging_imageLoading.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/documentation/module-imaging_imageParsing.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/documentation/module-imaging_imagePresets.html

Large diffs are not rendered by default.

70 changes: 47 additions & 23 deletions docs/documentation/module-imaging_imageRendering.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/module-imaging_imageReslice.html

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions docs/documentation/module-imaging_imageStore.html

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions docs/documentation/module-imaging_imageTools.html

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions docs/documentation/module-imaging_imageUtils.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/module-imaging_parsers_ecg.html

Large diffs are not rendered by default.

729 changes: 729 additions & 0 deletions docs/documentation/module-imaging_parsers_pdf.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-imaging_tools_default.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/documentation/module-imaging_tools_interaction.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-imaging_tools_io.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/documentation/module-imaging_tools_main.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/documentation/module-imaging_tools_segmentation.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/documentation/module-loaders_commonLoader.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/documentation/module-loaders_dicomLoader.html

Large diffs are not rendered by default.

120 changes: 114 additions & 6 deletions docs/documentation/module-loaders_fileLoader.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/documentation/module-loaders_multiframeLoader.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/documentation/module-loaders_nrrdLoader.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/documentation/module-loaders_resliceLoader.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/documentation/module-monitors_memory.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/documentation/module-monitors_performance.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-rendering.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/documentation/module-tools_default.html

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions docs/documentation/module-waveforms_ecg.html

Large diffs are not rendered by default.

140 changes: 139 additions & 1 deletion docs/examples/4d.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,145 @@
<pre class="h-100">
<code class="javascript" style="background-color: #000000">
<p style="font-size:0.6vw;">

let currentMode = "stack";
let demoFiles = [];
let counter = 0;
let animation = false;
let animationId = null;
let frames_number = 0;

const getDemoFileNames = function () {
let demoFileList = [];
for (let i = 1; i < 195; i++) {
let filename = "image_(" + i + ").dcm";
demoFileList.push(filename);
}
return demoFileList;
};

// init all
larvitar.initializeImageLoader();
larvitar.initializeCSTools();
larvitar.store.initialize();
larvitar.store.addViewport("viewer");

// create files from the demo folder
async function createFile(fileName, cb) {
let response = await fetch("./demo/4d/" + fileName);
let data = await response.blob();
let file = new File([data], fileName);
demoFiles.push(file);
counter++;
if (counter == 194) {
cb();
}
}

// handle button to change scroll modality
function triggerHandleToggle() {
let newMode = currentMode === "stack" ? "slice" : "stack";
let newModeTxt = newMode === "stack" ? "Slices" : "Frames";
if (newMode === "stack") {
animation = false;
clearInterval(animationId);
}
larvitar.DEFAULT_TOOLS["CustomMouseWheelScroll"].currentMode = newMode;
larvitar.DEFAULT_TOOLS[
"CustomMouseWheelScroll"
].configuration.currentMode = newMode;
currentMode = newMode;
$("#toggleButton").html("Scroll Mode: " + newModeTxt);
let animationText =
newMode === "stack" ? "" : "Press 'p' to start/stop animation";
$("#animation").html(animationText);
}
// Attach click event to the button
const toggleButton = document.getElementById("toggleButton");
toggleButton.addEventListener("click", triggerHandleToggle);

// Update UI regarding timeId, timestamp and sliceId
function changeStamps() {
$("#image-time").html(
"Image Time Id: " +
larvitar.store.get(["viewports", "viewer", "timeId"]) +
" of " +
larvitar.store.get(["viewports", "viewer", "maxTimeId"])
);
$("#timestamp").html(
"Image Time: " +
larvitar.store.get(["viewports", "viewer", "timestamp"])
);
$("#slicenum").html(
"Slice Number: " +
parseInt(
Math.floor(
larvitar.store.get(["viewports", "viewer", "sliceId"]) /
frames_number
) + 1
) +
" of 2"
);
}

// main render function
function renderSerie() {
larvitar.readFiles(demoFiles).then(seriesStack => {
let seriesId = _.keys(seriesStack)[0];
let serie = seriesStack[seriesId];
larvitar.populateLarvitarManager(seriesId, serie);
let manager = larvitar.getLarvitarManager();
let multiFrameSerie = manager[seriesId];
let frameId = 0;
larvitar
.renderImage(multiFrameSerie, "viewer", frameId)
.then(() => {
frames_number = manager[seriesId].numberOfTemporalPositions;
larvitar.addDefaultTools();
larvitar.setToolActive("CustomMouseWheelScroll");
// add information on UI regarding timeId, timestamp and sliceId
changeStamps();

// add event listener to the wheel to update the UI
document
.getElementById("viewer")
.addEventListener("wheel", function (event) {
changeStamps();
});

// add event listener to the keypress to start/stop the animation
document.onkeypress = function (e) {
if (e.key === "p" && currentMode === "slice") {
animation = !animation;
if (animation) {
let sliceId = larvitar.store.get([
"viewports",
"viewer",
"sliceId"
]);
animationId = setInterval(function () {
const sliceNumber = Math.floor(sliceId / frames_number);
sliceId =
sliceId === (sliceNumber + 1) * frames_number - 1
? sliceId - (frames_number - 1)
: sliceId + 1;

larvitar.updateImage(serie, "viewer", sliceId, false);
changeStamps();
}, 100);
} else {
clearInterval(animationId);
}
}
};
})
.catch(err => console.error(err));
});
}

let demoFileList = getDemoFileNames();
_.each(demoFileList, function (demoFile) {
createFile(demoFile, renderSerie);
});
</p>
</code>
</pre>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/defaultTools.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
tool_counter == tools.length - 1 ? 0 : tool_counter + increment;
tool_counter = tool_counter < 0 ? 0 : tool_counter;
let tool = tools[tool_counter];
larvitar.setToolActive(tool);
larvitar.setToolActive(tool, { mouseButtonMask: 1 });
$("#active-tool").html("Active Tool: " + tool);
}
};
Expand Down
Loading

0 comments on commit bc4b826

Please sign in to comment.