dicom-microscopy-viewer 0.37.0 → 0.37.1

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.
Files changed (55) hide show
  1. package/dist/dicom-microscopy-viewer.js +1 -1
  2. package/dist/dicom-microscopy-viewer.js.map +1 -1
  3. package/docs/annotation.AnnotationGroup.html +1 -1
  4. package/docs/annotation.html +1 -1
  5. package/docs/annotation.js.html +1 -1
  6. package/docs/annotations__AnnotationManager.js.html +1 -1
  7. package/docs/annotations_markups__MarkupManager.js.html +1 -1
  8. package/docs/api.html +1 -1
  9. package/docs/color.PaletteColorLookupTable.html +4 -4
  10. package/docs/color.html +1 -1
  11. package/docs/color.js.html +17 -14
  12. package/docs/dicom-microscopy-viewer.js.html +1 -1
  13. package/docs/events.html +1 -1
  14. package/docs/events.js.html +1 -1
  15. package/docs/index.html +1 -1
  16. package/docs/mapping.ParameterMapping.html +1 -1
  17. package/docs/mapping.Transformation.html +1 -1
  18. package/docs/mapping.html +1 -1
  19. package/docs/mapping.js.html +1 -1
  20. package/docs/metadata.Comprehensive3DSR.html +1 -1
  21. package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +1 -1
  22. package/docs/metadata.ParametricMap.html +1 -1
  23. package/docs/metadata.SOPClass.html +1 -1
  24. package/docs/metadata.Segmentation.html +1 -1
  25. package/docs/metadata.VLWholeSlideMicroscopyImage.html +1 -1
  26. package/docs/metadata.html +1 -1
  27. package/docs/metadata.js.html +1 -1
  28. package/docs/opticalPath.OpticalPath.html +1 -1
  29. package/docs/opticalPath.html +1 -1
  30. package/docs/opticalPath.js.html +1 -1
  31. package/docs/pyramid.js.html +1 -1
  32. package/docs/roi.ROI.html +1 -1
  33. package/docs/roi.html +1 -1
  34. package/docs/roi.js.html +1 -1
  35. package/docs/scoord3d.Ellipse.html +1 -1
  36. package/docs/scoord3d.Ellipsoid.html +1 -1
  37. package/docs/scoord3d.Multipoint.html +1 -1
  38. package/docs/scoord3d.Point.html +1 -1
  39. package/docs/scoord3d.Polygon.html +1 -1
  40. package/docs/scoord3d.Polyline.html +1 -1
  41. package/docs/scoord3d.Scoord3D.html +1 -1
  42. package/docs/scoord3d.html +1 -1
  43. package/docs/scoord3d.js.html +1 -1
  44. package/docs/segment.Segment.html +1 -1
  45. package/docs/segment.html +1 -1
  46. package/docs/segment.js.html +1 -1
  47. package/docs/utils.html +1 -1
  48. package/docs/utils.js.html +1 -1
  49. package/docs/viewer.LabelImageViewer.html +1 -1
  50. package/docs/viewer.OverviewImageViewer.html +1 -1
  51. package/docs/viewer.VolumeImageViewer.html +1 -1
  52. package/docs/viewer.html +1 -1
  53. package/docs/viewer.js.html +1 -1
  54. package/package.json +1 -1
  55. package/src/color.js +16 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dicom-microscopy-viewer",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Interactive web-based viewer for DICOM Microscopy Images",
5
5
  "main": "./src/dicom-microscopy-viewer.js",
6
6
  "standard": {
package/src/color.js CHANGED
@@ -292,7 +292,8 @@ class PaletteColorLookupTable {
292
292
  const startpoint = lut[offset - 1]
293
293
  const step = (endpoint - startpoint) / (length - 1)
294
294
  for (let j = 0; j < length; j++) {
295
- lut[offset + j] = startpoint + Math.round(j * step)
295
+ const value = startpoint + Math.round(j * step)
296
+ lut[offset + j] = value
296
297
  }
297
298
  offset += length
298
299
  } else if (opcode === 2) {
@@ -368,17 +369,23 @@ class PaletteColorLookupTable {
368
369
  )
369
370
  }
370
371
 
371
- if (this[_attrs].bitsPerEntry === 16) {
372
+ const maxValues = [
373
+ Math.max(...redLUT),
374
+ Math.max(...greenLUT),
375
+ Math.max(...blueLUT)
376
+ ]
377
+ const maxInput = Math.max(...maxValues)
378
+ const maxOutput = 255
379
+ if (this[_attrs].bitsPerEntry === 16 && maxInput > 255) {
372
380
  /*
373
381
  * Only palettes with 256 entries and 8 bit per entry are supported for
374
382
  * display. Therefore, data need to rescaled and resampled.
375
383
  */
376
- const maxInput = Math.pow(2, 16) - 1
377
- const maxOutput = Math.pow(2, 8) - 1
378
- const steps = Math.pow(2, 16) / Math.pow(2, 8)
379
- this[_attrs].data = new Array(steps)
380
- for (let i = 0; i < steps; i++) {
381
- const j = i * steps
384
+ const n = 256
385
+ const step = this[_attrs].numberOfEntries / n
386
+ this[_attrs].data = new Array(n)
387
+ for (let i = 0; i < n; i++) {
388
+ const j = i * step
382
389
  this[_attrs].data[i] = [
383
390
  Math.round(rescale(redLUT[j], 0, maxInput, 0, maxOutput)),
384
391
  Math.round(rescale(greenLUT[j], 0, maxInput, 0, maxOutput)),
@@ -388,11 +395,7 @@ class PaletteColorLookupTable {
388
395
  } else {
389
396
  this[_attrs].data = new Array(this[_attrs].numberOfEntries)
390
397
  for (let i = 0; i < this[_attrs].numberOfEntries; i++) {
391
- this[_attrs].data[i] = [
392
- redLUT[i],
393
- greenLUT[i],
394
- blueLUT[i]
395
- ]
398
+ this[_attrs].data[i] = [redLUT[i], greenLUT[i], blueLUT[i]]
396
399
  }
397
400
  }
398
401
  }