Skip to content

Commit

Permalink
add reset function (#403)
Browse files Browse the repository at this point in the history
* add reset function

* description

* Update docs

* remove duplicate function

* Update docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent bcb760a commit 5068a7f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 13 deletions.
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.7.0
### Current version: 2.7.1

### Latest Published Release: 2.7.0
### Latest Published Release: 2.7.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
7 changes: 7 additions & 0 deletions dist/imaging/imageLoading.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ export declare const registerDsaImageLoader: () => void;
* @param {number} sliceIndex - Optional custom index to overwrite slice index as default one
*/
export declare const updateLoadedStack: (seriesData: ImageObject, allSeriesStack: ReturnType<typeof getLarvitarManager>, customId?: string, sliceIndex?: number) => void;
/**
* General reset of cache, loaders, store and managers
* @inner
* @function reset
* @return {void}
*/
export declare function reset(): void;
4 changes: 2 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDI
import { anonymize } from "./imaging/imageAnonymization";
import { customizeByteArray } from "./imaging/imageCustomization";
import { buildLayer, updateLayer, getActiveLayer, setActiveLayer } from "./imaging/imageLayers";
import { initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, registerDsaImageLoader, updateLoadedStack } from "./imaging/imageLoading";
import { initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, registerDsaImageLoader, updateLoadedStack, reset } from "./imaging/imageLoading";
import { readFile, readFiles, parseDataSet, clearImageParsing } from "./imaging/imageParsing";
import { clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, redrawImage, resetViewports, updateViewportData, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, updateTemporalViewportData } from "./imaging/imageRendering";
import { resliceSeries } from "./imaging/imageReslice";
Expand All @@ -37,4 +37,4 @@ import { getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB }
import { applyDSAShift } from "./imaging/postProcessing/applyDSA";
import { saveAnnotations, loadAnnotations } from "./imaging/tools/io";
import { addMouseKeyHandlers, removeMouseKeyHandlers, toggleMouseToolsListeners } from "./imaging/tools/interaction";
export { VERSION, cornerstone, cornerstoneTools, parseDicom, cornerstoneFileImageLoader, segModule, cornerstoneDICOMImageLoader, checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory, getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor, store, parseECG, renderECG, unrenderECG, syncECGFrame, updateECGMarker, updateECGTotalTime, getDefaultECGLayout, getImagePresets, setImagePreset, setImageCustomPreset, getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata, buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage, exportImageToBase64, exportImageToBase64OriginalSizes, anonymize, customizeByteArray, buildLayer, updateLayer, getActiveLayer, setActiveLayer, initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, registerDsaImageLoader, updateLoadedStack, readFile, readFiles, parseDataSet, clearImageParsing, clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, redrawImage, resetViewports, updateViewportData, toggleMouseToolsListeners, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, resliceSeries, getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB, parseContours, updateLarvitarManager, populateLarvitarManager, populateInstanceGSPSDict, getLarvitarManager, getInstanceGSPSDict, getLarvitarImageTracker, resetLarvitarManager, resetInstanceGSPSDict, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager, buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions, loadReslicedImage, getDicomImageId, cacheImage, cacheImages, loadAndCacheImageStack, loadAndCacheDsaImageStack, loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache, populateDsaImageIds, getFileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId, applyDSAShift, 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, updateTemporalViewportData };
export { VERSION, cornerstone, cornerstoneTools, parseDicom, cornerstoneFileImageLoader, segModule, cornerstoneDICOMImageLoader, checkAndClearMemory, checkMemoryAllocation, getUsedMemory, getAvailableMemory, getPerformanceMonitor, activatePerformanceMonitor, deactivatePerformanceMonitor, store, parseECG, renderECG, unrenderECG, syncECGFrame, updateECGMarker, updateECGTotalTime, getDefaultECGLayout, getImagePresets, setImagePreset, setImageCustomPreset, getNormalOrientation, getMinPixelValue, getMaxPixelValue, getPixelRepresentation, getTypedArrayFromDataType, getSortedStack, randomId, getMeanValue, getReslicedMetadata, getReslicedPixeldata, getDistanceBetweenSlices, getImageMetadata, buildHeader, getCachedPixelData, buildData, buildDataAsync, importNRRDImage, exportImageToBase64, exportImageToBase64OriginalSizes, anonymize, customizeByteArray, buildLayer, updateLayer, getActiveLayer, setActiveLayer, initializeImageLoader, initializeWebImageLoader, initializeFileImageLoader, registerNRRDImageLoader, registerResliceLoader, registerMultiFrameImageLoader, registerDsaImageLoader, updateLoadedStack, reset, readFile, readFiles, parseDataSet, clearImageParsing, clearImageCache, loadAndCacheImages, renderFileImage, renderDICOMPDF, renderWebImage, disableViewport, unloadViewport, resizeViewport, renderImage, updateImage, redrawImage, resetViewports, updateViewportData, toggleMouseToolsListeners, storeViewportData, invertImage, flipImageHorizontal, flipImageVertical, rotateImageLeft, rotateImageRight, resliceSeries, getColormapsList, applyColorMap, addColorMap, fillPixelData, HSVToRGB, parseContours, updateLarvitarManager, populateLarvitarManager, populateInstanceGSPSDict, getLarvitarManager, getInstanceGSPSDict, getLarvitarImageTracker, resetLarvitarManager, resetInstanceGSPSDict, removeSeriesFromLarvitarManager, getSeriesDataFromLarvitarManager, getImageFrame, getSopInstanceUIDFromLarvitarManager, buildNrrdImage, getNrrdImageId, loadNrrdImage, getImageIdFromSlice, getSliceNumberFromImageId, getNrrdSerieDimensions, loadReslicedImage, getDicomImageId, cacheImage, cacheImages, loadAndCacheImageStack, loadAndCacheDsaImageStack, loadMultiFrameImage, buildMultiFrameImage, getMultiFrameImageId, clearMultiFrameCache, populateDsaImageIds, getFileManager, resetFileLoader, resetFileManager, populateFileManager, getFileImageId, applyDSAShift, 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, updateTemporalViewportData };
2 changes: 1 addition & 1 deletion 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.

4 changes: 2 additions & 2 deletions docs/documentation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ <h3> </h3>
<h1 id="larvitar">Larvitar</h1>
<p><a href="https://github.com/dvisionlab/Larvitar"><img src="https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&amp;prefix=%E2%89%A5&amp;suffix=%25&amp;query=$.typeCoverage.atLeast&amp;uri=https%3A%2F%2Fraw.githubusercontent.com%2Fplantain-00%2Ftype-coverage%2Fmaster%2Fpackage.json" alt="type-coverage"></a></p>
<h2 id="dicom-image-toolkit-for-cornerstonejs">Dicom Image Toolkit for CornerstoneJS</h2>
<h3 id="current-version%3A-2.7.0">Current version: 2.7.0</h3>
<h3 id="latest-published-release%3A-2.7.0">Latest Published Release: 2.7.0</h3>
<h3 id="current-version%3A-2.7.1">Current version: 2.7.1</h3>
<h3 id="latest-published-release%3A-2.7.1">Latest Published Release: 2.7.1</h3>
<p>This library provides common DICOM functionalities to be used in web-applications: it's wrapper that simplifies the use of cornerstone-js environment.</p>
<h2 id="features%3A">Features:</h2>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/larvitar.js

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion imaging/imageLoading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ import { loadDsaImage } from "./loaders/dsaImageLoader";
import { ImageObject, Instance, Series, StagedProtocol } from "./types";
import {
getLarvitarImageTracker,
getLarvitarManager
getLarvitarManager,
resetInstanceGSPSDict,
resetLarvitarManager
} from "./loaders/commonLoader";
import { resetFileLoader, resetFileManager } from "./loaders/fileLoader";
import { clearImageCache } from "./imageRendering";
import { clearCornerstoneElements } from "./imageTools";

/**
* Global standard configuration
Expand Down Expand Up @@ -319,3 +324,21 @@ let isNewInstance = function (
});
return isNewInstance;
};

/**
* General reset of cache, loaders, store and managers
* @inner
* @function reset
* @return {void}
*/
export function reset() {
//Reset file manager,larvitar manager, multiframe cache and gsps dict
resetFileManager();
resetLarvitarManager();
resetInstanceGSPSDict();
//Reset cornerstone cache and enabled elements
clearImageCache();
clearCornerstoneElements();
//Reset and initialize store
store.initialize();
}
5 changes: 4 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ import {
registerResliceLoader,
registerMultiFrameImageLoader,
registerDsaImageLoader,
updateLoadedStack
updateLoadedStack,
reset
} from "./imaging/imageLoading";

import {
Expand Down Expand Up @@ -330,6 +331,8 @@ export {
registerMultiFrameImageLoader,
registerDsaImageLoader,
updateLoadedStack,
// General reset of cache, store and managers
reset,
// imageParsing
readFile,
readFiles,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"medical",
"cornerstone"
],
"version": "2.7.0",
"version": "2.7.1",
"description": "typescript library for parsing, loading, rendering and interacting with DICOM images",
"repository": {
"url": "https://github.com/dvisionlab/Larvitar.git",
Expand Down Expand Up @@ -82,4 +82,4 @@
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.13.1"
}
}
}

0 comments on commit 5068a7f

Please sign in to comment.