dwv 0.37.0-beta.21 → 0.37.0-beta.22

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
@@ -1647,6 +1647,10 @@ export declare const defaultToolOptions: Record<string, Record<string, any>>;
1647
1647
  * Candidates flagged with `preLoad` are also used while loading
1648
1648
  * (see `getVolumeIdTagValue`): they must not vary between the
1649
1649
  * slices of a single volume.
1650
+ * Candidates either read an index (an id without unit, for example
1651
+ * TemporalPositionIdentifier) or a value (for example EchoTime).
1652
+ * The associated value of indices is guessed once all data is loaded
1653
+ * (see `getVolumeValues`), values have none.
1650
1654
  *
1651
1655
  * @type {VolumeIdCandidate[]}
1652
1656
  */
@@ -2788,10 +2792,10 @@ export declare class Geometry {
2788
2792
  * @param {Spacing} spacing The object spacing.
2789
2793
  * @param {Matrix33} [orientation] The object orientation (3*3 matrix,
2790
2794
  * default to 3*3 identity).
2791
- * @param {SourcedNumberValue} [time] Optional time: a volume id or, without
2792
- * source, a frame index (for example `{value: 2}`).
2795
+ * @param {VolumeId} [time] Optional time: a volume id or, without
2796
+ * source, a frame index (for example `{id: {value: 2}}`).
2793
2797
  */
2794
- constructor(origins: Point3D[], size: Size, spacing: Spacing, orientation?: Matrix33, time?: SourcedNumberValue);
2798
+ constructor(origins: Point3D[], size: Size, spacing: Spacing, orientation?: Matrix33, time?: VolumeId);
2795
2799
  /**
2796
2800
  * Clone the geometry.
2797
2801
  *
@@ -2801,40 +2805,60 @@ export declare class Geometry {
2801
2805
  /**
2802
2806
  * Get the time that was passed at construction.
2803
2807
  *
2804
- * @returns {SourcedNumberValue|undefined} The time.
2808
+ * @returns {VolumeId|undefined} The time.
2805
2809
  */
2806
- getInitialTime(): SourcedNumberValue | undefined;
2810
+ getInitialTime(): VolumeId | undefined;
2807
2811
  /**
2808
2812
  * Set the initial time.
2809
2813
  *
2810
- * @param {SourcedNumberValue} time The new time: a volume id or, without
2814
+ * @param {VolumeId} time The new time: a volume id or, without
2811
2815
  * source, a frame index.
2812
2816
  */
2813
- setInitialTime(time: SourcedNumberValue): void;
2817
+ setInitialTime(time: VolumeId): void;
2818
+ /**
2819
+ * Set the associated values of the volume ids, for example once
2820
+ * guessed after load (see dicomVolume getVolumeValues).
2821
+ *
2822
+ * @param {SourcedNumberValue[]} values The associated values, one per
2823
+ * volume id, in volume id order.
2824
+ * @throws {Error} If the number of values is not the number of
2825
+ * volume ids.
2826
+ */
2827
+ setVolumeValues(values: SourcedNumberValue[]): void;
2814
2828
  /**
2815
2829
  * Get the volume ids: the time of each volume, sorted by ascending
2816
- * value, the array index being the volume index. Times are volume
2817
- * ids if they have a source.
2830
+ * id, the array index being the volume index. Times are volume
2831
+ * ids if their id has a source.
2818
2832
  *
2819
- * @returns {SourcedNumberValue[]|undefined} The volume ids, undefined if the
2833
+ * @returns {VolumeId[]|undefined} The volume ids, undefined if the
2820
2834
  * times are not volume ids.
2821
2835
  */
2822
- getVolumeIds(): SourcedNumberValue[] | undefined;
2836
+ getVolumeIds(): VolumeId[] | undefined;
2823
2837
  /**
2824
2838
  * Set the volume ids of a geometry without times (for example a
2825
2839
  * resampled one): the volumes all have the current origins.
2826
2840
  *
2827
- * @param {SourcedNumberValue[]} volumeIds The volume ids, sorted by ascending
2828
- * value, one per volume (fourth dimension).
2841
+ * @param {VolumeId[]} volumeIds The volume ids, sorted by ascending
2842
+ * id, one per volume (fourth dimension).
2829
2843
  */
2830
- setVolumeIds(volumeIds: SourcedNumberValue[]): void;
2844
+ setVolumeIds(volumeIds: VolumeId[]): void;
2831
2845
  /**
2832
- * Get the index of a volume id value.
2846
+ * Get the index of a volume id.
2833
2847
  *
2834
- * @param {number} value The volume id value.
2848
+ * @param {number} id The volume id.
2835
2849
  * @returns {number} The volume index, -1 if not found.
2836
2850
  */
2837
- getVolumeIndex(value: number): number;
2851
+ getVolumeIndex(id: number): number;
2852
+ /**
2853
+ * Check if the volume of this geometry can follow the one of another
2854
+ * geometry: both volume ids have the same origin and the input
2855
+ * volume id value is one of this geometry.
2856
+ *
2857
+ * @param {Geometry} geometry The geometry to follow.
2858
+ * @param {number} value The volume id value to follow.
2859
+ * @returns {boolean} True if the volume can follow.
2860
+ */
2861
+ canSyncVolume(geometry: Geometry, value: number): boolean;
2838
2862
  /**
2839
2863
  * Get the total number of slices.
2840
2864
  * Can be different from what is stored in the size object
@@ -2846,7 +2870,7 @@ export declare class Geometry {
2846
2870
  /**
2847
2871
  * Check if a time point has associated slices.
2848
2872
  *
2849
- * @param {number} time The time value to check.
2873
+ * @param {number} time The time id to check.
2850
2874
  * @returns {boolean} True if slices are present.
2851
2875
  */
2852
2876
  hasSlicesAtTime(time: number): boolean;
@@ -2854,7 +2878,7 @@ export declare class Geometry {
2854
2878
  * Get the number of slices stored for time points preceding
2855
2879
  * the input one.
2856
2880
  *
2857
- * @param {number} time The time value to check.
2881
+ * @param {number} time The time id to check.
2858
2882
  * @returns {number|undefined} The count.
2859
2883
  */
2860
2884
  getCurrentNumberOfSlicesBeforeTime(time: number): number | undefined;
@@ -2952,7 +2976,7 @@ export declare class Geometry {
2952
2976
  * Point3D#getClosest) instead for that case.
2953
2977
  *
2954
2978
  * @param {Point3D} origin The origin to locate.
2955
- * @param {number} [time] Optional time value.
2979
+ * @param {number} [time] Optional time id.
2956
2980
  * @returns {number} The slice index.
2957
2981
  */
2958
2982
  getSliceIndex(origin: Point3D, time?: number): number;
@@ -2969,7 +2993,7 @@ export declare class Geometry {
2969
2993
  * Check if an origin can be appended to this geometry.
2970
2994
  *
2971
2995
  * @param {Point3D} origin The origin to append.
2972
- * @param {number} [time] Optional time value.
2996
+ * @param {number} [time] Optional time id.
2973
2997
  * @returns {BooleanResult} Result with success set to true if
2974
2998
  * the origin is compatible.
2975
2999
  */
@@ -2979,17 +3003,17 @@ export declare class Geometry {
2979
3003
  *
2980
3004
  * @param {Point3D} origin The origin to append.
2981
3005
  * @param {number} index The index at which to append.
2982
- * @param {number} [time] Optional time value.
3006
+ * @param {number} [time] Optional time id.
2983
3007
  */
2984
3008
  appendOrigin(origin: Point3D, index: number, time?: number): void;
2985
3009
  /**
2986
3010
  * Append a frame to the geometry.
2987
3011
  *
2988
3012
  * @param {Point3D} origin The origin to append.
2989
- * @param {SourcedNumberValue} time The frame time: a volume id or, without
3013
+ * @param {VolumeId} time The frame time: a volume id or, without
2990
3014
  * source, a frame index.
2991
3015
  */
2992
- appendFrame(origin: Point3D, time: SourcedNumberValue): void;
3016
+ appendFrame(origin: Point3D, time: VolumeId): void;
2993
3017
  /**
2994
3018
  * Get a string representation of the geometry.
2995
3019
  *
@@ -3757,11 +3781,11 @@ declare class Image_2 extends EventTarget {
3757
3781
  /**
3758
3782
  * Append a frame to the image.
3759
3783
  *
3760
- * @param {SourcedNumberValue} time The frame time: a volume id or, without
3784
+ * @param {VolumeId} time The frame time: a volume id or, without
3761
3785
  * source, a frame index.
3762
3786
  * @param {Point3D} origin The origin of the frame.
3763
3787
  */
3764
- appendFrame(time: SourcedNumberValue, origin: Point3D): void;
3788
+ appendFrame(time: VolumeId, origin: Point3D): void;
3765
3789
  /**
3766
3790
  * Get the data range.
3767
3791
  *
@@ -6855,16 +6879,27 @@ export declare class Size {
6855
6879
  }
6856
6880
 
6857
6881
  /**
6858
- * Number value with its source, as for example a volume id: the value
6859
- * of the volume (fourth dimension) index, for example
6860
- * `{source: 'EchoTime', value: 4.6, tagKey: '00180081', unit: 'unit.ms'}`.
6861
- * A number value with:
6862
- * - source: the name of the value source, for example the volume id
6863
- * candidate that produced it,
6864
- * - tagKey: the key of the DICOM tag the value is read from.
6882
+ * Number value and its unit, with its source, for example
6883
+ * `{value: 4.6, unit: 'unit.ms', source: 'EchoTime', tagKey: '00180081'}`.
6865
6884
  */
6866
- export declare type SourcedNumberValue = NumberValue & {
6885
+ export declare type SourcedNumberValue = {
6886
+ /**
6887
+ * The value.
6888
+ */
6889
+ value: number;
6890
+ /**
6891
+ * The value unit, see NumberValue.
6892
+ */
6893
+ unit?: string;
6894
+ /**
6895
+ * The name of the value source, for
6896
+ * example the volume id candidate that produced it.
6897
+ */
6867
6898
  source?: string;
6899
+ /**
6900
+ * The key of the DICOM tag the value is
6901
+ * read from.
6902
+ */
6868
6903
  tagKey?: string;
6869
6904
  };
6870
6905
 
@@ -8179,6 +8214,14 @@ export declare class ViewController {
8179
8214
  * @returns {Index} The current index.
8180
8215
  */
8181
8216
  getCurrentIndex(): Index;
8217
+ /**
8218
+ * Check if the volume of this view can follow the one of another view.
8219
+ *
8220
+ * @param {ViewController} viewController The view controller to follow.
8221
+ * @param {number} value The volume id value to follow.
8222
+ * @returns {boolean} True if the volume can follow.
8223
+ */
8224
+ canSyncVolume(viewController: ViewController, value: number): boolean;
8182
8225
  /**
8183
8226
  * Get the SOP image UID of the current image.
8184
8227
  *
@@ -8913,6 +8956,30 @@ export declare class ViewLayer {
8913
8956
  #private;
8914
8957
  }
8915
8958
 
8959
+ /**
8960
+ * Volume id: the id of a volume (fourth dimension index) and an
8961
+ * optional associated value, for example
8962
+ * `{id: {value: 2, source: 'TemporalPositionIdentifier',
8963
+ * tagKey: '00200100'}, value: {value: 10, unit: 'unit.s',
8964
+ * source: 'AcquisitionTime', tagKey: '00080032'}}`.
8965
+ * Only the id is reliable: it groups, orders and locates the volumes
8966
+ * (it is the fourth dimension world coordinate). The associated value
8967
+ * is informative, for example the acquisition time of the volumes of
8968
+ * a temporal position identifier. Ids that are values (for example
8969
+ * an echo time) usually do not have one. Without source, the id is
8970
+ * a frame index (for example `{id: {value: 2}}`).
8971
+ */
8972
+ export declare type VolumeId = {
8973
+ /**
8974
+ * The volume id.
8975
+ */
8976
+ id: SourcedNumberValue;
8977
+ /**
8978
+ * The associated value.
8979
+ */
8980
+ value?: SourcedNumberValue;
8981
+ };
8982
+
8916
8983
  /**
8917
8984
  * Volume id candidate getter.
8918
8985
  */
@@ -8923,8 +8990,11 @@ export declare type VolumeIdCandidate = {
8923
8990
  name: string;
8924
8991
  /**
8925
8992
  * The volume id getter:
8926
- * `(elements) => SourcedNumberValue|undefined`, the returned volume id
8927
- * does not need a source (the candidate name is used).
8993
+ * `(elements) => SourcedNumberValue|undefined`, the returned id
8994
+ * does not need a source (the candidate name is used), for
8995
+ * example `{value: 4.6, unit: 'unit.ms', tagKey: '00180081'}`.
8996
+ * An id without unit is an index: its associated value is guessed
8997
+ * once all data is loaded.
8928
8998
  */
8929
8999
  getter: Function;
8930
9000
  /**
@@ -8933,10 +9003,9 @@ export declare type VolumeIdCandidate = {
8933
9003
  */
8934
9004
  preLoad?: boolean;
8935
9005
  /**
8936
- * Flag to make the volume id values
8937
- * relative to the smallest one, for example to get times since
8938
- * the first acquisition instead of timestamps. Not applied while
8939
- * loading.
9006
+ * Flag to display the ids relative to
9007
+ * the smallest one, for example to get times since the first
9008
+ * acquisition instead of timestamps. Not applied to the ids.
8940
9009
  */
8941
9010
  relative?: boolean;
8942
9011
  };
@@ -8946,10 +9015,11 @@ export declare type VolumeIdCandidate = {
8946
9015
  */
8947
9016
  export declare type VolumeValue = {
8948
9017
  /**
8949
- * The volume id: with name and unit
8950
- * if the image has volume ids, else just the volume index.
9018
+ * The volume id: with source and
9019
+ * possible associated value if the image has volume ids, else just
9020
+ * the volume index as id.
8951
9021
  */
8952
- volumeId: SourcedNumberValue;
9022
+ volumeId: VolumeId;
8953
9023
  /**
8954
9024
  * The rescaled pixel value and its unit.
8955
9025
  */