dwv 0.31.0-beta.1 → 0.31.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dwv.js +168 -110
- package/dist/dwv.min.js +2 -2
- package/package.json +3 -3
- package/readme.md +9 -21
package/dist/dwv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! dwv 0.31.0-beta.
|
|
1
|
+
/*! dwv 0.31.0-beta.2 2022-03-22 15:40:31 */
|
|
2
2
|
// Inspired from umdjs
|
|
3
3
|
// See https://github.com/umdjs/umd/blob/master/templates/returnExports.js
|
|
4
4
|
(function (root, factory) {
|
|
@@ -1226,18 +1226,19 @@ dwv.App = function () {
|
|
|
1226
1226
|
/**
|
|
1227
1227
|
* Get the data max size for a layer group.
|
|
1228
1228
|
*
|
|
1229
|
-
* @
|
|
1230
|
-
* @param {object} lg The layer group.
|
|
1229
|
+
* @param {object} layerGroup The layer group.
|
|
1231
1230
|
* @returns {object} The max size as {x,y}.
|
|
1232
1231
|
*/
|
|
1233
|
-
function getLayerGroupMaxSize(
|
|
1232
|
+
function getLayerGroupMaxSize(layerGroup) {
|
|
1234
1233
|
var maxSize = {x: 0, y: 0};
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1234
|
+
// loop through layer group data
|
|
1235
|
+
var indices = layerGroup.getViewDataIndices();
|
|
1236
|
+
for (var i = 0; i < indices.length; ++i) {
|
|
1237
|
+
var data = dataController.get(indices[i]);
|
|
1238
|
+
var geometry = data.image.getGeometry();
|
|
1238
1239
|
var viewOrient = dwv.gui.getViewOrientation(
|
|
1239
1240
|
geometry,
|
|
1240
|
-
|
|
1241
|
+
layerGroup.getTargetOrientation()
|
|
1241
1242
|
);
|
|
1242
1243
|
var size = geometry.getSize(viewOrient).get2D();
|
|
1243
1244
|
var spacing = geometry.getSpacing(viewOrient).get2D();
|
|
@@ -1307,6 +1308,7 @@ dwv.App = function () {
|
|
|
1307
1308
|
// opacity
|
|
1308
1309
|
var opacity = 1;
|
|
1309
1310
|
// do we have more than one layer
|
|
1311
|
+
// (the layer has not been added to the layer group yet)
|
|
1310
1312
|
if (layerGroup.getNumberOfLayers() !== 0) {
|
|
1311
1313
|
opacity = 0.5;
|
|
1312
1314
|
// set color map if non was provided
|
|
@@ -1325,9 +1327,10 @@ dwv.App = function () {
|
|
|
1325
1327
|
|
|
1326
1328
|
// compensate origin difference
|
|
1327
1329
|
var diff = null;
|
|
1328
|
-
if (
|
|
1330
|
+
if (layerGroup.getNumberOfLayers() !== 1) {
|
|
1331
|
+
var firstDataIndex = layerGroup.getViewDataIndices()[0];
|
|
1332
|
+
var data0 = dataController.get(firstDataIndex);
|
|
1329
1333
|
// offset from the top, use first origin
|
|
1330
|
-
var data0 = dataController.get(0);
|
|
1331
1334
|
var origin0 = data0.image.getGeometry().getOrigins()[0];
|
|
1332
1335
|
var origin1 = imageGeometry.getOrigins()[0];
|
|
1333
1336
|
diff = origin0.minus(origin1);
|
|
@@ -1356,8 +1359,8 @@ dwv.App = function () {
|
|
|
1356
1359
|
];
|
|
1357
1360
|
layerGroup.updateLayersToPositionChange({value: value});
|
|
1358
1361
|
|
|
1359
|
-
// compensate origin difference
|
|
1360
|
-
if (
|
|
1362
|
+
// compensate origin difference if needed
|
|
1363
|
+
if (diff) {
|
|
1361
1364
|
dl.setBaseOffset(diff);
|
|
1362
1365
|
}
|
|
1363
1366
|
}
|
|
@@ -2914,17 +2917,6 @@ dwv.ctrl.ViewController = function (view) {
|
|
|
2914
2917
|
this.getPositionFromPlanePoint({x: x, y: y}));
|
|
2915
2918
|
};
|
|
2916
2919
|
|
|
2917
|
-
/**
|
|
2918
|
-
* Set the current index.
|
|
2919
|
-
*
|
|
2920
|
-
* @param {dwv.math.Index} index The index.
|
|
2921
|
-
* @param {boolean} silent If true, does not fire a positionchange event.
|
|
2922
|
-
* @returns {boolean} False if not in bounds.
|
|
2923
|
-
*/
|
|
2924
|
-
this.setCurrentIndex = function (index, silent) {
|
|
2925
|
-
return view.setCurrentIndex(index, silent);
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
2920
|
/**
|
|
2929
2921
|
* Get a 3D position from a plane 2D position.
|
|
2930
2922
|
*
|
|
@@ -4503,7 +4495,7 @@ dwv.dicom = dwv.dicom || {};
|
|
|
4503
4495
|
* @returns {string} The version of the library.
|
|
4504
4496
|
*/
|
|
4505
4497
|
dwv.getVersion = function () {
|
|
4506
|
-
return '0.31.0-beta.
|
|
4498
|
+
return '0.31.0-beta.2';
|
|
4507
4499
|
};
|
|
4508
4500
|
|
|
4509
4501
|
/**
|
|
@@ -5970,11 +5962,15 @@ dwv.dicom = dwv.dicom || {};
|
|
|
5970
5962
|
* @returns {string} The dwv UID prefix.
|
|
5971
5963
|
*/
|
|
5972
5964
|
dwv.dicom.getDwvUIDPrefix = function () {
|
|
5973
|
-
return '1.2.826.0.1.3680043.9.7278.1
|
|
5965
|
+
return '1.2.826.0.1.3680043.9.7278.1';
|
|
5974
5966
|
};
|
|
5975
5967
|
|
|
5968
|
+
// local generated uid counter
|
|
5969
|
+
var _uidCount = 0;
|
|
5970
|
+
|
|
5976
5971
|
/**
|
|
5977
5972
|
* Get a UID for a DICOM tag.
|
|
5973
|
+
* Note: Use https://github.com/uuidjs/uuid?
|
|
5978
5974
|
*
|
|
5979
5975
|
* @see http://dicom.nema.org/dicom/2013/output/chtml/part05/chapter_9.html
|
|
5980
5976
|
* @see http://dicomiseasy.blogspot.com/2011/12/chapter-4-dicom-objects-in-chapter-3.html
|
|
@@ -5983,17 +5979,34 @@ dwv.dicom.getDwvUIDPrefix = function () {
|
|
|
5983
5979
|
* @returns {string} The corresponding UID.
|
|
5984
5980
|
*/
|
|
5985
5981
|
dwv.dicom.getUID = function (tagName) {
|
|
5986
|
-
var
|
|
5982
|
+
var prefix = dwv.dicom.getDwvUIDPrefix() + '.';
|
|
5983
|
+
var uid = '';
|
|
5987
5984
|
if (tagName === 'ImplementationClassUID') {
|
|
5988
|
-
uid
|
|
5989
|
-
} else if (tagName === 'SOPInstanceUID') {
|
|
5990
|
-
for (var i = 0; i < tagName.length; ++i) {
|
|
5991
|
-
uid += tagName.charCodeAt(i);
|
|
5992
|
-
}
|
|
5993
|
-
// add date (only numbers)
|
|
5994
|
-
uid += '.' + (new Date()).toISOString().replace(/\D/g, '');
|
|
5985
|
+
uid = prefix + dwv.getVersion();
|
|
5995
5986
|
} else {
|
|
5996
|
-
|
|
5987
|
+
// date (only numbers), do not keep milliseconds
|
|
5988
|
+
var date = (new Date()).toISOString().replace(/\D/g, '');
|
|
5989
|
+
var datePart = '.' + date.substring(0, 14);
|
|
5990
|
+
// count
|
|
5991
|
+
_uidCount += 1;
|
|
5992
|
+
var countPart = '.' + _uidCount;
|
|
5993
|
+
|
|
5994
|
+
// uid = prefix . tag . date . count
|
|
5995
|
+
uid = prefix;
|
|
5996
|
+
|
|
5997
|
+
// limit tag part to not exceed 64 length
|
|
5998
|
+
var nonTagLength = prefix.length + countPart.length + datePart.length;
|
|
5999
|
+
var leni = Math.min(tagName.length, 64 - nonTagLength);
|
|
6000
|
+
if (leni > 1) {
|
|
6001
|
+
var tagNumber = '';
|
|
6002
|
+
for (var i = 0; i < leni; ++i) {
|
|
6003
|
+
tagNumber += tagName.charCodeAt(i);
|
|
6004
|
+
}
|
|
6005
|
+
uid += tagNumber.substring(0, leni);
|
|
6006
|
+
}
|
|
6007
|
+
|
|
6008
|
+
// finish
|
|
6009
|
+
uid += datePart + countPart;
|
|
5997
6010
|
}
|
|
5998
6011
|
return uid;
|
|
5999
6012
|
};
|
|
@@ -12032,6 +12045,21 @@ dwv.gui.LayerGroup = function (containerDiv, groupId) {
|
|
|
12032
12045
|
return res;
|
|
12033
12046
|
};
|
|
12034
12047
|
|
|
12048
|
+
/**
|
|
12049
|
+
* Get the view layers data indices.
|
|
12050
|
+
*
|
|
12051
|
+
* @returns {Array} The list of indices.
|
|
12052
|
+
*/
|
|
12053
|
+
this.getViewDataIndices = function () {
|
|
12054
|
+
var res = [];
|
|
12055
|
+
for (var i = 0; i < layers.length; ++i) {
|
|
12056
|
+
if (layers[i] instanceof dwv.gui.ViewLayer) {
|
|
12057
|
+
res.push(layers[i].getDataIndex());
|
|
12058
|
+
}
|
|
12059
|
+
}
|
|
12060
|
+
return res;
|
|
12061
|
+
};
|
|
12062
|
+
|
|
12035
12063
|
/**
|
|
12036
12064
|
* Get the active draw layer.
|
|
12037
12065
|
*
|
|
@@ -15214,8 +15242,16 @@ dwv.image.Geometry.prototype.equals = function (rhs) {
|
|
|
15214
15242
|
* @returns {boolean} True if the given coordinates are within bounds.
|
|
15215
15243
|
*/
|
|
15216
15244
|
dwv.image.Geometry.prototype.isInBounds = function (point) {
|
|
15217
|
-
|
|
15218
|
-
|
|
15245
|
+
return this.isIndexInBounds(this.worldToIndex(point));
|
|
15246
|
+
};
|
|
15247
|
+
|
|
15248
|
+
/**
|
|
15249
|
+
* Check that a index is within bounds.
|
|
15250
|
+
*
|
|
15251
|
+
* @param {dwv.math.Index} index The index to check.
|
|
15252
|
+
* @returns {boolean} True if the given coordinates are within bounds.
|
|
15253
|
+
*/
|
|
15254
|
+
dwv.image.Geometry.prototype.isIndexInBounds = function (index) {
|
|
15219
15255
|
return this.getSize().isInBounds(index);
|
|
15220
15256
|
};
|
|
15221
15257
|
|
|
@@ -18669,12 +18705,12 @@ dwv.image.View = function (image) {
|
|
|
18669
18705
|
// to add the extra dimension
|
|
18670
18706
|
image.addEventListener('appendframe', function () {
|
|
18671
18707
|
// update current position if first appendFrame
|
|
18672
|
-
var
|
|
18673
|
-
if (
|
|
18708
|
+
var index = self.getCurrentIndex();
|
|
18709
|
+
if (index.length() === 3) {
|
|
18674
18710
|
// add dimension
|
|
18675
|
-
var values =
|
|
18711
|
+
var values = index.getValues();
|
|
18676
18712
|
values.push(0);
|
|
18677
|
-
self.
|
|
18713
|
+
self.setCurrentIndex(new dwv.math.Index(values));
|
|
18678
18714
|
}
|
|
18679
18715
|
});
|
|
18680
18716
|
|
|
@@ -18722,9 +18758,9 @@ dwv.image.View = function (image) {
|
|
|
18722
18758
|
* Current position as a Point3D.
|
|
18723
18759
|
*
|
|
18724
18760
|
* @private
|
|
18725
|
-
* @type {
|
|
18761
|
+
* @type {dwv.math.Index}
|
|
18726
18762
|
*/
|
|
18727
|
-
var
|
|
18763
|
+
var currentIndex = null;
|
|
18728
18764
|
/**
|
|
18729
18765
|
* View orientation. Undefined will use the original slice ordering.
|
|
18730
18766
|
*
|
|
@@ -18777,20 +18813,20 @@ dwv.image.View = function (image) {
|
|
|
18777
18813
|
};
|
|
18778
18814
|
|
|
18779
18815
|
/**
|
|
18780
|
-
*
|
|
18816
|
+
* Initialise the view: set initial index.
|
|
18781
18817
|
*/
|
|
18782
|
-
this.
|
|
18783
|
-
|
|
18818
|
+
this.init = function () {
|
|
18819
|
+
this.setInitialIndex();
|
|
18820
|
+
};
|
|
18784
18821
|
|
|
18822
|
+
/**
|
|
18823
|
+
* Set the initial index to 0.
|
|
18824
|
+
*/
|
|
18825
|
+
this.setInitialIndex = function () {
|
|
18785
18826
|
var geometry = image.getGeometry();
|
|
18786
18827
|
var values = new Array(geometry.getSize().length());
|
|
18787
18828
|
values.fill(0);
|
|
18788
|
-
|
|
18789
|
-
|
|
18790
|
-
this.setCurrentPosition(
|
|
18791
|
-
geometry.indexToWorld(index),
|
|
18792
|
-
silent
|
|
18793
|
-
);
|
|
18829
|
+
this.setCurrentIndex(new dwv.math.Index(values), true);
|
|
18794
18830
|
};
|
|
18795
18831
|
|
|
18796
18832
|
/**
|
|
@@ -18859,10 +18895,9 @@ dwv.image.View = function (image) {
|
|
|
18859
18895
|
*/
|
|
18860
18896
|
this.getCurrentWindowLut = function (rsi) {
|
|
18861
18897
|
// check position
|
|
18862
|
-
if (!this.
|
|
18863
|
-
this.
|
|
18898
|
+
if (!this.getCurrentIndex()) {
|
|
18899
|
+
this.setInitialIndex();
|
|
18864
18900
|
}
|
|
18865
|
-
var currentIndex = this.getCurrentIndex();
|
|
18866
18901
|
// use current rsi if not provided
|
|
18867
18902
|
if (typeof rsi === 'undefined') {
|
|
18868
18903
|
rsi = image.getRescaleSlopeAndIntercept(currentIndex);
|
|
@@ -19045,7 +19080,8 @@ dwv.image.View = function (image) {
|
|
|
19045
19080
|
* @returns {dwv.math.Point} The current position.
|
|
19046
19081
|
*/
|
|
19047
19082
|
this.getCurrentPosition = function () {
|
|
19048
|
-
|
|
19083
|
+
var geometry = this.getImage().getGeometry();
|
|
19084
|
+
return geometry.indexToWorld(currentIndex);
|
|
19049
19085
|
};
|
|
19050
19086
|
|
|
19051
19087
|
/**
|
|
@@ -19054,72 +19090,89 @@ dwv.image.View = function (image) {
|
|
|
19054
19090
|
* @returns {dwv.math.Index} The current index.
|
|
19055
19091
|
*/
|
|
19056
19092
|
this.getCurrentIndex = function () {
|
|
19057
|
-
|
|
19058
|
-
return geometry.worldToIndex(currentPosition);
|
|
19093
|
+
return currentIndex;
|
|
19059
19094
|
};
|
|
19060
19095
|
|
|
19061
19096
|
/**
|
|
19062
19097
|
* Set the current position.
|
|
19063
19098
|
*
|
|
19064
|
-
* @param {dwv.math.Point}
|
|
19099
|
+
* @param {dwv.math.Point} position The new position.
|
|
19065
19100
|
* @param {boolean} silent Flag to fire event or not.
|
|
19066
19101
|
* @returns {boolean} False if not in bounds
|
|
19067
19102
|
* @fires dwv.image.View#positionchange
|
|
19068
19103
|
*/
|
|
19069
|
-
this.setCurrentPosition = function (
|
|
19070
|
-
//
|
|
19071
|
-
if (typeof silent === 'undefined') {
|
|
19072
|
-
silent = false;
|
|
19073
|
-
}
|
|
19074
|
-
|
|
19104
|
+
this.setCurrentPosition = function (position, silent) {
|
|
19105
|
+
// send invalid event if not in bounds
|
|
19075
19106
|
var geometry = image.getGeometry();
|
|
19076
|
-
var
|
|
19077
|
-
|
|
19078
|
-
// check if possible
|
|
19079
|
-
if (!geometry.isInBounds(newPosition)) {
|
|
19107
|
+
var index = geometry.worldToIndex(position);
|
|
19108
|
+
if (!geometry.isIndexInBounds(index)) {
|
|
19080
19109
|
if (!silent) {
|
|
19081
19110
|
// fire event with valid: false
|
|
19082
19111
|
fireEvent({
|
|
19083
19112
|
type: 'positionchange',
|
|
19084
19113
|
value: [
|
|
19085
|
-
|
|
19086
|
-
|
|
19114
|
+
index.getValues(),
|
|
19115
|
+
position.getValues(),
|
|
19087
19116
|
],
|
|
19088
19117
|
valid: false
|
|
19089
19118
|
});
|
|
19090
19119
|
}
|
|
19091
19120
|
return false;
|
|
19092
19121
|
}
|
|
19122
|
+
return this.setCurrentIndex(index, silent);
|
|
19123
|
+
};
|
|
19093
19124
|
|
|
19094
|
-
|
|
19125
|
+
/**
|
|
19126
|
+
* Set the current index.
|
|
19127
|
+
*
|
|
19128
|
+
* @param {dwv.math.Index} index The new index.
|
|
19129
|
+
* @param {boolean} silent Flag to fire event or not.
|
|
19130
|
+
* @returns {boolean} False if not in bounds
|
|
19131
|
+
* @fires dwv.image.View#positionchange
|
|
19132
|
+
*/
|
|
19133
|
+
this.setCurrentIndex = function (index, silent) {
|
|
19134
|
+
// check input
|
|
19135
|
+
if (typeof silent === 'undefined') {
|
|
19136
|
+
silent = false;
|
|
19137
|
+
}
|
|
19138
|
+
|
|
19139
|
+
var geometry = image.getGeometry();
|
|
19140
|
+
var position = geometry.indexToWorld(index);
|
|
19141
|
+
|
|
19142
|
+
// check if possible
|
|
19143
|
+
if (!geometry.isIndexInBounds(index)) {
|
|
19144
|
+
return false;
|
|
19145
|
+
}
|
|
19146
|
+
|
|
19147
|
+
var isNew = !currentIndex || !currentIndex.equals(index);
|
|
19095
19148
|
|
|
19096
19149
|
if (isNew) {
|
|
19097
19150
|
var diffDims = null;
|
|
19098
|
-
if (
|
|
19099
|
-
if (
|
|
19100
|
-
diffDims =
|
|
19151
|
+
if (currentIndex) {
|
|
19152
|
+
if (currentIndex.canCompare(index)) {
|
|
19153
|
+
diffDims = currentIndex.compare(index);
|
|
19101
19154
|
} else {
|
|
19102
19155
|
diffDims = [];
|
|
19103
|
-
var minLen = Math.min(
|
|
19156
|
+
var minLen = Math.min(currentIndex.length(), index.length());
|
|
19104
19157
|
for (var i = 0; i < minLen; ++i) {
|
|
19105
|
-
if (
|
|
19158
|
+
if (currentIndex.get(i) !== index.get(i)) {
|
|
19106
19159
|
diffDims.push(i);
|
|
19107
19160
|
}
|
|
19108
19161
|
}
|
|
19109
|
-
var maxLen = Math.max(
|
|
19162
|
+
var maxLen = Math.max(currentIndex.length(), index.length());
|
|
19110
19163
|
for (var j = minLen; j < maxLen; ++j) {
|
|
19111
19164
|
diffDims.push(j);
|
|
19112
19165
|
}
|
|
19113
19166
|
}
|
|
19114
19167
|
} else {
|
|
19115
19168
|
diffDims = [];
|
|
19116
|
-
for (var k = 0; k <
|
|
19169
|
+
for (var k = 0; k < index.length(); ++k) {
|
|
19117
19170
|
diffDims.push(k);
|
|
19118
19171
|
}
|
|
19119
19172
|
}
|
|
19120
19173
|
|
|
19121
19174
|
// assign
|
|
19122
|
-
|
|
19175
|
+
currentIndex = index;
|
|
19123
19176
|
|
|
19124
19177
|
if (!silent) {
|
|
19125
19178
|
/**
|
|
@@ -19133,18 +19186,18 @@ dwv.image.View = function (image) {
|
|
|
19133
19186
|
var posEvent = {
|
|
19134
19187
|
type: 'positionchange',
|
|
19135
19188
|
value: [
|
|
19136
|
-
|
|
19137
|
-
|
|
19189
|
+
index.getValues(),
|
|
19190
|
+
position.getValues(),
|
|
19138
19191
|
],
|
|
19139
19192
|
diffDims: diffDims,
|
|
19140
19193
|
data: {
|
|
19141
|
-
imageUid: image.getImageUid(
|
|
19194
|
+
imageUid: image.getImageUid(index)
|
|
19142
19195
|
}
|
|
19143
19196
|
};
|
|
19144
19197
|
|
|
19145
19198
|
// add value if possible
|
|
19146
19199
|
if (image.canQuantify()) {
|
|
19147
|
-
var pixValue = image.getRescaledValueAtIndex(
|
|
19200
|
+
var pixValue = image.getRescaledValueAtIndex(index);
|
|
19148
19201
|
posEvent.value.push(pixValue);
|
|
19149
19202
|
}
|
|
19150
19203
|
|
|
@@ -19157,22 +19210,6 @@ dwv.image.View = function (image) {
|
|
|
19157
19210
|
return true;
|
|
19158
19211
|
};
|
|
19159
19212
|
|
|
19160
|
-
/**
|
|
19161
|
-
* Set the current index.
|
|
19162
|
-
*
|
|
19163
|
-
* @param {dwv.math.Index} index The index.
|
|
19164
|
-
* @param {boolean} silent If true, does not fire a positionchange event.
|
|
19165
|
-
* @returns {boolean} False if not in bounds.
|
|
19166
|
-
*/
|
|
19167
|
-
this.setCurrentIndex = function (index, silent) {
|
|
19168
|
-
var geometry = this.getImage().getGeometry();
|
|
19169
|
-
var position = geometry.indexToWorld(index);
|
|
19170
|
-
if (!geometry.isInBounds(position)) {
|
|
19171
|
-
return false;
|
|
19172
|
-
}
|
|
19173
|
-
return this.setCurrentPosition(position, silent);
|
|
19174
|
-
};
|
|
19175
|
-
|
|
19176
19213
|
/**
|
|
19177
19214
|
* Set the view window/level.
|
|
19178
19215
|
*
|
|
@@ -19354,21 +19391,21 @@ dwv.image.View.prototype.setWindowLevelMinMax = function () {
|
|
|
19354
19391
|
* Generate display image data to be given to a canvas.
|
|
19355
19392
|
*
|
|
19356
19393
|
* @param {Array} array The array to fill in.
|
|
19357
|
-
* @param {dwv.math.
|
|
19358
|
-
* otherwise generates at current
|
|
19394
|
+
* @param {dwv.math.Index} index Optional index at which to generate,
|
|
19395
|
+
* otherwise generates at current index.
|
|
19359
19396
|
*/
|
|
19360
|
-
dwv.image.View.prototype.generateImageData = function (array,
|
|
19361
|
-
// check
|
|
19362
|
-
if (typeof
|
|
19363
|
-
if (!this.
|
|
19364
|
-
this.
|
|
19397
|
+
dwv.image.View.prototype.generateImageData = function (array, index) {
|
|
19398
|
+
// check index
|
|
19399
|
+
if (typeof index === 'undefined') {
|
|
19400
|
+
if (!this.getCurrentIndex()) {
|
|
19401
|
+
this.setInitialIndex();
|
|
19365
19402
|
}
|
|
19366
|
-
|
|
19403
|
+
index = this.getCurrentIndex();
|
|
19367
19404
|
}
|
|
19368
19405
|
|
|
19369
19406
|
var image = this.getImage();
|
|
19370
19407
|
var iterator = dwv.image.getSliceIterator(
|
|
19371
|
-
image,
|
|
19408
|
+
image, index, false, this.getOrientation());
|
|
19372
19409
|
|
|
19373
19410
|
var photoInterpretation = image.getPhotometricInterpretation();
|
|
19374
19411
|
switch (photoInterpretation) {
|
|
@@ -19561,8 +19598,8 @@ dwv.image.ViewFactory.prototype.create = function (dicomElements, image) {
|
|
|
19561
19598
|
// store
|
|
19562
19599
|
view.setWindowPresets(windowPresets);
|
|
19563
19600
|
|
|
19564
|
-
//
|
|
19565
|
-
view.
|
|
19601
|
+
// initialise the view
|
|
19602
|
+
view.init();
|
|
19566
19603
|
|
|
19567
19604
|
return view;
|
|
19568
19605
|
};
|
|
@@ -23774,6 +23811,27 @@ dwv.math.Index.prototype.equals = function (rhs) {
|
|
|
23774
23811
|
return true;
|
|
23775
23812
|
};
|
|
23776
23813
|
|
|
23814
|
+
/**
|
|
23815
|
+
* Compare indices and return different dimensions.
|
|
23816
|
+
*
|
|
23817
|
+
* @param {dwv.math.Index} rhs The index to compare to.
|
|
23818
|
+
* @returns {Array} The list of different dimensions.
|
|
23819
|
+
*/
|
|
23820
|
+
dwv.math.Index.prototype.compare = function (rhs) {
|
|
23821
|
+
// check if can compare
|
|
23822
|
+
if (!this.canCompare(rhs)) {
|
|
23823
|
+
return null;
|
|
23824
|
+
}
|
|
23825
|
+
// check values
|
|
23826
|
+
var diffDims = [];
|
|
23827
|
+
for (var i = 0, leni = this.length(); i < leni; ++i) {
|
|
23828
|
+
if (this.get(i) !== rhs.get(i)) {
|
|
23829
|
+
diffDims.push(i);
|
|
23830
|
+
}
|
|
23831
|
+
}
|
|
23832
|
+
return diffDims;
|
|
23833
|
+
};
|
|
23834
|
+
|
|
23777
23835
|
/**
|
|
23778
23836
|
* Add another index to this one.
|
|
23779
23837
|
*
|