Skip to content

Commit

Permalink
fixes tools Roi and Length + default (#332)
Browse files Browse the repository at this point in the history
* fixes tools Roi and Length + default

* Update docs

* removed ../../dist/

* Update docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 2a92943 commit 25d47ff
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 18 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.4.12
### Current version: 2.4.13

### Latest Published Release: 2.4.12
### Latest Published Release: 2.4.13

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
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.4.12">Current version: 2.4.12</h3>
<h3 id="latest-published-release%3A-2.4.12">Latest Published Release: 2.4.12</h3>
<h3 id="current-version%3A-2.4.13">Current version: 2.4.13</h3>
<h3 id="latest-published-release%3A-2.4.13">Latest Published Release: 2.4.13</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
3 changes: 2 additions & 1 deletion docs/examples/defaultTools.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
"PanMultiTouch",
"OrientationMarkers",
"ScaleOverlay",
"ManualLengthPlot"
"ManualLengthPlot",
"WSToggle"
);
// remove not working tools for the live example
// see open issue
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/larvitar.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions imaging/tools/custom/EllipticalRoiUSTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default class EllipticalRoiTool extends BaseAnnotationTool {
) {
const pixelSpacing: PixelSpacing = getPixelSpacing(image);
if (
pixelSpacing.rowPixelSpacing ||
pixelSpacing.rowPixelSpacing === undefined ||
pixelSpacing.colPixelSpacing === undefined
) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
Expand Down Expand Up @@ -258,7 +258,7 @@ export default class EllipticalRoiTool extends BaseAnnotationTool {
colPixelSpacing = image.columnPixelSpacing;
rowPixelSpacing = image.rowPixelSpacing;
}
if (rowPixelSpacing || colPixelSpacing === undefined) {
if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
eventData.image.imageId
);
Expand Down
4 changes: 2 additions & 2 deletions imaging/tools/custom/FreehandRoiUSTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export default class FreehandRoiTool extends BaseAnnotationTool {
colPixelSpacing = image.columnPixelSpacing;
rowPixelSpacing = image.rowPixelSpacing;
}
if (rowPixelSpacing || colPixelSpacing === undefined) {
if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
image.imageId
);
Expand Down Expand Up @@ -566,7 +566,7 @@ export default class FreehandRoiTool extends BaseAnnotationTool {
colPixelSpacing = image.columnPixelSpacing;
rowPixelSpacing = image.rowPixelSpacing;
}
if (rowPixelSpacing || colPixelSpacing === undefined) {
if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
eventData.image.imageId
);
Expand Down
19 changes: 17 additions & 2 deletions imaging/tools/custom/LengthUSTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,22 @@ export default class LengthTool extends BaseAnnotationTool {
colPixelSpacing = image.columnPixelSpacing;
rowPixelSpacing = image.rowPixelSpacing;
}

if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
image.imageId
);
let rootImageId = parsedImageId.scheme + ":" + parsedImageId.url;
let imageTracker = getLarvitarImageTracker();
let seriesId = imageTracker[rootImageId];
let manager = getLarvitarManager() as LarvitarManager;
if (manager && seriesId) {
let series = manager[seriesId] as Series;
rowPixelSpacing =
series.instances[image.imageId].metadata.pixelSpacing![0];
colPixelSpacing =
series.instances[image.imageId].metadata.pixelSpacing![1];
}
}
// Set rowPixelSpacing and columnPixelSpacing to 1 if they are undefined (or zero)
const dx =
(data.handles.end!.x - data.handles.start!.x) * (colPixelSpacing || 1);
Expand Down Expand Up @@ -198,7 +213,7 @@ export default class LengthTool extends BaseAnnotationTool {
rowPixelSpacing = image.rowPixelSpacing;
}

if (rowPixelSpacing || colPixelSpacing === undefined) {
if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
eventData.image.imageId
);
Expand Down
9 changes: 6 additions & 3 deletions imaging/tools/custom/RectangleRoiUSTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ export default class RectangleRoiTool extends BaseAnnotationTool {
) {
const pixelSpacing: { colPixelSpacing: number; rowPixelSpacing: number } =
getPixelSpacing(image);

if (
pixelSpacing.rowPixelSpacing ||
pixelSpacing.rowPixelSpacing === undefined ||
pixelSpacing.colPixelSpacing === undefined
) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
Expand Down Expand Up @@ -227,12 +228,14 @@ export default class RectangleRoiTool extends BaseAnnotationTool {
const context: CanvasRenderingContext2D = getNewContext(
eventData.canvasContext.canvas
);
let { rowPixelSpacing, colPixelSpacing }: PixelSpacing = getPixelSpacing;
let { rowPixelSpacing, colPixelSpacing }: PixelSpacing =
getPixelSpacing(image);
if (this.modality === "US") {
colPixelSpacing = image.columnPixelSpacing;
rowPixelSpacing = image.rowPixelSpacing;
}
if (rowPixelSpacing || colPixelSpacing === undefined) {

if (rowPixelSpacing === undefined || colPixelSpacing === undefined) {
let parsedImageId = cornerstoneDICOMImageLoader.wadouri.parseImageId(
eventData.image.imageId
);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"medical",
"cornerstone"
],
"version": "2.4.12",
"version": "2.4.13",
"description": "typescript library for parsing, loading, rendering and interacting with DICOM images",
"repository": {
"url": "https://github.com/dvisionlab/Larvitar.git",
Expand Down

0 comments on commit 25d47ff

Please sign in to comment.