cornerstonetools-thresholdbrush
Advanced tools
Comparing version 1.0.18 to 1.0.19
@@ -13,7 +13,7 @@ /* | ||
else if(typeof define === 'function' && define.amd) | ||
define("SyncBrushTool", ["cornerstone", "cornerstoneTools"], factory); | ||
define("ThresholdBrush", ["cornerstone", "cornerstoneTools"], factory); | ||
else if(typeof exports === 'object') | ||
exports["SyncBrushTool"] = factory(require("cornerstone"), require("cornerstoneTools")); | ||
exports["ThresholdBrush"] = factory(require("cornerstone"), require("cornerstoneTools")); | ||
else | ||
root["SyncBrushTool"] = factory(root["cornerstone"], root["cornerstoneTools"]); | ||
root["ThresholdBrush"] = factory(root["cornerstone"], root["cornerstoneTools"]); | ||
})(self, (__WEBPACK_EXTERNAL_MODULE_cornerstone_core__, __WEBPACK_EXTERNAL_MODULE_cornerstone_tools__) => { | ||
@@ -30,3 +30,3 @@ return /******/ (() => { // webpackBootstrap | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThresholdBrushTool)\n/* harmony export */ });\n/* harmony import */ var cornerstone_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! cornerstone-core */ \"cornerstone-core\");\n/* harmony import */ var cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cornerstone_core__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var cornerstone_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! cornerstone-tools */ \"cornerstone-tools\");\n/* harmony import */ var cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cornerstone_tools__WEBPACK_IMPORTED_MODULE_1__);\n// This tool extends the default brush tool to allow for a threshold value to be set using hounsfield units with a low and high values. The threshold decides if the brush should paint the pixel or not.\r\n\r\n\r\n\r\n\r\nconst { drawBrushPixels, getCircle } = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default()[\"import\"](\r\n \"util/segmentationUtils\"\r\n);\r\n\r\nconst segmentationModule = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default().getModule(\"segmentation\");\r\nconst BaseBrushTool = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default()[\"import\"](\"base/BaseBrushTool\");\r\n\r\n/**\r\n * @public\r\n * @class ThresholdBrushTool\r\n * @memberof Tools.Brush\r\n * @classdesc Tool for drawing segmentations on an image.\r\n * @extends Tools.Base.BaseBrushTool\r\n */\r\n\r\n\r\n class ThresholdBrushTool extends BaseBrushTool {\r\n constructor(props = {}) {\r\n const defaultProps = {\r\n name: \"ThresholdBrush\",\r\n supportedInteractionTypes: [\"Mouse\"],\r\n configuration: {\r\n thresholdLow: 200,\r\n thresholdHigh: 1000,\r\n },\r\n mixins: [\"renderBrushMixin\"],\r\n };\r\n\r\n super(props, defaultProps);\r\n }\r\n\r\n /**\r\n * Paints the data to the labelmap if the mouse is down and the pixel is in the threshold low and high values range.\r\n * @protected\r\n * @param {Object}\r\n * @returns {void}\r\n */\r\n _paint(evt) {\r\n const { configuration } = segmentationModule;\r\n const toolConfiguration = this.configuration;\r\n const eventData = evt.detail;\r\n const element = eventData.element;\r\n const { rows, columns } = eventData.image;\r\n const { x, y } = eventData.currentPoints.image;\r\n\r\n if (x < 0 || x > columns || y < 0 || y > rows) {\r\n return;\r\n }\r\n // check if the pixel is in the threshold range\r\n const radius = configuration.radius;\r\n const pointerArray = getCircle(radius, rows, columns, x, y);\r\n // loop over the pixels in the circle and eliminate any that are outside the threshold range\r\n const thresholdedPointerArray = pointerArray.filter((pointer) => {\r\n const storedPixel = cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default().getStoredPixels(\r\n element,\r\n pointer[0],\r\n pointer[1],\r\n 1,\r\n 1\r\n );\r\n const hounsfieldValue =\r\n storedPixel[0] * eventData.image.slope + eventData.image.intercept;\r\n return (\r\n hounsfieldValue >= toolConfiguration.thresholdLow &&\r\n hounsfieldValue <= toolConfiguration.thresholdHigh\r\n );\r\n });\r\n\r\n const { labelmap2D, labelmap3D, shouldErase } = this.paintEventData;\r\n\r\n // Draw / Erase the active color.\r\n drawBrushPixels(\r\n thresholdedPointerArray,\r\n labelmap2D.pixelData,\r\n labelmap3D.activeSegmentIndex,\r\n columns,\r\n shouldErase\r\n );\r\n cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default().updateImage(evt.detail.element);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://SyncBrushTool/./src/ThresholdBrushTool.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ ThresholdBrushTool)\n/* harmony export */ });\n/* harmony import */ var cornerstone_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! cornerstone-core */ \"cornerstone-core\");\n/* harmony import */ var cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(cornerstone_core__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var cornerstone_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! cornerstone-tools */ \"cornerstone-tools\");\n/* harmony import */ var cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cornerstone_tools__WEBPACK_IMPORTED_MODULE_1__);\n// This tool extends the default brush tool to allow for a threshold value to be set using hounsfield units with a low and high values. The threshold decides if the brush should paint the pixel or not.\r\n\r\n\r\n\r\n\r\nconst { drawBrushPixels, getCircle } = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default()[\"import\"](\r\n \"util/segmentationUtils\"\r\n);\r\n\r\nconst segmentationModule = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default().getModule(\"segmentation\");\r\nconst BaseBrushTool = cornerstone_tools__WEBPACK_IMPORTED_MODULE_1___default()[\"import\"](\"base/BaseBrushTool\");\r\n\r\n/**\r\n * @public\r\n * @class ThresholdBrushTool\r\n * @memberof Tools.Brush\r\n * @classdesc Tool for drawing segmentations on an image.\r\n * @extends Tools.Base.BaseBrushTool\r\n */\r\n\r\n\r\n class ThresholdBrushTool extends BaseBrushTool {\r\n constructor(props = {}) {\r\n const defaultProps = {\r\n name: \"ThresholdBrush\",\r\n supportedInteractionTypes: [\"Mouse\"],\r\n configuration: {\r\n thresholdLow: 200,\r\n thresholdHigh: 1000,\r\n },\r\n mixins: [\"renderBrushMixin\"],\r\n };\r\n\r\n super(props, defaultProps);\r\n }\r\n\r\n /**\r\n * Paints the data to the labelmap if the mouse is down and the pixel is in the threshold low and high values range.\r\n * @protected\r\n * @param {Object}\r\n * @returns {void}\r\n */\r\n _paint(evt) {\r\n const { configuration } = segmentationModule;\r\n const toolConfiguration = this.configuration;\r\n const eventData = evt.detail;\r\n const element = eventData.element;\r\n const { rows, columns } = eventData.image;\r\n const { x, y } = eventData.currentPoints.image;\r\n\r\n if (x < 0 || x > columns || y < 0 || y > rows) {\r\n return;\r\n }\r\n // check if the pixel is in the threshold range\r\n const radius = configuration.radius;\r\n const pointerArray = getCircle(radius, rows, columns, x, y);\r\n // loop over the pixels in the circle and eliminate any that are outside the threshold range\r\n const thresholdedPointerArray = pointerArray.filter((pointer) => {\r\n const storedPixel = cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default().getStoredPixels(\r\n element,\r\n pointer[0],\r\n pointer[1],\r\n 1,\r\n 1\r\n );\r\n const hounsfieldValue =\r\n storedPixel[0] * eventData.image.slope + eventData.image.intercept;\r\n return (\r\n hounsfieldValue >= toolConfiguration.thresholdLow &&\r\n hounsfieldValue <= toolConfiguration.thresholdHigh\r\n );\r\n });\r\n\r\n const { labelmap2D, labelmap3D, shouldErase } = this.paintEventData;\r\n\r\n // Draw / Erase the active color.\r\n drawBrushPixels(\r\n thresholdedPointerArray,\r\n labelmap2D.pixelData,\r\n labelmap3D.activeSegmentIndex,\r\n columns,\r\n shouldErase\r\n );\r\n cornerstone_core__WEBPACK_IMPORTED_MODULE_0___default().updateImage(evt.detail.element);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://ThresholdBrush/./src/ThresholdBrushTool.js?"); | ||
@@ -41,3 +41,3 @@ /***/ }), | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ThresholdBrushTool__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThresholdBrushTool */ \"./src/ThresholdBrushTool.js\");\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ThresholdBrushTool__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://SyncBrushTool/./src/index.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _ThresholdBrushTool__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThresholdBrushTool */ \"./src/ThresholdBrushTool.js\");\n\r\n\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_ThresholdBrushTool__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n//# sourceURL=webpack://ThresholdBrush/./src/index.js?"); | ||
@@ -44,0 +44,0 @@ /***/ }), |
{ | ||
"name": "cornerstonetools-thresholdbrush", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "A brush tool that allows you to set a low and high threshold range in HU units while drawing segmentations.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,3 +7,3 @@ # cornerstonetools-thresholdbrush | ||
Notice how it only draws on the bone which is in a threshold range of 200 to 100. and If I attempt to draw on other pixels outside of that range, nothing gets drawn. | ||
Notice how it only draws on the bone which is in a threshold range of 200 to 1000. and If I attempt to draw on other pixels outside of that range, nothing gets drawn. | ||
@@ -18,4 +18,6 @@ | ||
[LIVE DEMONSTRATION](https://google.com) | ||
Below is a live demo of the threshold brush tool, in the demo the threshold range is set to [200, 1000] | ||
[LIVE DEMONSTRATION](https://ibrahimcsae.github.io/cornerstonetools-thresholdbrush/) | ||
## Installation | ||
@@ -46,6 +48,14 @@ | ||
``` | ||
## Common thresholds to get you started | ||
Left Psoas : [-29, 150] | ||
Right Psoas : [-29, 150] | ||
Muscle : [-29, 150] | ||
Sub Fat : [-190, -30] | ||
Vis Fat : [-190, -30] | ||
Bone : [200, 1000] | ||
## LICENSE | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
13805
4
59