dwv 0.32.2-beta.1 → 0.32.3

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
@@ -18,9 +18,9 @@ export declare function addTagsToDictionary(group: string, tags: object): void;
18
18
  * // create the dwv app
19
19
  * const app = new dwv.App();
20
20
  * // initialise
21
- * const viewConfig0 = new ViewConfig('layerGroup0');
21
+ * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
22
22
  * const viewConfigs = {'*': [viewConfig0]};
23
- * const options = new AppOptions(viewConfigs);
23
+ * const options = new dwv.AppOptions(viewConfigs);
24
24
  * app.init(options);
25
25
  * // load dicom data
26
26
  * app.loadURLs([
@@ -108,9 +108,9 @@ export declare class App {
108
108
  /**
109
109
  * Get the toolbox controller.
110
110
  *
111
- * @returns {object} The controller.
111
+ * @returns {ToolboxController} The controller.
112
112
  */
113
- getToolboxController(): object;
113
+ getToolboxController(): ToolboxController;
114
114
  /**
115
115
  * Get the active layer group.
116
116
  * The layer is available after the first loaded item.
@@ -123,17 +123,17 @@ export declare class App {
123
123
  * The layer are available after the first loaded item.
124
124
  *
125
125
  * @param {number} index The data index.
126
- * @returns {Array} The layers.
126
+ * @returns {ViewLayer[]} The layers.
127
127
  */
128
- getViewLayersByDataIndex(index: number): any[];
128
+ getViewLayersByDataIndex(index: number): ViewLayer[];
129
129
  /**
130
130
  * Get the draw layers associated to a data index.
131
131
  * The layer are available after the first loaded item.
132
132
  *
133
133
  * @param {number} index The data index.
134
- * @returns {Array} The layers.
134
+ * @returns {DrawLayer[]} The layers.
135
135
  */
136
- getDrawLayersByDataIndex(index: number): any[];
136
+ getDrawLayersByDataIndex(index: number): DrawLayer[];
137
137
  /**
138
138
  * Get a layer group by div id.
139
139
  * The layer is available after the first loaded item.
@@ -170,9 +170,9 @@ export declare class App {
170
170
  * // create the dwv app
171
171
  * const app = new dwv.App();
172
172
  * // initialise
173
- * const viewConfig0 = new ViewConfig('layerGroup0');
173
+ * const viewConfig0 = new dwv.ViewConfig('layerGroup0');
174
174
  * const viewConfigs = {'*': [viewConfig0]};
175
- * const options = new AppOptions(viewConfigs);
175
+ * const options = new dwv.AppOptions(viewConfigs);
176
176
  * options.viewOnFirstLoadItem = false;
177
177
  * app.init(options);
178
178
  * // render button
@@ -466,11 +466,11 @@ export declare class AppOptions {
466
466
  /**
467
467
  * Tool name indexed object containing individual tool configurations.
468
468
  *
469
- * @type {Object<string, ToolConfig>}
469
+ * @type {Object<string, ToolConfig>|undefined}
470
470
  */
471
471
  tools: {
472
472
  [x: string]: ToolConfig;
473
- };
473
+ } | undefined;
474
474
  /**
475
475
  * Optional array of layerGroup binder names.
476
476
  *
@@ -511,6 +511,12 @@ export declare function buildMultipart(parts: any[], boundary: string): Uint8Arr
511
511
  * to associate with intensity values.
512
512
  */
513
513
  export declare class ColourMap {
514
+ /**
515
+ * @param {number[]} red Red component.
516
+ * @param {number[]} green Green component.
517
+ * @param {number[]} blue Blue component.
518
+ */
519
+ constructor(red: number[], green: number[], blue: number[]);
514
520
  /**
515
521
  * Red component: 256 values in the [0, 255] range.
516
522
  *
@@ -715,18 +721,24 @@ export declare class DicomParser {
715
721
  * DICOM writer.
716
722
  *
717
723
  * @example
724
+ * // add link to html
725
+ * const link = document.createElement("a");
726
+ * link.appendChild(document.createTextNode("download"));
727
+ * const div = document.getElementById("dwv");
728
+ * div.appendChild(link);
718
729
  * // XMLHttpRequest onload callback
719
730
  * const onload = function (event) {
720
- * const parser = new DicomParser();
731
+ * const parser = new dwv.DicomParser();
721
732
  * parser.parse(event.target.response);
722
- * // create writer with parser data elements
723
- * const writer = new DicomWriter(parser.getDicomElements());
724
- * // create modified buffer and put it in a Blol
725
- * const blob = new Blob([writer.getBuffer()], {type: 'application/dicom'});
726
- * // example download link
727
- * const element = document.getElementById("download");
728
- * element.href = URL.createObjectURL(blob);
729
- * element.download = "anonym.dcm";
733
+ * // create writer
734
+ * const writer = new dwv.DicomWriter();
735
+ * // get buffer using default rules
736
+ * const dicomBuffer = writer.getBuffer(parser.getDicomElements());
737
+ * // create blob
738
+ * const blob = new Blob([dicomBuffer], {type: 'application/dicom'});
739
+ * // add blob to download link
740
+ * link.href = URL.createObjectURL(blob);
741
+ * link.download = "anonym.dcm";
730
742
  * };
731
743
  * // DICOM file request
732
744
  * const request = new XMLHttpRequest();
@@ -858,9 +870,9 @@ export declare class DrawLayer {
858
870
  * Set the layer scale.
859
871
  *
860
872
  * @param {object} newScale The scale as {x,y}.
861
- * @param {Point3D} center The scale center.
873
+ * @param {Point3D} [center] The scale center.
862
874
  */
863
- setScale(newScale: object, center: Point3D): void;
875
+ setScale(newScale: object, center?: Point3D): void;
864
876
  /**
865
877
  * Set the layer offset.
866
878
  *
@@ -921,7 +933,7 @@ export declare class DrawLayer {
921
933
  * @param {string} id The id of the group.
922
934
  * @returns {boolean} False if the group cannot be found.
923
935
  */
924
- toogleGroupVisibility(id: string): boolean;
936
+ toggleGroupVisibility(id: string): boolean;
925
937
  /**
926
938
  * Delete a Draw from the stage.
927
939
  *
@@ -2666,6 +2678,67 @@ export declare class TagValueExtractor {
2666
2678
  }): number | undefined;
2667
2679
  }
2668
2680
 
2681
+ /**
2682
+ * Toolbox controller.
2683
+ */
2684
+ export declare class ToolboxController {
2685
+ /**
2686
+ * @param {object} toolList The list of tool objects.
2687
+ */
2688
+ constructor(toolList: object);
2689
+ /**
2690
+ * Initialise.
2691
+ */
2692
+ init(): void;
2693
+ /**
2694
+ * Get the tool list.
2695
+ *
2696
+ * @returns {Array} The list of tool objects.
2697
+ */
2698
+ getToolList(): any[];
2699
+ /**
2700
+ * Check if a tool is in the tool list.
2701
+ *
2702
+ * @param {string} name The name to check.
2703
+ * @returns {boolean} The tool list element for the given name.
2704
+ */
2705
+ hasTool(name: string): boolean;
2706
+ /**
2707
+ * Get the selected tool.
2708
+ *
2709
+ * @returns {object} The selected tool.
2710
+ */
2711
+ getSelectedTool(): object;
2712
+ /**
2713
+ * Get the selected tool event handler.
2714
+ *
2715
+ * @param {string} eventType The event type, for example
2716
+ * mousedown, touchstart...
2717
+ * @returns {Function} The event handler.
2718
+ */
2719
+ getSelectedToolEventHandler(eventType: string): Function;
2720
+ /**
2721
+ * Set the selected tool.
2722
+ *
2723
+ * @param {string} name The name of the tool.
2724
+ */
2725
+ setSelectedTool(name: string): void;
2726
+ /**
2727
+ * Set the selected tool live features.
2728
+ *
2729
+ * @param {object} list The list of features.
2730
+ */
2731
+ setToolFeatures(list: object): void;
2732
+ /**
2733
+ * Listen to layer interaction events.
2734
+ *
2735
+ * @param {object} layer The layer to listen to.
2736
+ * @param {string} layerGroupDivId The associated layer group div id.
2737
+ */
2738
+ bindLayer(layer: object, layerGroupDivId: string): void;
2739
+ #private;
2740
+ }
2741
+
2669
2742
  /**
2670
2743
  * Tool configuration.
2671
2744
  */
@@ -2765,9 +2838,9 @@ export declare class Vector3D {
2765
2838
  * const dicomParser = new dwv.DicomParser();
2766
2839
  * dicomParser.parse(event.target.response);
2767
2840
  * // create the image object
2768
- * const image = createImage(dicomParser.getDicomElements());
2841
+ * const image = dwv.createImage(dicomParser.getDicomElements());
2769
2842
  * // create the view
2770
- * const view = createView(dicomParser.getDicomElements(), image);
2843
+ * const view = dwv.createView(dicomParser.getDicomElements(), image);
2771
2844
  * // setup canvas
2772
2845
  * const canvas = document.createElement('canvas');
2773
2846
  * canvas.width = 256;
@@ -3552,9 +3625,9 @@ export declare class ViewLayer {
3552
3625
  * Set the layer scale.
3553
3626
  *
3554
3627
  * @param {object} newScale The scale as {x,y}.
3555
- * @param {Point3D} center The scale center.
3628
+ * @param {Point3D} [center] The scale center.
3556
3629
  */
3557
- setScale(newScale: object, center: Point3D): void;
3630
+ setScale(newScale: object, center?: Point3D): void;
3558
3631
  /**
3559
3632
  * Set the base layer offset. Updates the layer offset.
3560
3633
  *
@@ -3817,6 +3890,10 @@ export declare class WindowLut {
3817
3890
  * Writer rule.
3818
3891
  */
3819
3892
  export declare class WriterRule {
3893
+ /**
3894
+ * @param {string} action The rule action.
3895
+ */
3896
+ constructor(action: string);
3820
3897
  /**
3821
3898
  * Rule action: `copy`, `remove`, `clear` or `replace`.
3822
3899
  *
@@ -3824,11 +3901,11 @@ export declare class WriterRule {
3824
3901
  */
3825
3902
  action: string;
3826
3903
  /**
3827
- * Value to use for replace action.
3904
+ * Optional value to use for replace action.
3828
3905
  *
3829
- * @type {any}
3906
+ * @type {any|undefined}
3830
3907
  */
3831
- value: any;
3908
+ value: any | undefined;
3832
3909
  }
3833
3910
 
3834
3911
  export { }