dcmnorm 0.15.1 → 0.17.0

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 (4) hide show
  1. package/README.md +94 -5
  2. package/index.d.ts +277 -7
  3. package/index.js +61 -56
  4. package/package.json +7 -7
package/README.md CHANGED
@@ -165,15 +165,23 @@ const { width, height, channels, pixels } = await renderPixels("in.dcm", 0, { wi
165
165
 
166
166
  - `buildVolume(filePaths: string[]): Promise<DicomVolumeHandle>` — reads and decodes every slice
167
167
  of a parallel stack (e.g. one CT/MR/PT series), spatially re-sorted by `ImagePositionPatient`
168
- regardless of input order. Rejects fewer than 2 files, mismatched Rows/Columns, or a
169
- non-parallel/gantry-tilt-inconsistent stack. This is the expensive step — build once per series
170
- and keep the returned handle resident (e.g. in a volume cache) so every subsequent `reformat()`
171
- call is cheap.
168
+ regardless of input order.
169
+ - Enhanced multi-frame objects work too: a single Enhanced CT/MR/PET file is a whole volume.
170
+ Each frame's Plane Position, Plane Orientation and Pixel Measures functional groups and its
171
+ own rescale are used. Frames that repeat a position are skipped (later temporal positions or
172
+ echoes): the first in file and frame order is kept.
173
+ - A gantry-tilted stack, whose slice origins drift within the slice plane, is desheared onto an
174
+ orthogonal grid that covers every slice. `rows`/`cols` can then exceed the source images.
175
+ - Rejects fewer than 2 slices, mismatched Rows/Columns, or a non-parallel stack.
176
+ - This is the expensive step. Build once per series and keep the returned handle resident (e.g.
177
+ in a volume cache), so every later `reformat()` call is cheap.
172
178
  - `DicomVolumeHandle` — an opaque, read-only handle around the built volume:
173
179
  - getters: `rows`, `cols`, `numSlices`, `nativeBasis` (`[rowDir(3), colDir(3)]`, the volume's own
174
180
  acquisition-native orientation — a reasonable seed for an "axial" reformat), `center`
175
181
  (`[x,y,z]` LPS mm, the volume's physical center), `minSpacingMm` (its smallest voxel
176
- dimension, a reasonable default output spacing)
182
+ dimension, a reasonable default output spacing), `modality`, `frameOfReferenceUid`,
183
+ `seriesInstanceUid`, `studyInstanceUid` (from the files, or `null`), `gantryTiltDeg`,
184
+ `desheared`, `irregularSpacing`, `voxelToPatient` (row-major 4x4, `(col, row, slice, 1)` to LPS mm)
177
185
  - `reformat(options): Promise<RenderedFrame>` — resamples one plane through the volume and
178
186
  encodes it exactly like `renderFrame`'s output shape, so callers reuse their existing
179
187
  image-display code path. `options`: `{ origin: number[3], rowDir: number[3], colDir: number[3],
@@ -185,6 +193,87 @@ const { width, height, channels, pixels } = await renderPixels("in.dcm", 0, { wi
185
193
  - `exportTexture(options?): Promise<TextureExportResult>` — see
186
194
  [Texture export](#texture-export) below.
187
195
 
196
+ ### Registration
197
+
198
+ Every matrix is 16 numbers, row-major, mapping MOVING patient LPS mm to FIXED patient LPS mm
199
+ (`p_fixed = M * [x, y, z, 1]`). That is the DICOM Spatial Registration convention, with the item's
200
+ Frame of Reference the moving one and the REG's own the fixed one, so a result goes into
201
+ `writeSpatialRegistration` unchanged. Volumes are `buildVolume` handles. The algorithm is described
202
+ in [the CLI docs](../../docs/cli.md#register-two-volumes).
203
+
204
+ - `registerVolumes(fixed, moving, options?, cancel?: RegistrationCancelToken): Promise<RegistrationResult>`
205
+ - What it does: rigid 6-DOF registration of any CT/MR/PT pairing.
206
+ - `options`:
207
+ - `metric` (`'auto'` | `'ncc'` | `'mattes-mi'`)
208
+ - `fixedModality` / `movingModality`: override the files' Modality
209
+ - `initialMatrix` (number[16]): a starting moving -> fixed transform
210
+ - `initialize` (`'translation'` default | `'centroid'` | `'none'` | `'multi'`): used without
211
+ `initialMatrix`, except `'multi'`: several starts (the `initialMatrix` and `starts` given,
212
+ the translation estimate, the body centroids, identity), the best plausible one refined
213
+ - `starts` (number[16][]): extra starting matrices; implies `'multi'`
214
+ - `maxRotationDeg` (default 30; 0 for no limit): a larger rotation is `'poor'`, `plausible: false`
215
+ - `levelsMm` (default `[8, 4, 2]`)
216
+ - `maxIterations` (per level, default 40)
217
+ - `timeLimitMs` (default 30000)
218
+ - `mask` (`'auto'` | `'none'`)
219
+ - `roiMinMm` / `roiMaxMm`: a box in fixed patient coordinates
220
+ - `histogramBins` (32), `maxSamples` (100000), `maxMemoryBytes` (256 MiB; a level that would
221
+ exceed it is coarsened)
222
+ - Result fields:
223
+ - `matrix`, `rotationDeg` and `translationMm` (of the matrix), `centerMm`
224
+ - `metric`, `metricValue`, `initialMetricValue`, `normalizedMetric`, `overlapFraction`
225
+ - `quality` (0..1) and `qualityLabel` (`'good'` | `'fair'` | `'poor'`), from `bodyMetric` (the
226
+ metric where both bodies are, so FOV truncation and cropping don't count against it) and
227
+ `bodyOverlapFraction`, lowered when the result isn't a local optimum
228
+ - `rotationAngleDeg`, `plausible`
229
+ - multi-start: `consistent` (another start converged within 3 mm; absent for one start) and
230
+ `starts[]`: `start` (`'matrix'` | `'translation'` | `'centroid'` | `'none'` | `'start-<n>'`),
231
+ `matrix`, `normalizedMetric`, `quality`, `qualityLabel`, `rotationAngleDeg`, `plausible`,
232
+ `agrees`, `refined`
233
+ - `iterations`, `metricEvaluations`, `levels[]`, `initialization`
234
+ - `converged`, `stopReason` (`'converged'` | `'max-iterations'` | `'time-limit'`)
235
+ - `timingMs`, `workingBytes`
236
+ - Rejects when a volume was released, when there are no body voxels or no overlap, on invalid
237
+ options, and when cancelled (the message starts "registration cancelled"). Results are
238
+ deterministic across runs and thread counts.
239
+ - `new RegistrationCancelToken()`: `.cancel()`, `.cancelled`.
240
+ - `estimateTranslation(fixed, moving, options?): Promise<TranslationEstimate>`
241
+ - What it does: the fast translation-only estimate, which also seeds `registerVolumes`.
242
+ - `options`: `fixedModality`, `movingModality`, `minOverlapMm` (60), `maxShiftMm`,
243
+ `minOverlapFraction` (0.4: the smallest overlap is 40% of the shorter scan, 20 to
244
+ `minOverlapMm`; when only `minOverlapMm` is given it is used exactly; 0 turns it off).
245
+ - Result: `matrix`, `translationMm`, `confidence` (0..1, calibrated so wrong answers stay below
246
+ 0.3; below that, fall back to capture-on-link), `peakCorrelation`, `secondPeakCorrelation`,
247
+ `overlapMm`, `profiles`, `channelAgreement`, `xyCorrelation`, `minOverlapMm`, `timingMs`.
248
+ - `readSpatialRegistration(filePath): Promise<string>`
249
+ - What it does: a Spatial Registration object (`.66.1`, or the pre/post matrices of a
250
+ Deformable `.66.3`) as a JSON string.
251
+ - Top-level fields: `frameOfReferenceUid` (the REG's own registered frame), the SOP, series,
252
+ study and patient identifiers, `contentLabel`, `contentDate`, `deformable`.
253
+ - `registrations[]`: `frameOfReferenceUid`, `matrix` (the item frame -> REG frame, composed over
254
+ its Matrix Sequence in order), `matrixType`, `matrices[]`, `registrationType`, `comment`,
255
+ `referencedImages[]`, `isIdentity`.
256
+ - Also `referencedSeries[]` (the Common Instance Reference) and `warnings[]` (IOD problems).
257
+ - Rejects any other SOP Class.
258
+ - `writeSpatialRegistration(specJson: string, outputPath?): Promise<{ json, dataset, sopInstanceUid, seriesInstanceUid, data? }>`
259
+ - What it does: builds a conformant REG in the fixed study. Item 1 holds the fixed Frame of
260
+ Reference with the identity, item 2 the moving one with `matrix`.
261
+ - Spec fields:
262
+ - `matrix`, `matrixType` (`'RIGID'` default, validated orthonormal; `'RIGID_SCALE'`; `'AFFINE'`)
263
+ - `registrationType` (`'auto'` → DCM 125024 | `'manual'` → 125025 | `'identity'` → 125021)
264
+ - `fixed` / `moving`: `{ frameOfReferenceUid, studyInstanceUid, seriesInstanceUid, instances?: [{ sopClassUid, sopInstanceUid }] }`
265
+ - `copyPatientStudyFrom`: a path to one fixed-study file
266
+ - `patient` / `study` overrides
267
+ - `sopInstanceUid`, `seriesInstanceUid` (generated when omitted), `seriesNumber` (9902),
268
+ `seriesDescription`, `instanceNumber`, `contentLabel`, `contentDescription`,
269
+ `contentCreatorName`, `manufacturer`, `comment`
270
+ - Returns:
271
+ - `json`: the object in `readSpatialRegistration`'s form
272
+ - `dataset`: standard PS3.18 DICOM JSON, ready for `writeJson`
273
+ - `data`: the Part 10 bytes, when `outputPath` is omitted
274
+ - Rejects specs that would not make a conformant object, for example fixed and moving in one
275
+ Frame of Reference, or a non-rigid `'RIGID'` matrix.
276
+
188
277
  ### Texture export
189
278
 
190
279
  Packs a volume, a single frame, or several independent frames as a lossless, GPU-upload-ready
package/index.d.ts CHANGED
@@ -20,9 +20,12 @@ export declare class DicomServerHandle {
20
20
  }
21
21
 
22
22
  export declare class DicomVolumeHandle {
23
- /** Rows in the source slices (image height). */
23
+ /**
24
+ * Rows of the volume's slice grid (image height). The source images' Rows, except for a
25
+ * desheared (gantry-tilted) stack, whose grid covers every slice's footprint.
26
+ */
24
27
  get rows(): number
25
- /** Columns in the source slices (image width). */
28
+ /** Columns of the volume's slice grid (image width); see `rows`. */
26
29
  get cols(): number
27
30
  /** Number of slices in the built volume. */
28
31
  get numSlices(): number
@@ -48,6 +51,31 @@ export declare class DicomVolumeHandle {
48
51
  get center(): Array<number>
49
52
  /** The volume's own smallest voxel dimension, in mm - a reasonable default output spacing. */
50
53
  get minSpacingMm(): number
54
+ /** `Modality` of the source images (`CT`, `MR`, `PT`, ...), or `null`. */
55
+ get modality(): string | null
56
+ /** `FrameOfReferenceUID` of the source images, or `null`. */
57
+ get frameOfReferenceUid(): string | null
58
+ /** `SeriesInstanceUID` of the source images, or `null`. */
59
+ get seriesInstanceUid(): string | null
60
+ /** `StudyInstanceUID` of the source images, or `null`. */
61
+ get studyInstanceUid(): string | null
62
+ /**
63
+ * Gantry tilt of the acquisition, degrees: the angle between the slice-to-slice position
64
+ * step and the slice normal. `0` for an ordinary stack.
65
+ */
66
+ get gantryTiltDeg(): number
67
+ /** Whether the stack was sheared (gantry tilt) and resampled onto an orthogonal grid. */
68
+ get desheared(): boolean
69
+ /**
70
+ * Whether the slice gaps are irregular (a missing slice, variable pitch). Reformats
71
+ * interpolate by real position either way; `exportTexture` resamples to a uniform lattice.
72
+ */
73
+ get irregularSpacing(): boolean
74
+ /**
75
+ * Row-major 4x4 matrix from voxel index `(col, row, slice, 1)` to patient LPS mm (slice
76
+ * axis at the nominal uniform spacing).
77
+ */
78
+ get voxelToPatient(): Array<number>
51
79
  /**
52
80
  * Resamples one plane through this volume and encodes it exactly like a normal 2D render
53
81
  * (same `RenderedFrame` shape `renderFrame` returns), so callers can reuse their existing
@@ -117,6 +145,16 @@ export declare class MoveScuHandle {
117
145
  abort(): Promise<MoveScuResult>
118
146
  }
119
147
 
148
+ /**
149
+ * Cancels a running `registerVolumes`: pass it as the 4th argument and call `cancel()`; the
150
+ * registration rejects with "registration cancelled" at its next metric evaluation.
151
+ */
152
+ export declare class RegistrationCancelToken {
153
+ constructor()
154
+ cancel(): void
155
+ get cancelled(): boolean
156
+ }
157
+
120
158
  export declare class StoreScuHandle {
121
159
  /**
122
160
  * The eventual per-file `{sopInstanceUid, status}` results, without requesting
@@ -137,11 +175,13 @@ export declare class StoreScuHandle {
137
175
 
138
176
  /**
139
177
  * Builds a 3D volume from a parallel stack of DICOM slice files (e.g. every image instance in
140
- * one CT/MR/PT series) sharing consistent `ImageOrientationPatient`. Slices are spatially
141
- * re-sorted internally by `ImagePositionPatient`, regardless of `filePaths`' own order. Returns a
142
- * `DicomVolumeHandle` for repeated `reformat()` calls. Rejects (rather than silently
143
- * mis-rendering) fewer than 2 files, mismatched Rows/Columns, or a non-parallel/gantry-tilt-
144
- * inconsistent stack.
178
+ * one CT/MR/PT series) sharing consistent `ImageOrientationPatient`, or from Enhanced
179
+ * multi-frame objects (one Enhanced CT/MR/PET file is enough; per-frame positions and rescale
180
+ * are honoured). Slices are spatially re-sorted internally by `ImagePositionPatient`,
181
+ * regardless of `filePaths`' own order; a gantry-tilted stack is desheared onto an orthogonal
182
+ * grid. Returns a `DicomVolumeHandle` for repeated `reformat()` calls. Rejects (rather than
183
+ * silently mis-rendering) fewer than 2 slices, mismatched Rows/Columns, or a non-parallel
184
+ * stack.
145
185
  */
146
186
  export declare function buildVolume(filePaths: Array<string>): Promise<unknown>
147
187
 
@@ -263,6 +303,35 @@ export interface EditTagsOptions {
263
303
  removePrivateTags?: boolean
264
304
  }
265
305
 
306
+ /**
307
+ * A fast moving -> fixed translation: the S-I shift from cross-correlating per-height profiles
308
+ * (body area; plus lung and bone area for CT-CT, integrated intensity for MR-MR / PT-PT) over
309
+ * the two scans' common in-plane support (so a smaller reconstruction FOV does not skew them),
310
+ * short end overlaps down-weighted; the in-plane shift from a masked correlation of their axial
311
+ * projections over the matched overlap. Works for any acquisition orientation. About 100-300 ms.
312
+ */
313
+ export declare function estimateTranslation(fixed: DicomVolumeHandle, moving: DicomVolumeHandle, options?: EstimateTranslationOptions | undefined | null): Promise<unknown>
314
+
315
+ export interface EstimateTranslationOptions {
316
+ /** Overrides the fixed volume's Modality ('CT', 'MR', 'PT', ...). */
317
+ fixedModality?: string
318
+ /** Overrides the moving volume's Modality. */
319
+ movingModality?: string
320
+ /**
321
+ * Smallest S-I overlap of the two scans a z shift may imply, mm (default 60, an upper
322
+ * bound under `minOverlapFraction`). Given alone, it is used exactly.
323
+ */
324
+ minOverlapMm?: number
325
+ /** Largest |z shift| considered, mm (default: anything with enough overlap). */
326
+ maxShiftMm?: number
327
+ /**
328
+ * The smallest overlap is `min(minOverlapMm, max(fraction x the shorter scan's S-I extent,
329
+ * 20 mm))`, so short slabs (an 80 mm prostate or head MR) can be matched. Default 0.4 when
330
+ * `minOverlapMm` is not given either; 0 turns it off.
331
+ */
332
+ minOverlapFraction?: number
333
+ }
334
+
266
335
  /**
267
336
  * Packs several independent frames (from one or more files) as one texture-array upload - see
268
337
  * `dcmnorm::dicom_io::pack_frame_stack_texture`'s own doc for the full contract (no resampling,
@@ -568,6 +637,16 @@ export interface ReadJsonOptions {
568
637
  omitKeywordVm?: boolean
569
638
  }
570
639
 
640
+ /**
641
+ * Reads a DICOM Spatial Registration object (1.2.840.10008.5.1.4.1.1.66.1; for a Deformable
642
+ * one, .66.3, only its pre/post-deformation matrices) and resolves with its JSON form as a
643
+ * string: the REG's own (registered) Frame of Reference, one entry per Registration Sequence
644
+ * item with its Frame of Reference, the composed item -> REG matrix (row-major), its type and
645
+ * referenced images, the Common Instance Reference series, and `warnings` (IOD problems).
646
+ * Rejects anything that is not a registration object.
647
+ */
648
+ export declare function readSpatialRegistration(filePath: string): Promise<unknown>
649
+
571
650
  export declare function readTags(filePath: string, tags: Array<string>): Promise<unknown>
572
651
 
573
652
  export interface ReformatPlaneOptions {
@@ -603,6 +682,140 @@ export interface ReformatPlaneOptions {
603
682
  slabProjection?: string
604
683
  }
605
684
 
685
+ /**
686
+ * Rigid (6-DOF) registration of `moving` onto `fixed`, any CT / MR / PT pairing: a multi-
687
+ * resolution pyramid, modality-aware body masks (CT table removed), NCC for the same modality
688
+ * and Mattes mutual information across modalities, Powell's optimizer. Deterministic, bounded
689
+ * by `maxMemoryBytes` and `timeLimitMs`, cancellable through `cancel`. Resolves with the
690
+ * moving -> fixed patient matrix, the metric, a quality score and timing; rejects when the
691
+ * volumes have no body or do not overlap, on invalid options, or when cancelled.
692
+ */
693
+ export declare function registerVolumes(fixed: DicomVolumeHandle, moving: DicomVolumeHandle, options?: RegisterVolumesOptions | undefined | null, cancel?: RegistrationCancelToken | undefined | null): Promise<unknown>
694
+
695
+ export interface RegisterVolumesOptions {
696
+ /**
697
+ * 'auto' (default: 'ncc' for the same modality, 'mattes-mi' across modalities), 'ncc' or
698
+ * 'mattes-mi'.
699
+ */
700
+ metric?: string
701
+ fixedModality?: string
702
+ movingModality?: string
703
+ /** Starting moving -> fixed transform (16 numbers, row-major), e.g. the viewer's translation. */
704
+ initialMatrix?: Array<number>
705
+ /**
706
+ * Without `initialMatrix`: 'translation' (default; estimateTranslation, then the mask
707
+ * centroids when it is not confident), 'centroid' or 'none'. 'multi': several starts (the
708
+ * `initialMatrix` and `starts` given, the translation estimate, the mask centroids, identity),
709
+ * the best plausible one refined; see `consistent` and `starts` in the result.
710
+ */
711
+ initialize?: string
712
+ /** Extra starting moving -> fixed matrices (16 numbers each); implies `initialize: 'multi'`. */
713
+ starts?: Array<Array<number>>
714
+ /**
715
+ * A result rotated more than this many degrees is labelled 'poor' with `plausible: false`
716
+ * (and loses to any plausible start). Default 30; 0 or a negative number: no limit.
717
+ */
718
+ maxRotationDeg?: number
719
+ /** Working-grid spacing per pyramid level, coarse to fine, mm (default [8, 4, 2]). */
720
+ levelsMm?: Array<number>
721
+ /** Optimizer iterations per level (default 40). */
722
+ maxIterations?: number
723
+ /**
724
+ * Wall-clock limit, ms (default 30000). On expiry the best result so far is returned with
725
+ * `stopReason: 'time-limit'`.
726
+ */
727
+ timeLimitMs?: number
728
+ /** 'auto' (default: modality-aware body mask, CT table removed) or 'none'. */
729
+ mask?: string
730
+ /** Optional box in FIXED patient coordinates the fixed mask is limited to (min corner). */
731
+ roiMinMm?: Array<number>
732
+ /** Max corner of `roiMinMm`'s box. */
733
+ roiMaxMm?: Array<number>
734
+ /** Mutual-information histogram bins (default 32). */
735
+ histogramBins?: number
736
+ /** Metric sample points per level (default 100000). */
737
+ maxSamples?: number
738
+ /** Working-memory cap in bytes (default 268435456); a level that would exceed it is coarsened. */
739
+ maxMemoryBytes?: number
740
+ }
741
+
742
+ export interface RegistrationLevel {
743
+ spacingMm: number
744
+ iterations: number
745
+ metricEvaluations: number
746
+ metricValue: number
747
+ }
748
+
749
+ export interface RegistrationResult {
750
+ /** Moving -> fixed patient, row-major 4x4. */
751
+ matrix: Array<number>
752
+ /** Euler angles of the matrix's rotation, degrees (`R = Rz * Ry * Rx`). */
753
+ rotationDeg: Array<number>
754
+ /** The matrix's translation column, mm. */
755
+ translationMm: Array<number>
756
+ /** Centre of rotation the optimizer used (fixed body centroid), fixed patient mm. */
757
+ centerMm: Array<number>
758
+ /** 'ncc' or 'mattes-mi'. */
759
+ metric: string
760
+ /** NCC correlation (-1..1), or mutual information (nats). */
761
+ metricValue: number
762
+ initialMetricValue: number
763
+ /** NCC correlation, or MI's entropy correlation coefficient (0..1). */
764
+ normalizedMetric: number
765
+ /** Fraction of the fixed body samples that land inside the moving volume. */
766
+ overlapFraction: number
767
+ /**
768
+ * 0..1 from the metric over where both bodies are (so FOV truncation and cropping do not
769
+ * count against it) and whether the result is a local optimum; calibrated on public CT, PT
770
+ * and MR pairs. Show it, and never apply a 'poor' result silently.
771
+ */
772
+ quality: number
773
+ /** 'good' (>= 0.7), 'fair' (>= 0.4) or 'poor'. */
774
+ qualityLabel: string
775
+ iterations: number
776
+ metricEvaluations: number
777
+ levels: Array<RegistrationLevel>
778
+ /** 'matrix', 'translation', 'centroid' or 'none'. */
779
+ initialization: string
780
+ converged: boolean
781
+ /** 'converged', 'max-iterations' or 'time-limit'. */
782
+ stopReason: string
783
+ timingMs: number
784
+ /** Peak bytes of working images and samples held. */
785
+ workingBytes: number
786
+ /** The normalized metric over the fixed samples inside the moving body (what `quality` uses). */
787
+ bodyMetric: number
788
+ /** Share of the fixed body samples inside the moving body. */
789
+ bodyOverlapFraction: number
790
+ /** Rotation angle of `matrix`, degrees. */
791
+ rotationAngleDeg: number
792
+ /** False when the rotation is above `maxRotationDeg` (the label is then 'poor'). */
793
+ plausible: boolean
794
+ /**
795
+ * Multi-start only: whether another start converged to the same result (within 3 mm,
796
+ * mean over the fixed body's central box). Absent (undefined) for a single start.
797
+ */
798
+ consistent?: boolean
799
+ /** Multi-start only: every start, the returned one first. */
800
+ starts: Array<RegistrationStart>
801
+ }
802
+
803
+ export interface RegistrationStart {
804
+ /** 'matrix', 'translation', 'centroid', 'none' or 'start-<n>' (`starts[n-1]`). */
805
+ start: string
806
+ /** Where this start converged (moving -> fixed, row-major). */
807
+ matrix: Array<number>
808
+ normalizedMetric: number
809
+ quality: number
810
+ qualityLabel: string
811
+ rotationAngleDeg: number
812
+ plausible: boolean
813
+ /** Within 3 mm of the returned result. */
814
+ agrees: boolean
815
+ /** Whether it ran the finest pyramid level (the others stop one level coarser). */
816
+ refined: boolean
817
+ }
818
+
606
819
  export interface RenderedFrame {
607
820
  mimeType: string
608
821
  width: number
@@ -846,6 +1059,30 @@ export interface TransferSyntaxSupportInfo {
846
1059
  canTranscodeTo: boolean
847
1060
  }
848
1061
 
1062
+ export interface TranslationEstimate {
1063
+ /** Moving -> fixed patient (a pure translation), row-major 4x4. */
1064
+ matrix: Array<number>
1065
+ translationMm: Array<number>
1066
+ /**
1067
+ * 0..1, calibrated on public CT, PT and MR pairs so a wrong answer stays below 0.3: the z
1068
+ * peak (overlap-weighted), its margin over the next peak 20+ mm away, the profile channels'
1069
+ * agreement and the in-plane correlation. Below 0.3, fall back to capture-on-link.
1070
+ */
1071
+ confidence: number
1072
+ peakCorrelation: number
1073
+ secondPeakCorrelation: number
1074
+ overlapMm: number
1075
+ /** The profiles correlated: 'body', 'lung', 'bone' (CT-CT), 'intensity' (MR-MR, PT-PT). */
1076
+ profiles: Array<string>
1077
+ timingMs: number
1078
+ /** Share (0..1, weighted) of the profile channels whose own best z is within 10 mm of the answer. */
1079
+ channelAgreement: number
1080
+ /** Correlation of the two scans' axial projections at the x/y answer. */
1081
+ xyCorrelation: number
1082
+ /** The smallest overlap that was allowed, mm. */
1083
+ minOverlapMm: number
1084
+ }
1085
+
849
1086
  /** The dictionary VR of a tag, or null. */
850
1087
  export declare function vrOf(tag: number): string | null
851
1088
 
@@ -896,3 +1133,36 @@ export interface WriteJsonOptions {
896
1133
  */
897
1134
  bulkDataSourcePath?: string
898
1135
  }
1136
+
1137
+ /**
1138
+ * Builds a DICOM Spatial Registration instance from `specJson` (a JSON string) and writes it to
1139
+ * `outputPath`, or returns its bytes as `data` when `outputPath` is omitted. The REG goes in the
1140
+ * FIXED study and Frame of Reference: item 1 maps the fixed frame with the identity, item 2 the
1141
+ * moving frame with `matrix` (moving -> fixed, row-major, what registerVolumes returns).
1142
+ *
1143
+ * spec: `{ matrix: number[16], matrixType?: 'RIGID' (default) | 'RIGID_SCALE' | 'AFFINE',
1144
+ * registrationType?: 'auto' | 'manual' | 'identity', fixed: { frameOfReferenceUid,
1145
+ * studyInstanceUid, seriesInstanceUid, instances?: [{ sopClassUid, sopInstanceUid }] }, moving:
1146
+ * { ...same }, copyPatientStudyFrom?: path to one fixed-study DICOM file, patient?: {
1147
+ * patientName, patientId, patientBirthDate, patientSex }, study?: { studyDate, studyTime,
1148
+ * accessionNumber, referringPhysicianName, studyId, studyDescription }, sopInstanceUid?,
1149
+ * seriesInstanceUid?, seriesNumber?, seriesDescription?, instanceNumber?, contentLabel?,
1150
+ * contentDescription?, contentCreatorName?, manufacturer?, comment? }`. Rejects a spec that would
1151
+ * not produce a conformant object (missing UIDs, a non-rigid RIGID matrix, fixed and moving in
1152
+ * one Frame of Reference, ...).
1153
+ */
1154
+ export declare function writeSpatialRegistration(specJson: string, outputPath?: string | undefined | null): Promise<unknown>
1155
+
1156
+ export interface WrittenSpatialRegistration {
1157
+ /** The written object in readSpatialRegistration's JSON form (a string). */
1158
+ json: string
1159
+ /**
1160
+ * The written object as standard PS3.18 DICOM JSON (hex tag keys, `{vr, Value}`), a
1161
+ * string, ready for `writeJson`.
1162
+ */
1163
+ dataset: string
1164
+ sopInstanceUid: string
1165
+ seriesInstanceUid: string
1166
+ /** The Part 10 file's bytes, when no `outputPath` was given. */
1167
+ data?: Buffer
1168
+ }
package/index.js CHANGED
@@ -94,8 +94,8 @@ function requireNative() {
94
94
  try {
95
95
  const binding = require('@dcmnorm/android-arm64')
96
96
  const bindingPackageVersion = require('@dcmnorm/android-arm64/package.json').version
97
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
99
  }
100
100
  return binding
101
101
  } catch (e) {
@@ -110,8 +110,8 @@ function requireNative() {
110
110
  try {
111
111
  const binding = require('@dcmnorm/android-arm-eabi')
112
112
  const bindingPackageVersion = require('@dcmnorm/android-arm-eabi/package.json').version
113
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
115
115
  }
116
116
  return binding
117
117
  } catch (e) {
@@ -131,8 +131,8 @@ function requireNative() {
131
131
  try {
132
132
  const binding = require('@dcmnorm/win32-x64-gnu')
133
133
  const bindingPackageVersion = require('@dcmnorm/win32-x64-gnu/package.json').version
134
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
136
  }
137
137
  return binding
138
138
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@dcmnorm/win32-x64-msvc')
149
149
  const bindingPackageVersion = require('@dcmnorm/win32-x64-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -164,8 +164,8 @@ function requireNative() {
164
164
  try {
165
165
  const binding = require('@dcmnorm/win32-ia32-msvc')
166
166
  const bindingPackageVersion = require('@dcmnorm/win32-ia32-msvc/package.json').version
167
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
169
169
  }
170
170
  return binding
171
171
  } catch (e) {
@@ -180,8 +180,8 @@ function requireNative() {
180
180
  try {
181
181
  const binding = require('@dcmnorm/win32-arm64-msvc')
182
182
  const bindingPackageVersion = require('@dcmnorm/win32-arm64-msvc/package.json').version
183
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
185
  }
186
186
  return binding
187
187
  } catch (e) {
@@ -199,8 +199,8 @@ function requireNative() {
199
199
  try {
200
200
  const binding = require('@dcmnorm/darwin-universal')
201
201
  const bindingPackageVersion = require('@dcmnorm/darwin-universal/package.json').version
202
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
204
  }
205
205
  return binding
206
206
  } catch (e) {
@@ -215,8 +215,8 @@ function requireNative() {
215
215
  try {
216
216
  const binding = require('@dcmnorm/darwin-x64')
217
217
  const bindingPackageVersion = require('@dcmnorm/darwin-x64/package.json').version
218
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
220
220
  }
221
221
  return binding
222
222
  } catch (e) {
@@ -231,8 +231,8 @@ function requireNative() {
231
231
  try {
232
232
  const binding = require('@dcmnorm/darwin-arm64')
233
233
  const bindingPackageVersion = require('@dcmnorm/darwin-arm64/package.json').version
234
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
236
236
  }
237
237
  return binding
238
238
  } catch (e) {
@@ -251,8 +251,8 @@ function requireNative() {
251
251
  try {
252
252
  const binding = require('@dcmnorm/freebsd-x64')
253
253
  const bindingPackageVersion = require('@dcmnorm/freebsd-x64/package.json').version
254
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
256
256
  }
257
257
  return binding
258
258
  } catch (e) {
@@ -267,8 +267,8 @@ function requireNative() {
267
267
  try {
268
268
  const binding = require('@dcmnorm/freebsd-arm64')
269
269
  const bindingPackageVersion = require('@dcmnorm/freebsd-arm64/package.json').version
270
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
272
  }
273
273
  return binding
274
274
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@dcmnorm/freebsd-ppc64')
285
285
  const bindingPackageVersion = require('@dcmnorm/freebsd-ppc64/package.json').version
286
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -304,8 +304,8 @@ function requireNative() {
304
304
  try {
305
305
  const binding = require('@dcmnorm/linux-x64-musl')
306
306
  const bindingPackageVersion = require('@dcmnorm/linux-x64-musl/package.json').version
307
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
309
  }
310
310
  return binding
311
311
  } catch (e) {
@@ -320,8 +320,8 @@ function requireNative() {
320
320
  try {
321
321
  const binding = require('@dcmnorm/linux-x64-gnu')
322
322
  const bindingPackageVersion = require('@dcmnorm/linux-x64-gnu/package.json').version
323
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
325
  }
326
326
  return binding
327
327
  } catch (e) {
@@ -338,8 +338,8 @@ function requireNative() {
338
338
  try {
339
339
  const binding = require('@dcmnorm/linux-arm64-musl')
340
340
  const bindingPackageVersion = require('@dcmnorm/linux-arm64-musl/package.json').version
341
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
343
  }
344
344
  return binding
345
345
  } catch (e) {
@@ -354,8 +354,8 @@ function requireNative() {
354
354
  try {
355
355
  const binding = require('@dcmnorm/linux-arm64-gnu')
356
356
  const bindingPackageVersion = require('@dcmnorm/linux-arm64-gnu/package.json').version
357
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
359
  }
360
360
  return binding
361
361
  } catch (e) {
@@ -372,8 +372,8 @@ function requireNative() {
372
372
  try {
373
373
  const binding = require('@dcmnorm/linux-arm-musleabihf')
374
374
  const bindingPackageVersion = require('@dcmnorm/linux-arm-musleabihf/package.json').version
375
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
377
  }
378
378
  return binding
379
379
  } catch (e) {
@@ -388,8 +388,8 @@ function requireNative() {
388
388
  try {
389
389
  const binding = require('@dcmnorm/linux-arm-gnueabihf')
390
390
  const bindingPackageVersion = require('@dcmnorm/linux-arm-gnueabihf/package.json').version
391
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
393
  }
394
394
  return binding
395
395
  } catch (e) {
@@ -406,8 +406,8 @@ function requireNative() {
406
406
  try {
407
407
  const binding = require('@dcmnorm/linux-loong64-musl')
408
408
  const bindingPackageVersion = require('@dcmnorm/linux-loong64-musl/package.json').version
409
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
411
  }
412
412
  return binding
413
413
  } catch (e) {
@@ -422,8 +422,8 @@ function requireNative() {
422
422
  try {
423
423
  const binding = require('@dcmnorm/linux-loong64-gnu')
424
424
  const bindingPackageVersion = require('@dcmnorm/linux-loong64-gnu/package.json').version
425
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
427
  }
428
428
  return binding
429
429
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@dcmnorm/linux-riscv64-musl')
442
442
  const bindingPackageVersion = require('@dcmnorm/linux-riscv64-musl/package.json').version
443
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@dcmnorm/linux-riscv64-gnu')
458
458
  const bindingPackageVersion = require('@dcmnorm/linux-riscv64-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -473,8 +473,8 @@ function requireNative() {
473
473
  try {
474
474
  const binding = require('@dcmnorm/linux-ppc64-gnu')
475
475
  const bindingPackageVersion = require('@dcmnorm/linux-ppc64-gnu/package.json').version
476
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
478
478
  }
479
479
  return binding
480
480
  } catch (e) {
@@ -489,8 +489,8 @@ function requireNative() {
489
489
  try {
490
490
  const binding = require('@dcmnorm/linux-s390x-gnu')
491
491
  const bindingPackageVersion = require('@dcmnorm/linux-s390x-gnu/package.json').version
492
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
492
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
494
494
  }
495
495
  return binding
496
496
  } catch (e) {
@@ -509,8 +509,8 @@ function requireNative() {
509
509
  try {
510
510
  const binding = require('@dcmnorm/openharmony-arm64')
511
511
  const bindingPackageVersion = require('@dcmnorm/openharmony-arm64/package.json').version
512
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
514
514
  }
515
515
  return binding
516
516
  } catch (e) {
@@ -525,8 +525,8 @@ function requireNative() {
525
525
  try {
526
526
  const binding = require('@dcmnorm/openharmony-x64')
527
527
  const bindingPackageVersion = require('@dcmnorm/openharmony-x64/package.json').version
528
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
530
530
  }
531
531
  return binding
532
532
  } catch (e) {
@@ -541,8 +541,8 @@ function requireNative() {
541
541
  try {
542
542
  const binding = require('@dcmnorm/openharmony-arm')
543
543
  const bindingPackageVersion = require('@dcmnorm/openharmony-arm/package.json').version
544
- if (bindingPackageVersion !== '0.15.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
- throw new Error(`Native binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
544
+ if (bindingPackageVersion !== '0.17.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
+ throw new Error(`Native binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
546
546
  }
547
547
  return binding
548
548
  } catch (e) {
@@ -683,8 +683,8 @@ if (!nativeBinding || forceWasi) {
683
683
  if (!candidateFailed) {
684
684
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
685
685
  const bindingPackageVersion = require('@dcmnorm/wasm32-wasi/package.json').version
686
- if (bindingPackageVersion !== '0.15.1') {
687
- throw new Error(`WASI binding package version mismatch, expected 0.15.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
686
+ if (bindingPackageVersion !== '0.17.0') {
687
+ throw new Error(`WASI binding package version mismatch, expected 0.17.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
688
688
  }
689
689
  }
690
690
  wasiBinding = require('@dcmnorm/wasm32-wasi')
@@ -840,6 +840,7 @@ module.exports.DicomVolumeHandle = nativeBinding.DicomVolumeHandle
840
840
  module.exports.EchoScuHandle = nativeBinding.EchoScuHandle
841
841
  module.exports.FindScuHandle = nativeBinding.FindScuHandle
842
842
  module.exports.MoveScuHandle = nativeBinding.MoveScuHandle
843
+ module.exports.RegistrationCancelToken = nativeBinding.RegistrationCancelToken
843
844
  module.exports.StoreScuHandle = nativeBinding.StoreScuHandle
844
845
  module.exports.buildVolume = nativeBinding.buildVolume
845
846
  module.exports.checkDicom = nativeBinding.checkDicom
@@ -852,6 +853,7 @@ module.exports.datasetTranscode = nativeBinding.datasetTranscode
852
853
  module.exports.datasetWrite = nativeBinding.datasetWrite
853
854
  module.exports.echoScu = nativeBinding.echoScu
854
855
  module.exports.editTags = nativeBinding.editTags
856
+ module.exports.estimateTranslation = nativeBinding.estimateTranslation
855
857
  module.exports.exportFrameStackTexture = nativeBinding.exportFrameStackTexture
856
858
  module.exports.exportFrameStackTextureRgb = nativeBinding.exportFrameStackTextureRgb
857
859
  module.exports.exportFrameTexture = nativeBinding.exportFrameTexture
@@ -860,7 +862,9 @@ module.exports.findScu = nativeBinding.findScu
860
862
  module.exports.keywordOf = nativeBinding.keywordOf
861
863
  module.exports.moveScu = nativeBinding.moveScu
862
864
  module.exports.readJson = nativeBinding.readJson
865
+ module.exports.readSpatialRegistration = nativeBinding.readSpatialRegistration
863
866
  module.exports.readTags = nativeBinding.readTags
867
+ module.exports.registerVolumes = nativeBinding.registerVolumes
864
868
  module.exports.renderFrame = nativeBinding.renderFrame
865
869
  module.exports.renderMovie = nativeBinding.renderMovie
866
870
  module.exports.startDicomServer = nativeBinding.startDicomServer
@@ -874,3 +878,4 @@ module.exports.transferSyntaxSupport = nativeBinding.transferSyntaxSupport
874
878
  module.exports.vrOf = nativeBinding.vrOf
875
879
  module.exports.writeDicomdir = nativeBinding.writeDicomdir
876
880
  module.exports.writeJson = nativeBinding.writeJson
881
+ module.exports.writeSpatialRegistration = nativeBinding.writeSpatialRegistration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcmnorm",
3
- "version": "0.15.1",
3
+ "version": "0.17.0",
4
4
  "description": "Native Node.js bindings for dcmnorm: DICOM read/edit/transcode/render and DIMSE networking in-process (no CLI subprocess)",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jason Klotzer",
@@ -50,14 +50,14 @@
50
50
  "build": "napi build --platform --release && node prepare-npm.js --fix-loader",
51
51
  "build:debug": "napi build --platform && node prepare-npm.js --fix-loader",
52
52
  "build:docker": "./build-in-docker.sh",
53
- "test": "node test/smoke.js && node test/dataset.js"
53
+ "test": "node test/smoke.js && node test/dataset.js && node test/registration.js"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@dcmnorm/linux-x64-gnu": "0.15.1",
57
- "@dcmnorm/linux-arm64-gnu": "0.15.1",
58
- "@dcmnorm/win32-x64-msvc": "0.15.1",
59
- "@dcmnorm/darwin-arm64": "0.15.1",
60
- "@dcmnorm/darwin-x64": "0.15.1"
56
+ "@dcmnorm/linux-x64-gnu": "0.17.0",
57
+ "@dcmnorm/linux-arm64-gnu": "0.17.0",
58
+ "@dcmnorm/win32-x64-msvc": "0.17.0",
59
+ "@dcmnorm/darwin-arm64": "0.17.0",
60
+ "@dcmnorm/darwin-x64": "0.17.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@napi-rs/cli": "^3.7.3"