Skip to content

Commit

Permalink
Merge branch 'v0.30.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Jan 4, 2022
2 parents 74bddfc + 6e75412 commit c34521d
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 45 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [v0.30.8](https://github.com/ivmartel/dwv/releases/tag/v0.30.8) - 03/01/2022

### Fixed

- Load state shape does not show on correct slice [#1078](https://github.com/ivmartel/dwv/issues/1078)
- TypeError: point.get is not a function when loading state [#1077](https://github.com/ivmartel/dwv/issues/1077)
- Uncaught TypeError: t.getX is not a function when saving state [#1072](https://github.com/ivmartel/dwv/issues/1072)

---

## [v0.30.7](https://github.com/ivmartel/dwv/releases/tag/v0.30.7) - 28/12/2021

### Fixed
Expand Down
24 changes: 14 additions & 10 deletions dist/dwv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! dwv 0.30.7 2021-12-30 11:37:54 */
/*! dwv 0.30.8 2022-01-04 12:43:27 */
// Inspired from umdjs
// See https://github.com/umdjs/umd/blob/master/templates/returnExports.js
(function (root, factory) {
Expand Down Expand Up @@ -718,7 +718,8 @@ dwv.App = function () {
drawings, drawingsDetails, fireEvent, this.addToUndoStack);

drawController.activateDrawLayer(
viewController.getCurrentOrientedPosition());
viewController.getCurrentOrientedIndex(),
viewController.getScrollIndex());
};
/**
* Update a drawing from its details.
Expand Down Expand Up @@ -2680,12 +2681,17 @@ dwv.ctrl.ViewController = function (view) {
*
* @returns {dwv.math.Point} The position.
*/
this.getCurrentOrientedPosition = function () {
var res = view.getCurrentPosition();
this.getCurrentOrientedIndex = function () {
var res = view.getCurrentIndex();
// values = orientation * orientedValues
// -> inv(orientation) * values = orientedValues
if (typeof view.getOrientation() !== 'undefined') {
res = view.getOrientation().getInverse().getAbs().multiplyVector3D(res);
var index3D = new dwv.math.Index(
[res.get(0), res.get(1), res.get(2)]);
var orientedIndex3D =
view.getOrientation().getInverse().getAbs().multiplyIndex3D(index3D);
var values = orientedIndex3D.getValues();
res = new dwv.math.Index(values);
}
return res;
};
Expand Down Expand Up @@ -4444,7 +4450,7 @@ dwv.dicom = dwv.dicom || {};
* @returns {string} The version of the library.
*/
dwv.getVersion = function () {
return '0.30.7';
return '0.30.8';
};

/**
Expand Down Expand Up @@ -21033,7 +21039,7 @@ dwv.io.State = function () {
version: '0.5',
'window-center': viewController.getWindowLevel().center,
'window-width': viewController.getWindowLevel().width,
position: [position.getX(), position.getY(), position.getZ()],
position: position.getValues(),
scale: app.getAddedScale(),
offset: app.getOffset(),
drawings: drawLayer.getKonvaLayer().toObject(),
Expand Down Expand Up @@ -21078,9 +21084,7 @@ dwv.io.State = function () {
// display
viewController.setWindowLevel(
data['window-center'], data['window-width']);
viewController.setCurrentPosition(
new dwv.math.Point3D(
data.position[0], data.position[1], data.position[2]), true);
viewController.setCurrentPosition(new dwv.math.Point(data.position));
// apply saved scale on top of current base one
var baseScale = app.getActiveLayerGroup().getBaseScale();
var scale = null;
Expand Down
4 changes: 2 additions & 2 deletions dist/dwv.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dwv",
"version": "0.30.7",
"version": "0.30.8",
"description": "DICOM Web Viewer.",
"keywords": [
"DICOM",
Expand Down
3 changes: 2 additions & 1 deletion src/app/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ dwv.App = function () {
drawings, drawingsDetails, fireEvent, this.addToUndoStack);

drawController.activateDrawLayer(
viewController.getCurrentOrientedPosition());
viewController.getCurrentOrientedIndex(),
viewController.getScrollIndex());
};
/**
* Update a drawing from its details.
Expand Down
11 changes: 8 additions & 3 deletions src/app/viewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@ dwv.ctrl.ViewController = function (view) {
*
* @returns {dwv.math.Point} The position.
*/
this.getCurrentOrientedPosition = function () {
var res = view.getCurrentPosition();
this.getCurrentOrientedIndex = function () {
var res = view.getCurrentIndex();
// values = orientation * orientedValues
// -> inv(orientation) * values = orientedValues
if (typeof view.getOrientation() !== 'undefined') {
res = view.getOrientation().getInverse().getAbs().multiplyVector3D(res);
var index3D = new dwv.math.Index(
[res.get(0), res.get(1), res.get(2)]);
var orientedIndex3D =
view.getOrientation().getInverse().getAbs().multiplyIndex3D(index3D);
var values = orientedIndex3D.getValues();
res = new dwv.math.Index(values);
}
return res;
};
Expand Down
2 changes: 1 addition & 1 deletion src/dicom/dicomParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dwv.dicom = dwv.dicom || {};
* @returns {string} The version of the library.
*/
dwv.getVersion = function () {
return '0.30.7';
return '0.30.8';
};

/**
Expand Down
6 changes: 2 additions & 4 deletions src/io/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dwv.io.State = function () {
version: '0.5',
'window-center': viewController.getWindowLevel().center,
'window-width': viewController.getWindowLevel().width,
position: [position.getX(), position.getY(), position.getZ()],
position: position.getValues(),
scale: app.getAddedScale(),
offset: app.getOffset(),
drawings: drawLayer.getKonvaLayer().toObject(),
Expand Down Expand Up @@ -94,9 +94,7 @@ dwv.io.State = function () {
// display
viewController.setWindowLevel(
data['window-center'], data['window-width']);
viewController.setCurrentPosition(
new dwv.math.Point3D(
data.position[0], data.position[1], data.position[2]), true);
viewController.setCurrentPosition(new dwv.math.Point(data.position));
// apply saved scale on top of current base one
var baseScale = app.getActiveLayerGroup().getBaseScale();
var scale = null;
Expand Down
12 changes: 2 additions & 10 deletions tests/state/state.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ dwv.test.checkDrawings = function (drawings, details, version, type, assert) {
layerKid.attrs.name,
'position-group',
'Layer first level is a position group.');
var groupId = '#2-114.63';
if (version <= 0.4) {
groupId = '#2-0';
}
var groupId = '#2-0';
assert.equal(
layerKid.attrs.id,
groupId,
Expand Down Expand Up @@ -417,8 +414,6 @@ dwv.test.checkRulerDrawings = function (layerKids, details, version, assert) {
}
];

var groupIds = [116.87, 125.85, 134.84, 143.82, 152.81];

for (var i = 0; i < ndraws; ++i) {
var layerKid = layerKids[i];
assert.equal(
Expand All @@ -429,10 +424,7 @@ dwv.test.checkRulerDrawings = function (layerKids, details, version, assert) {
layerKid.attrs.name,
'position-group',
'Layer first level is a position group.');
var groupId = '#2-' + groupIds[i];
if (version <= 0.4) {
groupId = '#2-' + (i + 1);
}
var groupId = '#2-' + (i + 1);
assert.equal(
layerKid.attrs.id,
groupId,
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-arrow.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"children": [
{
"attrs": {
"id": "#2-114.63",
"id": "#2-0",
"name": "position-group"
},
"className": "Group",
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-arrow_zoom.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"children": [
{
"attrs": {
"id": "#2-114.63",
"id": "#2-0",
"name": "position-group"
},
"className": "Group",
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-ellipse.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-114.63"
"id": "#2-0"
},
"className": "Group",
"children": [
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-hand.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-114.63"
"id": "#2-0"
},
"className": "Group",
"children": [
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-protractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"children": [
{
"attrs": {
"id": "#2-114.63",
"id": "#2-0",
"name": "position-group"
},
"className": "Group",
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-rectangle.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-114.63"
"id": "#2-0"
},
"className": "Group",
"children": [
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-roi.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-114.63"
"id": "#2-0"
},
"className": "Group",
"children": [
Expand Down
2 changes: 1 addition & 1 deletion tests/state/v0.5/state-ruler.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"children": [
{
"attrs": {
"id": "#2-114.63",
"id": "#2-0",
"name": "position-group"
},
"className": "Group",
Expand Down
10 changes: 5 additions & 5 deletions tests/state/v0.5/state-ruler_multi-slice.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-116.87",
"id": "#2-1",
"visible": false
},
"className": "Group",
Expand Down Expand Up @@ -118,7 +118,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-125.85",
"id": "#2-2",
"visible": false
},
"className": "Group",
Expand Down Expand Up @@ -214,7 +214,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-134.84",
"id": "#2-3",
"visible": false
},
"className": "Group",
Expand Down Expand Up @@ -310,7 +310,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-143.82",
"id": "#2-4",
"visible": false
},
"className": "Group",
Expand Down Expand Up @@ -406,7 +406,7 @@
{
"attrs": {
"name": "position-group",
"id": "#2-152.81"
"id": "#2-5"
},
"className": "Group",
"children": [
Expand Down

0 comments on commit c34521d

Please sign in to comment.