dwv 0.32.0-beta.0 → 0.32.0-beta.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.
package/dist/dwv.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /**An accessibility modifier cannot be used with a private identifier
1
+ /**
2
2
  * Main application class.
3
3
  *
4
4
  * @example
@@ -451,30 +451,19 @@ export declare const decoderScripts: {
451
451
  rle: string;
452
452
  };
453
453
 
454
- export declare namespace defaultPresets {
455
- export namespace CT {
456
- export namespace mediastinum {
457
- const center: number;
458
- const width: number;
459
- }
460
- export namespace lung {
461
- const center: number;
462
- const width: number;
463
- }
464
- export namespace bone {
465
- const center: number;
466
- const width: number;
467
- }
468
- export namespace brain {
469
- const center: number;
470
- const width: number;
471
- }
472
- export namespace head {
473
- const center: number;
474
- const width: number;
475
- }
476
- }
477
- }
454
+ /**
455
+ * List of default window level presets.
456
+ *
457
+ * @type {{[key: string]: {[key: string]: {center: number, width: number}}}}
458
+ */
459
+ export declare const defaultPresets: {
460
+ [key: string]: {
461
+ [key: string]: {
462
+ center: number;
463
+ width: number;
464
+ };
465
+ };
466
+ };
478
467
 
479
468
  /**
480
469
  * DicomParser class.
@@ -6302,10 +6291,10 @@ export declare function getUriQuery(uri: string): object;
6302
6291
  declare class Image_2 {
6303
6292
  /**
6304
6293
  * @param {Geometry} geometry The geometry of the image.
6305
- * @param {Array} buffer The image data as a one dimensional buffer.
6294
+ * @param {TypedArray} buffer The image data as a one dimensional buffer.
6306
6295
  * @param {Array} [imageUids] An array of Uids indexed to slice number.
6307
6296
  */
6308
- constructor(geometry: Geometry, buffer: any[], imageUids?: any[]);
6297
+ constructor(geometry: Geometry, buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, imageUids?: any[]);
6309
6298
  /**
6310
6299
  * Get the image UID at a given index.
6311
6300
  *
@@ -6323,9 +6312,9 @@ declare class Image_2 {
6323
6312
  * Get the data buffer of the image.
6324
6313
  *
6325
6314
  * @todo dangerous...
6326
- * @returns {Array} The data buffer of the image.
6315
+ * @returns {TypedArray} The data buffer of the image.
6327
6316
  */
6328
- getBuffer(): any[];
6317
+ getBuffer(): Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array;
6329
6318
  /**
6330
6319
  * Can the image values be quantified?
6331
6320
  *
@@ -6613,10 +6602,10 @@ declare class Image_2 {
6613
6602
  * Note: Uses raw buffer values.
6614
6603
  *
6615
6604
  * @param {Array} weights The weights of the 2D kernel as a 3x3 matrix.
6616
- * @param {Array} buffer The buffer to convolute.
6605
+ * @param {TypedArray} buffer The buffer to convolute.
6617
6606
  * @param {number} startOffset The index to start at.
6618
6607
  */
6619
- convoluteBuffer(weights: any[], buffer: any[], startOffset: number): void;
6608
+ convoluteBuffer(weights: any[], buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, startOffset: number): void;
6620
6609
  /**
6621
6610
  * Transform an image using a specific operator.
6622
6611
  * WARNING: no size check!
@@ -7013,48 +7002,18 @@ export declare namespace logger {
7013
7002
  export function error(msg: string): void;
7014
7003
  }
7015
7004
 
7016
- export declare namespace lut {
7017
- export namespace plain {
7018
- const red: any[];
7019
- const green: any[];
7020
- const blue: any[];
7021
- }
7022
- export namespace invPlain {
7023
- const red: any[];
7024
- const green: any[];
7025
- const blue: any[];
7026
- }
7027
- export namespace rainbow {
7028
- const red: any[];
7029
- const green: any[];
7030
- const blue: any[];
7031
- }
7032
- export namespace hot {
7033
- const red: any[];
7034
- const green: any[];
7035
- const blue: any[];
7036
- }
7037
- export namespace hot_iron {
7038
- const red: any[];
7039
- const green: any[];
7040
- const blue: any[];
7041
- }
7042
- export namespace pet {
7043
- const red: any[];
7044
- const green: any[];
7045
- const blue: any[];
7046
- }
7047
- export namespace hot_metal_blue {
7048
- const red: any[];
7049
- const green: any[];
7050
- const blue: any[];
7051
- }
7052
- export namespace pet_20step {
7053
- const red: any[];
7054
- const green: any[];
7055
- const blue: any[];
7056
- }
7057
- }
7005
+ /**
7006
+ * List of available lookup tables (lut).
7007
+ *
7008
+ * @type {{[key: string]: {red: number[], green: number[], blue: number[]}}}
7009
+ */
7010
+ export declare const lut: {
7011
+ [key: string]: {
7012
+ red: number[];
7013
+ green: number[];
7014
+ blue: number[];
7015
+ };
7016
+ };
7058
7017
 
7059
7018
  /**
7060
7019
  * Immutable 3x3 Matrix.
@@ -7252,6 +7211,56 @@ export declare class Point {
7252
7211
  #private;
7253
7212
  }
7254
7213
 
7214
+ /**
7215
+ * Immutable 2D point.
7216
+ */
7217
+ export declare class Point2D {
7218
+ /**
7219
+ * @param {number} x The X coordinate for the point.
7220
+ * @param {number} y The Y coordinate for the point.
7221
+ */
7222
+ constructor(x: number, y: number);
7223
+ /**
7224
+ * Get the X position of the point.
7225
+ *
7226
+ * @returns {number} The X position of the point.
7227
+ */
7228
+ getX(): number;
7229
+ /**
7230
+ * Get the Y position of the point.
7231
+ *
7232
+ * @returns {number} The Y position of the point.
7233
+ */
7234
+ getY(): number;
7235
+ /**
7236
+ * Check for Point2D equality.
7237
+ *
7238
+ * @param {Point2D} rhs The other point to compare to.
7239
+ * @returns {boolean} True if both points are equal.
7240
+ */
7241
+ equals(rhs: Point2D): boolean;
7242
+ /**
7243
+ * Get a string representation of the Point2D.
7244
+ *
7245
+ * @returns {string} The point as a string.
7246
+ */
7247
+ toString(): string;
7248
+ /**
7249
+ * Get the distance to another Point2D.
7250
+ *
7251
+ * @param {Point2D} point2D The input point.
7252
+ * @returns {number} The distance to the input point.
7253
+ */
7254
+ getDistance(point2D: Point2D): number;
7255
+ /**
7256
+ * Round a Point2D.
7257
+ *
7258
+ * @returns {Point2D} The rounded point.
7259
+ */
7260
+ getRound(): Point2D;
7261
+ #private;
7262
+ }
7263
+
7255
7264
  /**
7256
7265
  * Immutable 3D point.
7257
7266
  */
@@ -7332,6 +7341,99 @@ export declare class Point3D {
7332
7341
  */
7333
7342
  export declare function precisionRound(number: number, precision: number): number;
7334
7343
 
7344
+ /**
7345
+ * Rescale LUT class.
7346
+ * Typically converts from integer to float.
7347
+ */
7348
+ export declare class RescaleLut {
7349
+ /**
7350
+ * @param {RescaleSlopeAndIntercept} rsi The rescale slope and intercept.
7351
+ * @param {number} bitsStored The number of bits used to store the data.
7352
+ */
7353
+ constructor(rsi: RescaleSlopeAndIntercept, bitsStored: number);
7354
+ /**
7355
+ * Get the Rescale Slope and Intercept (RSI).
7356
+ *
7357
+ * @returns {RescaleSlopeAndIntercept} The rescale slope and intercept object.
7358
+ */
7359
+ getRSI(): RescaleSlopeAndIntercept;
7360
+ /**
7361
+ * Is the lut ready to use or not? If not, the user must
7362
+ * call 'initialise'.
7363
+ *
7364
+ * @returns {boolean} True if the lut is ready to use.
7365
+ */
7366
+ isReady(): boolean;
7367
+ /**
7368
+ * Initialise the LUT.
7369
+ */
7370
+ initialise(): void;
7371
+ /**
7372
+ * Get the length of the LUT array.
7373
+ *
7374
+ * @returns {number} The length of the LUT array.
7375
+ */
7376
+ getLength(): number;
7377
+ /**
7378
+ * Get the value of the LUT at the given offset.
7379
+ *
7380
+ * @param {number} offset The input offset in [0,2^bitsStored] range.
7381
+ * @returns {number} The float32 value of the LUT at the given offset.
7382
+ */
7383
+ getValue(offset: number): number;
7384
+ #private;
7385
+ }
7386
+
7387
+ /**
7388
+ * Rescale Slope and Intercept
7389
+ */
7390
+ export declare class RescaleSlopeAndIntercept {
7391
+ /**
7392
+ * @param {number} slope The slope of the RSI.
7393
+ * @param {number} intercept The intercept of the RSI.
7394
+ */
7395
+ constructor(slope: number, intercept: number);
7396
+ /**
7397
+ * Get the slope of the RSI.
7398
+ *
7399
+ * @returns {number} The slope of the RSI.
7400
+ */
7401
+ getSlope(): number;
7402
+ /**
7403
+ * Get the intercept of the RSI.
7404
+ *
7405
+ * @returns {number} The intercept of the RSI.
7406
+ */
7407
+ getIntercept(): number;
7408
+ /**
7409
+ * Apply the RSI on an input value.
7410
+ *
7411
+ * @param {number} value The input value.
7412
+ * @returns {number} The value to rescale.
7413
+ */
7414
+ apply(value: number): number;
7415
+ /**
7416
+ * Check for RSI equality.
7417
+ *
7418
+ * @param {RescaleSlopeAndIntercept} rhs The other RSI to compare to.
7419
+ * @returns {boolean} True if both RSI are equal.
7420
+ */
7421
+ equals(rhs: RescaleSlopeAndIntercept): boolean;
7422
+ /**
7423
+ * Get a string representation of the RSI.
7424
+ *
7425
+ * @returns {string} The RSI as a string.
7426
+ */
7427
+ toString(): string;
7428
+ /**
7429
+ * Is this RSI an ID RSI.
7430
+ *
7431
+ * @returns {boolean} True if the RSI has a slope of 1 and no intercept.
7432
+ */
7433
+ isID(): boolean;
7434
+ #private;
7435
+ }
7436
+
7335
7437
  /**
7336
7438
  * Immutable Size class.
7337
7439
  * Warning: the input array is NOT cloned, modifying it will
@@ -7659,6 +7761,643 @@ export declare class Vector3D {
7659
7761
  #private;
7660
7762
  }
7661
7763
 
7764
+ /**
7765
+ * View class.
7766
+ *
7767
+ * Need to set the window lookup table once created
7768
+ * (either directly or with helper methods).
7769
+ */
7770
+ export declare class View {
7771
+ /**
7772
+ * @param {Image} image The associated image.
7773
+ */
7774
+ constructor(image: Image_2);
7775
+ /**
7776
+ * Get the associated image.
7777
+ *
7778
+ * @returns {Image} The associated image.
7779
+ */
7780
+ getImage(): Image_2;
7781
+ /**
7782
+ * Set the associated image.
7783
+ *
7784
+ * @param {Image} inImage The associated image.
7785
+ */
7786
+ setImage(inImage: Image_2): void;
7787
+ /**
7788
+ * Get the view orientation.
7789
+ *
7790
+ * @returns {Matrix33} The orientation matrix.
7791
+ */
7792
+ getOrientation(): Matrix33;
7793
+ /**
7794
+ * Set the view orientation.
7795
+ *
7796
+ * @param {Matrix33} mat33 The orientation matrix.
7797
+ */
7798
+ setOrientation(mat33: Matrix33): void;
7799
+ /**
7800
+ * Initialise the view: set initial index.
7801
+ */
7802
+ init(): void;
7803
+ /**
7804
+ * Set the initial index to 0.
7805
+ */
7806
+ setInitialIndex(): void;
7807
+ /**
7808
+ * Get the milliseconds per frame from frame rate.
7809
+ *
7810
+ * @param {number} recommendedDisplayFrameRate Recommended Display Frame Rate.
7811
+ * @returns {number} The milliseconds per frame.
7812
+ */
7813
+ getPlaybackMilliseconds(recommendedDisplayFrameRate: number): number;
7814
+ /**
7815
+ * @callback alphaFn@callback alphaFn
7816
+ * @param {object} value The pixel value.
7817
+ * @param {object} index The values' index.
7818
+ * @returns {number} The value to display.
7819
+ */
7820
+ /**
7821
+ * Get the alpha function.
7822
+ *
7823
+ * @returns {alphaFn} The function.
7824
+ */
7825
+ getAlphaFunction(): (value: object, index: object) => number;
7826
+ /**
7827
+ * Set alpha function.
7828
+ *
7829
+ * @param {alphaFn} func The function.
7830
+ * @fires View#alphafuncchange
7831
+ */
7832
+ setAlphaFunction(func: (value: object, index: object) => number): void;
7833
+ /**
7834
+ * Get the window LUT of the image.
7835
+ * Warning: can be undefined in no window/level was set.
7836
+ *
7837
+ * @param {object} [rsi] Optional image rsi, will take the one of the
7838
+ * current slice otherwise.
7839
+ * @returns {WindowLut} The window LUT of the image.
7840
+ * @fires View#wlchange
7841
+ */
7842
+ getCurrentWindowLut(rsi?: object): WindowLut;
7843
+ /**
7844
+ * Add the window LUT to the list.
7845
+ *
7846
+ * @param {WindowLut} wlut The window LUT of the image.
7847
+ */
7848
+ addWindowLut(wlut: WindowLut): void;
7849
+ /**
7850
+ * Get the window presets.
7851
+ *
7852
+ * @returns {object} The window presets.
7853
+ */
7854
+ getWindowPresets(): object;
7855
+ /**
7856
+ * Get the window presets names.
7857
+ *
7858
+ * @returns {object} The list of window presets names.
7859
+ */
7860
+ getWindowPresetsNames(): object;
7861
+ /**
7862
+ * Set the window presets.
7863
+ *
7864
+ * @param {object} presets The window presets.
7865
+ */
7866
+ setWindowPresets(presets: object): void;
7867
+ /**
7868
+ * Set the default colour map.
7869
+ *
7870
+ * @param {object} map The colour map.
7871
+ */
7872
+ setDefaultColourMap(map: object): void;
7873
+ /**
7874
+ * Add window presets to the existing ones.
7875
+ *
7876
+ * @param {object} presets The window presets.
7877
+ */
7878
+ addWindowPresets(presets: object): void;
7879
+ /**
7880
+ * Get the colour map of the image.
7881
+ *
7882
+ * @returns {object} The colour map of the image.
7883
+ */
7884
+ getColourMap(): object;
7885
+ /**
7886
+ * Set the colour map of the image.
7887
+ *
7888
+ * @param {object} map The colour map of the image.
7889
+ * @fires View#colourchange
7890
+ */
7891
+ setColourMap(map: object): void;
7892
+ /**
7893
+ * Get the current position.
7894
+ *
7895
+ * @returns {Point} The current position.
7896
+ */
7897
+ getCurrentPosition(): Point;
7898
+ /**
7899
+ * Get the current index.
7900
+ *
7901
+ * @returns {Index} The current index.
7902
+ */
7903
+ getCurrentIndex(): Index;
7904
+ /**
7905
+ * Check is the provided position can be set.
7906
+ *
7907
+ * @param {Point} position The position.
7908
+ * @returns {boolean} True is the position is in bounds.
7909
+ */
7910
+ canSetPosition(position: Point): boolean;
7911
+ /**
7912
+ * Get the origin at a given position.
7913
+ *
7914
+ * @param {Point} position The position.
7915
+ * @returns {Point} The origin.
7916
+ */
7917
+ getOrigin(position: Point): Point;
7918
+ /**
7919
+ * Set the current position.
7920
+ *
7921
+ * @param {Point} position The new position.
7922
+ * @param {boolean} silent Flag to fire event or not.
7923
+ * @returns {boolean} False if not in bounds
7924
+ * @fires View#positionchange
7925
+ */
7926
+ setCurrentPosition(position: Point, silent: boolean): boolean;
7927
+ /**
7928
+ * Set the current index.
7929
+ *
7930
+ * @param {Index} index The new index.
7931
+ * @param {boolean} [silent] Flag to fire event or not.
7932
+ * @returns {boolean} False if not in bounds.
7933
+ * @fires View#positionchange
7934
+ */
7935
+ setCurrentIndex(index: Index, silent?: boolean): boolean;
7936
+ /**
7937
+ * Set the view window/level.
7938
+ *
7939
+ * @param {number} center The window center.
7940
+ * @param {number} width The window width.
7941
+ * @param {string} [name] Associated preset name, defaults to 'manual'.
7942
+ * Warning: uses the latest set rescale LUT or the default linear one.
7943
+ * @param {boolean} [silent] Flag to launch events with skipGenerate.
7944
+ * @fires View#wlchange
7945
+ */
7946
+ setWindowLevel(center: number, width: number, name?: string, silent?: boolean): void;
7947
+ /**
7948
+ * Set the window level to the preset with the input name.
7949
+ *
7950
+ * @param {string} name The name of the preset to activate.
7951
+ * @param {boolean} [silent] Flag to launch events with skipGenerate.
7952
+ */
7953
+ setWindowLevelPreset(name: string, silent?: boolean): void;
7954
+ /**
7955
+ * Set the window level to the preset with the input id.
7956
+ *
7957
+ * @param {number} id The id of the preset to activate.
7958
+ * @param {boolean} [silent] Flag to launch events with skipGenerate.
7959
+ */
7960
+ setWindowLevelPresetById(id: number, silent?: boolean): void;
7961
+ /**
7962
+ * Add an event listener to this class.
7963
+ *
7964
+ * @param {string} type The event type.
7965
+ * @param {object} callback The method associated with the provided
7966
+ * event type, will be called with the fired event.
7967
+ */
7968
+ addEventListener(type: string, callback: object): void;
7969
+ /**
7970
+ * Remove an event listener from this class.
7971
+ *
7972
+ * @param {string} type The event type.
7973
+ * @param {object} callback The method associated with the provided
7974
+ * event type.
7975
+ */
7976
+ removeEventListener(type: string, callback: object): void;
7977
+ /**
7978
+ * Get the image window/level that covers the full data range.
7979
+ * Warning: uses the latest set rescale LUT or the default linear one.
7980
+ *
7981
+ * @returns {object} A min/max window level.
7982
+ */
7983
+ getWindowLevelMinMax(): object;
7984
+ /**
7985
+ * Set the image window/level to cover the full data range.
7986
+ * Warning: uses the latest set rescale LUT or the default linear one.
7987
+ */
7988
+ setWindowLevelMinMax(): void;
7989
+ /**
7990
+ * Generate display image data to be given to a canvas.
7991
+ *
7992
+ * @param {ImageData} data The iamge data to fill in.
7993
+ * @param {Index} index Optional index at which to generate,
7994
+ * otherwise generates at current index.
7995
+ */
7996
+ generateImageData(data: ImageData, index: Index): void;
7997
+ /**
7998
+ * Increment the provided dimension.
7999
+ *
8000
+ * @param {number} dim The dimension to increment.
8001
+ * @param {boolean} silent Do not send event.
8002
+ * @returns {boolean} False if not in bounds.
8003
+ */
8004
+ incrementIndex(dim: number, silent: boolean): boolean;
8005
+ /**
8006
+ * Decrement the provided dimension.
8007
+ *
8008
+ * @param {number} dim The dimension to increment.
8009
+ * @param {boolean} silent Do not send event.
8010
+ * @returns {boolean} False if not in bounds.
8011
+ */
8012
+ decrementIndex(dim: number, silent: boolean): boolean;
8013
+ /**
8014
+ * Get the scroll dimension index.
8015
+ *
8016
+ * @returns {number} The index.
8017
+ */
8018
+ getScrollIndex(): number;
8019
+ /**
8020
+ * Decrement the scroll dimension index.
8021
+ *
8022
+ * @param {boolean} silent Do not send event.
8023
+ * @returns {boolean} False if not in bounds.
8024
+ */
8025
+ decrementScrollIndex(silent: boolean): boolean;
8026
+ /**
8027
+ * Increment the scroll dimension index.
8028
+ *
8029
+ * @param {boolean} silent Do not send event.
8030
+ * @returns {boolean} False if not in bounds.
8031
+ */
8032
+ incrementScrollIndex(silent: boolean): boolean;
8033
+ #private;
8034
+ }
8035
+
8036
+ /**
8037
+ * View controller.
8038
+ */
8039
+ export declare class ViewController {
8040
+ /**
8041
+ * @param {View} view The associated view.
8042
+ * @param {number} index The associated data index.
8043
+ */
8044
+ constructor(view: View, index: number);
8045
+ /**
8046
+ * Get the plane helper.
8047
+ *
8048
+ * @returns {object} The helper.
8049
+ */
8050
+ getPlaneHelper(): object;
8051
+ /**
8052
+ * Check is the associated image is a mask.
8053
+ *
8054
+ * @returns {boolean} True if the associated image is a mask.
8055
+ */
8056
+ isMask(): boolean;
8057
+ /**
8058
+ * Get the mask segment helper.
8059
+ *
8060
+ * @returns {object} The helper.
8061
+ */
8062
+ getMaskSegmentHelper(): object;
8063
+ /**
8064
+ * Apply the hidden segments list by setting
8065
+ * the corresponding alpha function.
8066
+ */
8067
+ applyHiddenSegments(): void;
8068
+ /**
8069
+ * Delete a segment.
8070
+ *
8071
+ * @param {number} segmentNumber The segment number.
8072
+ * @param {Function} exeCallback The post execution callback.
8073
+ */
8074
+ deleteSegment(segmentNumber: number, exeCallback: Function): void;
8075
+ /**
8076
+ * Initialise the controller.
8077
+ */
8078
+ initialise(): void;
8079
+ /**
8080
+ * Get the window/level presets names.
8081
+ *
8082
+ * @returns {Array} The presets names.
8083
+ */
8084
+ getWindowLevelPresetsNames(): any[];
8085
+ /**
8086
+ * Add window/level presets to the view.
8087
+ *
8088
+ * @param {object} presets A preset object.
8089
+ * @returns {object} The list of presets.
8090
+ */
8091
+ addWindowLevelPresets(presets: object): object;
8092
+ /**
8093
+ * Set the window level to the preset with the input name.
8094
+ *
8095
+ * @param {string} name The name of the preset to activate.
8096
+ */
8097
+ setWindowLevelPreset(name: string): void;
8098
+ /**
8099
+ * Set the window level to the preset with the input id.
8100
+ *
8101
+ * @param {number} id The id of the preset to activate.
8102
+ */
8103
+ setWindowLevelPresetById(id: number): void;
8104
+ /**
8105
+ * Check if the controller is playing.
8106
+ *
8107
+ * @returns {boolean} True if the controler is playing.
8108
+ */
8109
+ isPlaying(): boolean;
8110
+ /**
8111
+ * Get the current position.
8112
+ *
8113
+ * @returns {Point} The position.
8114
+ */
8115
+ getCurrentPosition(): Point;
8116
+ /**
8117
+ * Get the current index.
8118
+ *
8119
+ * @returns {Index} The current index.
8120
+ */
8121
+ getCurrentIndex(): Index;
8122
+ /**
8123
+ * Get the current oriented index.
8124
+ *
8125
+ * @returns {Index} The index.
8126
+ */
8127
+ getCurrentOrientedIndex(): Index;
8128
+ /**
8129
+ * Get the scroll index.
8130
+ *
8131
+ * @returns {number} The index.
8132
+ */
8133
+ getScrollIndex(): number;
8134
+ /**
8135
+ * Get the current scroll index value.
8136
+ *
8137
+ * @returns {object} The value.
8138
+ */
8139
+ getCurrentScrollIndexValue(): object;
8140
+ /**
8141
+ * Get the origin at a given posittion.
8142
+ *
8143
+ * @param {Point} position The input position.
8144
+ * @returns {Point} The origin.
8145
+ */
8146
+ getOrigin(position: Point): Point;
8147
+ /**
8148
+ * Get the current scroll position value.
8149
+ *
8150
+ * @returns {object} The value.
8151
+ */
8152
+ getCurrentScrollPosition(): object;
8153
+ /**
8154
+ * Generate display image data to be given to a canvas.
8155
+ *
8156
+ * @param {ImageData} array The array to fill in.
8157
+ * @param {Index} index Optional index at which to generate,
8158
+ * otherwise generates at current index.
8159
+ */
8160
+ generateImageData(array: ImageData, index: Index): void;
8161
+ /**
8162
+ * Set the associated image.
8163
+ *
8164
+ * @param {Image} img The associated image.
8165
+ * @param {number} index The data index of the image.
8166
+ */
8167
+ setImage(img: Image_2, index: number): void;
8168
+ /**
8169
+ * Get the current spacing.
8170
+ *
8171
+ * @returns {Array} The 2D spacing.
8172
+ */
8173
+ get2DSpacing(): any[];
8174
+ /**
8175
+ * Get the image rescaled value at the input position.
8176
+ *
8177
+ * @param {Point} position the input position.
8178
+ * @returns {number|undefined} The image value or undefined if out of bounds
8179
+ * or no quantifiable (for ex RGB).
8180
+ */
8181
+ getRescaledImageValue(position: Point): number | undefined;
8182
+ /**
8183
+ * Get the image pixel unit.
8184
+ *
8185
+ * @returns {string} The unit
8186
+ */
8187
+ getPixelUnit(): string;
8188
+ /**
8189
+ * Get some values from the associated image in a region.
8190
+ *
8191
+ * @param {Point2D} min Minimum point.
8192
+ * @param {Point2D} max Maximum point.
8193
+ * @returns {Array} A list of values.
8194
+ */
8195
+ getImageRegionValues(min: Point2D, max: Point2D): any[];
8196
+ /**
8197
+ * Get some values from the associated image in variable regions.
8198
+ *
8199
+ * @param {Array} regions A list of regions.
8200
+ * @returns {Array} A list of values.
8201
+ */
8202
+ getImageVariableRegionValues(regions: any[]): any[];
8203
+ /**
8204
+ * Can the image values be quantified?
8205
+ *
8206
+ * @returns {boolean} True if possible.
8207
+ */
8208
+ canQuantifyImage(): boolean;
8209
+ /**
8210
+ * Can window and level be applied to the data?
8211
+ *
8212
+ * @returns {boolean} True if possible.
8213
+ */
8214
+ canWindowLevel(): boolean;
8215
+ /**
8216
+ * Can the data be scrolled?
8217
+ *
8218
+ * @returns {boolean} True if the data has either the third dimension
8219
+ * or above greater than one.
8220
+ */
8221
+ canScroll(): boolean;
8222
+ /**
8223
+ * Get the image size.
8224
+ *
8225
+ * @returns {Size} The size.
8226
+ */
8227
+ getImageSize(): Size;
8228
+ /**
8229
+ * Get the image world (mm) 2D size.
8230
+ *
8231
+ * @returns {object} The 2D size as {x,y}.
8232
+ */
8233
+ getImageWorldSize(): object;
8234
+ /**
8235
+ * Get the image rescaled data range.
8236
+ *
8237
+ * @returns {object} The range as {min, max}.
8238
+ */
8239
+ getImageRescaledDataRange(): object;
8240
+ /**
8241
+ * Compare the input meta data to the associated image one.
8242
+ *
8243
+ * @param {object} meta The meta data.
8244
+ * @returns {boolean} True if the associated image has equal meta data.
8245
+ */
8246
+ equalImageMeta(meta: object): boolean;
8247
+ /**
8248
+ * Check is the provided position can be set.
8249
+ *
8250
+ * @param {Point} position The position.
8251
+ * @returns {boolean} True is the position is in bounds.
8252
+ */
8253
+ canSetPosition(position: Point): boolean;
8254
+ /**
8255
+ * Set the current position.
8256
+ *
8257
+ * @param {Point} pos The position.
8258
+ * @param {boolean} [silent] If true, does not fire a
8259
+ * positionchange event.
8260
+ * @returns {boolean} False if not in bounds.
8261
+ */
8262
+ setCurrentPosition(pos: Point, silent?: boolean): boolean;
8263
+ /**
8264
+ * Get a position from a 2D (x,y) position.
8265
+ *
8266
+ * @param {number} x The column position.
8267
+ * @param {number} y The row position.
8268
+ * @returns {Point} The associated position.
8269
+ */
8270
+ getPositionFromPlanePoint(x: number, y: number): Point;
8271
+ /**
8272
+ * Get a 2D (x,y) position from a position.
8273
+ *
8274
+ * @param {Point} point The 3D position.
8275
+ * @returns {object} The 2D position.
8276
+ */
8277
+ getPlanePositionFromPosition(point: Point): object;
8278
+ /**
8279
+ * Set the current index.
8280
+ *
8281
+ * @param {Index} index The index.
8282
+ * @param {boolean} silent If true, does not fire a positionchange event.
8283
+ * @returns {boolean} False if not in bounds.
8284
+ */
8285
+ setCurrentIndex(index: Index, silent: boolean): boolean;
8286
+ /**
8287
+ * Get a plane 3D position from a plane 2D position: does not compensate
8288
+ * for the image origin. Needed for setting the scale center...
8289
+ *
8290
+ * @param {object} point2D The 2D position as {x,y}.
8291
+ * @returns {Point3D} The 3D point.
8292
+ */
8293
+ getPlanePositionFromPlanePoint(point2D: object): Point3D;
8294
+ /**
8295
+ * Get a 3D offset from a plane one.
8296
+ *
8297
+ * @param {object} offset2D The plane offset as {x,y}.
8298
+ * @returns {Vector3D} The 3D world offset.
8299
+ */
8300
+ getOffset3DFromPlaneOffset(offset2D: object): Vector3D;
8301
+ /**
8302
+ * Increment the provided dimension.
8303
+ *
8304
+ * @param {number} dim The dimension to increment.
8305
+ * @param {boolean} [silent] Do not send event.
8306
+ * @returns {boolean} False if not in bounds.
8307
+ */
8308
+ incrementIndex(dim: number, silent?: boolean): boolean;
8309
+ /**
8310
+ * Decrement the provided dimension.
8311
+ *
8312
+ * @param {number} dim The dimension to increment.
8313
+ * @param {boolean} [silent] Do not send event.
8314
+ * @returns {boolean} False if not in bounds.
8315
+ */
8316
+ decrementIndex(dim: number, silent?: boolean): boolean;
8317
+ /**
8318
+ * Decrement the scroll dimension index.
8319
+ *
8320
+ * @param {boolean} [silent] Do not send event.
8321
+ * @returns {boolean} False if not in bounds.
8322
+ */
8323
+ decrementScrollIndex(silent?: boolean): boolean;
8324
+ /**
8325
+ * Increment the scroll dimension index.
8326
+ *
8327
+ * @param {boolean} [silent] Do not send event.
8328
+ * @returns {boolean} False if not in bounds.
8329
+ */
8330
+ incrementScrollIndex(silent?: boolean): boolean;
8331
+ /**
8332
+ * Scroll play: loop through all slices.
8333
+ */
8334
+ play(): void;
8335
+ /**
8336
+ * Stop scroll playing.
8337
+ */
8338
+ stop(): void;
8339
+ /**
8340
+ * Get the window/level.
8341
+ *
8342
+ * @returns {object} The window center and width.
8343
+ */
8344
+ getWindowLevel(): object;
8345
+ /**
8346
+ * Set the window/level.
8347
+ *
8348
+ * @param {number} wc The window center.
8349
+ * @param {number} ww The window width.
8350
+ */
8351
+ setWindowLevel(wc: number, ww: number): void;
8352
+ /**
8353
+ * Get the colour map.
8354
+ *
8355
+ * @returns {object} The colour map.
8356
+ */
8357
+ getColourMap(): object;
8358
+ /**
8359
+ * Set the colour map.
8360
+ *
8361
+ * @param {object} colourMap The colour map.
8362
+ */
8363
+ setColourMap(colourMap: object): void;
8364
+ /**
8365
+ * @callback alphaFn@callback alphaFn
8366
+ * @param {object} value The pixel value.
8367
+ * @param {object} index The values' index.
8368
+ * @returns {number} The value to display.
8369
+ */
8370
+ /**
8371
+ * Set the view per value alpha function.
8372
+ *
8373
+ * @param {alphaFn} func The function.
8374
+ */
8375
+ setViewAlphaFunction(func: (value: object, index: object) => number): void;
8376
+ /**
8377
+ * Set the colour map from a name.
8378
+ *
8379
+ * @param {string} name The name of the colour map to set.
8380
+ */
8381
+ setColourMapFromName(name: string): void;
8382
+ /**
8383
+ * Add an event listener to this class.
8384
+ *
8385
+ * @param {string} type The event type.
8386
+ * @param {object} callback The method associated with the provided
8387
+ * event type, will be called with the fired event.
8388
+ */
8389
+ addEventListener(type: string, callback: object): void;
8390
+ /**
8391
+ * Remove an event listener from this class.
8392
+ *
8393
+ * @param {string} type The event type.
8394
+ * @param {object} callback The method associated with the provided
8395
+ * event type.
8396
+ */
8397
+ removeEventListener(type: string, callback: object): void;
8398
+ #private;
8399
+ }
8400
+
7662
8401
  /**
7663
8402
  * View layer.
7664
8403
  */
@@ -7690,9 +8429,9 @@ export declare class ViewLayer {
7690
8429
  /**
7691
8430
  * Get the view controller.
7692
8431
  *
7693
- * @returns {object} The controller.
8432
+ * @returns {ViewController} The controller.
7694
8433
  */
7695
- getViewController(): object;
8434
+ getViewController(): ViewController;
7696
8435
  /**
7697
8436
  * Get the canvas image data.
7698
8437
  *
@@ -7885,4 +8624,133 @@ export declare class ViewLayer {
7885
8624
  #private;
7886
8625
  }
7887
8626
 
8627
+ /**
8628
+ * WindowLevel class.
8629
+ * <br>Pseudo-code:
8630
+ * <pre>
8631
+ * if (x &lt;= c - 0.5 - (w-1)/2), then y = ymin
8632
+ * else if (x > c - 0.5 + (w-1)/2), then y = ymax,
8633
+ * else y = ((x - (c - 0.5)) / (w-1) + 0.5) * (ymax - ymin) + ymin
8634
+ * </pre>
8635
+ *
8636
+ * @see DICOM doc for [Window Center and Window Width]{@link http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.11.html#sect_C.11.2.1.2}
8637
+ */
8638
+ export declare class WindowLevel {
8639
+ /**
8640
+ * @param {number} center The window center.
8641
+ * @param {number} width The window width.
8642
+ */
8643
+ constructor(center: number, width: number);
8644
+ /**
8645
+ * Get the window center.
8646
+ *
8647
+ * @returns {number} The window center.
8648
+ */
8649
+ getCenter(): number;
8650
+ /**
8651
+ * Get the window width.
8652
+ *
8653
+ * @returns {number} The window width.
8654
+ */
8655
+ getWidth(): number;
8656
+ /**
8657
+ * Set the output value range.
8658
+ *
8659
+ * @param {string} min The output value minimum.
8660
+ * @param {string} max The output value maximum.
8661
+ */
8662
+ setRange(min: string, max: string): void;
8663
+ /**
8664
+ * Set the signed offset.
8665
+ *
8666
+ * @param {number} offset The signed data offset,
8667
+ * typically: slope * ( size / 2).
8668
+ */
8669
+ setSignedOffset(offset: number): void;
8670
+ /**
8671
+ * Apply the window level on an input value.
8672
+ *
8673
+ * @param {number} value The value to rescale as an integer.
8674
+ * @returns {number} The leveled value, in the
8675
+ * [ymin, ymax] range (default [0,255]).
8676
+ */
8677
+ apply(value: number): number;
8678
+ /**
8679
+ * Check for window level equality.
8680
+ *
8681
+ * @param {WindowLevel} rhs The other window level to compare to.
8682
+ * @returns {boolean} True if both window level are equal.
8683
+ */
8684
+ equals(rhs: WindowLevel): boolean;
8685
+ /**
8686
+ * Get a string representation of the window level.
8687
+ *
8688
+ * @returns {string} The window level as a string.
8689
+ */
8690
+ toString(): string;
8691
+ #private;
8692
+ }
8693
+
8694
+ /**
8695
+ * Window LUT class.
8696
+ * Typically converts from float to integer.
8697
+ */
8698
+ export declare class WindowLut {
8699
+ /**
8700
+ * @param {RescaleLut} rescaleLut The associated rescale LUT.
8701
+ * @param {boolean} isSigned Flag to know if the data is signed or not.
8702
+ */
8703
+ constructor(rescaleLut: RescaleLut, isSigned: boolean);
8704
+ /**
8705
+ * Get the window / level.
8706
+ *
8707
+ * @returns {WindowLevel} The window / level.
8708
+ */
8709
+ getWindowLevel(): WindowLevel;
8710
+ /**
8711
+ * Get the signed flag.
8712
+ *
8713
+ * @returns {boolean} The signed flag.
8714
+ */
8715
+ isSigned(): boolean;
8716
+ /**
8717
+ * Get the rescale lut.
8718
+ *
8719
+ * @returns {RescaleLut} The rescale lut.
8720
+ */
8721
+ getRescaleLut(): RescaleLut;
8722
+ /**
8723
+ * Is the lut ready to use or not? If not, the user must
8724
+ * call 'update'.
8725
+ *
8726
+ * @returns {boolean} True if the lut is ready to use.
8727
+ */
8728
+ isReady(): boolean;
8729
+ /**
8730
+ * Set the window center and width.
8731
+ *
8732
+ * @param {WindowLevel} wl The window level.
8733
+ */
8734
+ setWindowLevel(wl: WindowLevel): void;
8735
+ /**
8736
+ * Update the lut if needed..
8737
+ */
8738
+ update(): void;
8739
+ /**
8740
+ * Get the length of the LUT array.
8741
+ *
8742
+ * @returns {number} The length of the LUT array.
8743
+ */
8744
+ getLength(): number;
8745
+ /**
8746
+ * Get the value of the LUT at the given offset.
8747
+ *
8748
+ * @param {number} offset The input offset in [0,2^bitsStored] range.
8749
+ * @returns {number} The integer value (default [0,255]) of the LUT
8750
+ * at the given offset.
8751
+ */
8752
+ getValue(offset: number): number;
8753
+ #private;
8754
+ }
8755
+
7888
8756
  export { }