Repository navigation
feat: @dcmjs-org/fhir — DICOM to FHIR mapping with the review fixes - #584
Conversation
The package manifest (publishable under the @dcmjs-org scope, main at src/index.js, repository directory set), a short README, and the lockfile entry linking the one dependency, @dcmjs-org/core. Co-Authored-By: Claude Fable 5 <[email protected]>
A verbatim port of src/encapsulated/encapsulatedPdf.js from the v2 branch
HEAD (including the { InlineBinary } unwrap that postdates the PR #512
review), with its core import rebased onto @dcmjs-org/core and the PDF half
of the encapsulated index as the package surface. The video half stays on
the v2 branch for the media wave.
The eight-test v2 suite comes along, reworked for this branch's engine: the
legacy datasetToBuffer / DicomMessage.readFile round-trip becomes
denaturalize -> fromDataSet -> Part10Writer -> fromPart10 ->
NaturalizedListener, and the last test's read of test/sample-dicom.dcm
(provenance still being traced) is replaced by a synthetic MR instance
round-tripped through the same pipeline, so neither the package nor its
suite touches @dcmjs-org/legacy or the fixture.
Co-Authored-By: Claude Fable 5 <[email protected]>
…ding 16) The pad-trim heuristic strips a real zero byte: the Part 10 writer pads only an odd-length OB value, so a stored even length is ambiguous — the old code trimmed a trailing 0x00 anyway, corrupting an even-length original that genuinely ends in a zero byte (a 10-byte payload ending 0x00 came back as 9 bytes). encapsulatePdf now records EncapsulatedDocumentLength (0042,0015) with the exact original length, and extractEncapsulatedPdf slices to the declared length when present, keeping the trailing-NUL heuristic only as the fallback for files written before the element existed. The four new tests were written first and observed failing against the ported-unfixed code: the even-length zero-tail round-trip (9 bytes back, red), the recorded length element, and the declared-length odd slice; the heuristic-fallback test passed before and after, pinning that files without 0042,0015 still extract exactly. Co-Authored-By: Claude Fable 5 <[email protected]>
package.json modeled on @dcmjs-org/core's (version 0.0.0, publishable, MIT, main ./src/index.js, repository directory), depending on @dcmjs-org/core at runtime and on @dcmjs-org/legacy only as a devDependency for test readback. Plus a short README with a usage sample. Co-Authored-By: Claude Fable 5 <[email protected]>
src/media/dicomdir.js, src/media/directoryOffsets.js, and
src/media/index.js from the v2.0-development branch land as
packages/dicomdir/src/{dicomdir,directoryOffsets,index}.js, and
test/dicomdir.test.js as packages/dicomdir/test/dicomdir.test.js —
byte-for-byte v2 content. Imports still point at the v2 tree; the next
commit rewires them onto @dcmjs-org/core and replaces the DicomDict
dependency.
Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…elopment helpers.js, patient.js and patientToDataset.js come over verbatim from the v2 packages/fhir sources (prettier-normalized to this repo's config). The test imports are rewired to the concrete modules because the package index lands in a later slice. Co-Authored-By: Claude Fable 5 <[email protected]>
…exist A text-only HumanName used to map to null, and patientToDataset's deterministic overwrite then erased the patient's name entirely (review finding 19 on PR #512). When family/given/prefix/suffix are all absent, the free-text form now survives as a single-component PN. Co-Authored-By: Claude Fable 5 <[email protected]>
feat(pdfs): the @dcmjs-org/pdfs package — encapsulated PDF wrap and unwrap
The two legacy imports the v2 code carried are gone, keeping the hard
rule that this package never depends on @dcmjs-org/legacy:
- directoryOffsets.js measured element sizes through DicomMessage.write
and DicomMessage.writeTagObject; it now calls core's writeDataSet and
writeTagObject directly — the exact functions those statics are
one-line delegates to, so measured sizes are unchanged.
- dicomdir.js built a DicomDict and called dicomDict.write(); the Part
10 envelope (preamble + DICM, meta group behind its group length,
then the body) is now inlined as writePart10 on the same core
primitives, minus the deflate branch a DICOMDIR can never take.
Verified byte-identical against legacy DicomDict.write on the same
denaturalized { meta, dict }.
The test readback oracle rewires from the root dcmjs facade to
DicomMessage from @dcmjs-org/legacy (devDependency) plus
DicomMetaDictionary and validationLog from @dcmjs-org/core, and the
local EXPLICIT_LITTLE_ENDIAN constant gives way to core's export.
Full suite: 860 passed, 12 skipped, 872 total.
Co-Authored-By: Claude Fable 5 <[email protected]>
feat: port the DICOMDIR builder into packages/dicomdir
The package shell for the video wave: name, entry point, MIT license, repository directory, and the @dcmjs-org/core workspace dependency. The image-module index exports only the header parsers for now; the dataset builder joins it in the next slice. Co-Authored-By: Claude Fable 5 <[email protected]>
Verbatim from v2.0-development: src/image/jpegInfo.js (SOF geometry and the JPEG transfer syntax mapping), src/image/mp4Info.js (the ISO BMFF box walk over a random-access reader), the makeTinyMp4 synthesized-fixture helper, and the ported mp4Info suite. Only the test import paths moved with the files; no behavior changed in this commit — review findings 9 and 15 are fixed on top, each with its regression observed red first. Co-Authored-By: Claude Fable 5 <[email protected]>
Review finding 9 (HIGH): the marker-walk guard only required four readable bytes, but the SOF fields span bytes[offset+4 .. offset+9]. Out-of-range reads coerce to 0 in the bitwise math, so the review map's vector — a 480x640 JPEG cut one byte into the width field — returned columns 512 instead of throwing, and a file cut right after the length field returned rows 0, columns 0. The reader now validates that the declared SOF segment fits inside the input (and is at least 8 bytes) before reading any field. The new jpegInfo suite is hand-written (v2 carried no suite for this file): the exact review vector, the cut-after-length shape, and valid SOF0/SOF1/SOF2/SOF3 paths. Both finding tests were observed red against the ported-unfixed reader before this fix. Co-Authored-By: Claude Fable 5 <[email protected]>
Review finding 15 (MED): the stts fallback loop trusted the raw uint32 entry_count. With stsz sample_count 0 and stts entry_count 0x00FFFFFF the parser spun 16.7 million iterations over zero-coerced reads past the box and fabricated numberOfFrames/frameRate from unrelated moov bytes; at 0xFFFFFFFF that is roughly 40 seconds of blocked thread. The loop now requires 16 + entryCount * 8 to fit inside the stts box and throws on the mismatch. The regression corrupts a synthesized MP4 exactly that way and asserts the parse rejects in under two seconds — observed red (the unfixed parser resolved with fabricated values) before this fix. Co-Authored-By: Claude Fable 5 <[email protected]>
feat(fhir): scaffold @dcmjs-org/fhir and port the Patient mappers (finding 19)
feat(video): scaffold @dcmjs-org/video with the JPEG and MP4 header parsers
Verbatim from v2.0-development src/image/buildImageDataset.js and its 21-test suite, with two mechanical adjustments for the package boundary: DicomMetaDictionary and validationLog now come from @dcmjs-org/core, and the test imports the builder from the package's image index (which now exports it alongside the header parsers). No behavior changed in this commit — review finding 10 is fixed on top with its regressions observed red first. Co-Authored-By: Claude Fable 5 <[email protected]>
…2.0-development imagingStudy.js comes over verbatim. The index keeps toFhir/toBundle unchanged but swaps the documentReference import for a null-returning placeholder until the DocumentReference mapper lands in the next slice (v2's index has no fromFhir re-export; the event-stream integration is a deferred slice of its own). The ported toFhir suite reads the sample-dicom.dcm fixture from packages/fixtures/dicom and naturalizes it through @dcmjs-org/parser instead of the umbrella, and the two umbrella-namespace tests are deferred with the facade slice. Co-Authored-By: Claude Fable 5 <[email protected]>
…riesInstanceUID Review findings 17 and 18 on PR #512. A missing (0008,0016) used to fabricate the CT Image Storage UID, asserting an unknown instance was a CT image; a missing (0020,000E) produced series.uid: null — invalid against R4B's 1..1 cardinality — and merged every such dataset under one "unknown" key. Both inputs are now skipped with a validationLog warning rather than emitted invalid, since instance.sopClass and series.uid are required elements a server would reject anyway. Co-Authored-By: Claude Fable 5 <[email protected]>
Review finding 10 (HIGH): numberOfFrames came only from decodedImage.numberOfFrames || 1 and was never derived from or checked against options.encapsulated.frames.length, and the attribute was only written when above 1. Three encapsulated fragments therefore produced an instance with no NumberOfFrames — a conformant reader showed frame 1 and the rest were unreachable — while an explicit numberOfFrames 7 over 2 fragments emitted the bogus claim unchecked. In encapsulated mode the fragment list is now the ground truth: the count defaults to frames.length and an explicit mismatch throws. Both regressions were observed red against the ported-unfixed builder before this fix; two companion tests pin that a matching explicit count is accepted and that a single fragment still omits the attribute. Co-Authored-By: Claude Fable 5 <[email protected]>
Writing a DICOMDIR from @dcmjs-org/dicomdir alone threw: core's SequenceOfItems.writeBytes serialized each item through the late-bound DicomMessage, which only @dcmjs-org/legacy (or the dcmjs wrapper) registers — so the package's hard no-legacy rule held in its imports but not at runtime. The committed suite never saw it because its readback oracle imports legacy, wiring the seam as a side effect. core/writeCore.js now registers writeDataSet into ValueRepresentation at load (a direct import between the two files is a module-level CJS cycle that breaks Tag's registration, hence the seam), and the sequence writer calls that instead of DicomMessage.write — the exact function DicomMessage.write delegates to, so bytes are unchanged either way. The new packages/dicomdir/test/standalone.test.js imports nothing from legacy (jest's per-file module registry guarantees the seam stays unwired) and proves a full DICOMDIR write: DICM magic, four undefined-length item headers for PATIENT/STUDY/SERIES/IMAGE, deterministic bytes. Full suite: 861 passed, 12 skipped, 873 total. Co-Authored-By: Claude Fable 5 <[email protected]>
feat(video): port buildImageDataset with the encapsulated frame-count fix
feat(fhir): port the ImagingStudy mapper and toFhir/toBundle surface (findings 17, 18)
Verbatim from v2.0-development src/encapsulated/encapsulatedVideo.js and its 8-test suite, with one mechanical adjustment for the package boundary: DicomMetaDictionary and isVideoTransferSyntax now come from @dcmjs-org/core instead of relative paths. buildVideoDataset shapes the Supplement 225 Video Photographic Image shell (XC modality, cine timing, the (7FE0,0003) uint64 total length as a BigInt), encapsulateVideo splits the MP4 into fragment-sized exact ArrayBuffer slices, and extractEncapsulatedVideo concatenates fragments and truncates to the declared length so the odd-fragment pad byte drops on extraction. Co-Authored-By: Claude Fable 5 <[email protected]>
The video half of v2's encapsulated index only — the PDF half (encapsulatedPdf) belongs to the media wave. Co-Authored-By: Claude Fable 5 <[email protected]>
documentReference.js comes over verbatim, and the package index swaps the slice-two placeholder for the real import and re-export, completing the toFhir three-key surface. The ported test builds its Encapsulated PDF datasets synthetically (v2 built them with dcmjs.encapsulated, which belongs to the pdfs wave and is not on this branch yet), keeps the Part 10 round trip through @dcmjs-org/legacy as a test-only devDependency, and naturalizes the image fixture through @dcmjs-org/parser like the toFhir suite. Co-Authored-By: Claude Fable 5 <[email protected]>
…tLength Review findings 8 and 16 on PR #512. The event-stream naturalizer wraps binary elements as { InlineBinary } (base64 string, ArrayBuffer, or view); payloadBytes never unwrapped that shape, and new Uint8Array of a plain object is empty, so every naturalized encapsulated document silently mapped to { size: 0, data: "" }. The unwrap block mirrors the one in v2's extractEncapsulatedPdf, kept as a local copy because this package must not depend on the pdfs package. The even-length pad-trim heuristic also stripped real trailing zero bytes, since an even stored length never carries a writer pad. When EncapsulatedDocumentLength (0042,0015) is present it now wins over the heuristic; the write side that emits it lands with the pdfs wave. Co-Authored-By: Claude Fable 5 <[email protected]>
fix: let core's sequence writer run with no eager engine loaded
feat(video): port the buffered video encapsulation layer
FHIR resources as an event-stream SOURCE, for the resources that carry
content rather than context: a DocumentReference with an inline PDF
becomes an Encapsulated PDF instance, and a Media with an inline JPEG
(the key-image case) becomes an image instance with the JPEG bytes
carried verbatim as encapsulated PixelData. Bundles are unwrapped
(one content resource + an optional Patient for demographics), and
context-only resources are rejected with corrective errors.
The module stays at root src/eventStream/ — the same wrapper-level home
as api.js — because it composes five packages (pdfs, video, fhir,
parser, core) and belongs inside none of them; it moves into the step-7
wrapper package with the facade. Imports are rewired to the scoped
packages, and the legacy datasetToDict call is replaced with a local
copy of the video wave's datasetToMetaDict (not exported from
@dcmjs-org/video), producing the plain { meta, dict } shape fromDataSet
consumes. @dcmjs-org/core, fhir, and parser join the root workspace
dependencies.
Co-Authored-By: Claude Fable 5 <[email protected]>
fromFhir follows the media factories' lazy-source pattern (finding 14):
the v2 original built the dataset eagerly at factory time, so garbage
input threw from the factory before anyone called .process(). Here the
dataset is built on first consumption and cached — the corrective error
surfaces from the sink, and minted UIDs stay stable across re-runs.
The regression test was red against the verbatim v2 port (5 failures:
the finding-14 test plus the four corrective-error tests, all throwing
at factory time) and is green with the lazy form.
toFhir maps one instance to { patient, imagingStudy, documentReference }
via @dcmjs-org/fhir over the naturalized dataset, ported verbatim from
v2's api.js.
The test suite is the v2 fhirPdfEventStream suite with import and
fixture-path rework, minus the parseJpegInfo block (now owned by
packages/video/test/jpegInfo.test.js, a superset), plus the facade form
of the deferred 'dcmjs.fhir umbrella namespace' bytes-to-FHIR test:
DicomEventStream.fromPart10(bytes).toFhir() over the committed
sample-dicom.dcm fixture. The namespace tests themselves still wait for
the step-7 wrapper package; the deferral comments in
packages/fhir/test/toFhir.test.js now say exactly that.
Co-Authored-By: Claude Fable 5 <[email protected]>
…e exists The advisory (braces <=3.0.3, high, stack exhaustion) was published mid-flight on this PR: the identical lockfile passed audit on the staging branch twenty minutes before the PR run failed. Its stated patched range is >=3.0.4, but the registry has no such release (latest braces is 3.0.3, from 2024), so an override pin cannot resolve — verified: ERR_PNPM_NO_MATCHING_VERSION. Every path to braces is dev tooling (cpy-cli, lint-staged, jest); it never reaches the published package. The ignore is scoped to this one GHSA and commented for removal the moment a patched braces ships. Co-Authored-By: Claude Fable 5 <[email protected]>
feat(fhir): the FHIR event source and facade integration
Per review on #542: the guide existed to hold the staged-landing PR descriptions to one standard, and every description is now written. Removed rather than kept stale; git history preserves it if the team wants it back later. The PR template keeps the one-line spirit of it. Co-Authored-By: Claude Fable 5 <[email protected]> (cherry picked from commit 2a5935e)
…fhir # Conflicts: # packages/core/src/ValueRepresentation.js # packages/core/src/core/writeCore.js # pnpm-lock.yaml # pnpm-workspace.yaml
…fhir # Conflicts: # packages/dicomdir/README.md # packages/dicomdir/package.json # packages/dicomdir/test/standalone.test.js # pnpm-lock.yaml
| * DICOM Modality code → display name. | ||
| * System: http://dicom.nema.org/resources/ontology/DCM | ||
| */ | ||
| export const MODALITY_DISPLAY = { |
There was a problem hiding this comment.
This list definitely belongs in core somewhere, and should be a Map, although you might want to construct the map from an object.
The map should declare an interface version so that a client can create a new modality custom mapping, and have it get type checked.
| /** | ||
| * Coerce a naturalized value to a finite number, or null. | ||
| */ | ||
| export function asNumber(value) { |
There was a problem hiding this comment.
There are versions of this in CS3D that do different types of co-ercions. In general they handle arrays as arrays and convert on a value by value basis. If it can be re-used in the exact format cs3d uses, that would likely be best.
|
|
||
| return { | ||
| PatientName: (name && humanNameToPersonName(name)) || "", | ||
| PatientID: identifier?.value || "", |
There was a problem hiding this comment.
Can you grab issuer of patient id, and/or the uid variant of that? Given that FHIR usually has the issuer in at least one format, it helps to have it.
Then, since you are reading them anyways, how about the other patient id's sequence? That is a bonus request, but the issuer is important.
|
|
||
| validationLog.setLevel(5); | ||
|
|
||
| const ENCAPSULATED_PDF_SOP_CLASS_UID = "1.2.840.10008.5.1.4.1.1.104.1"; |
There was a problem hiding this comment.
This should be imported from somewhere - but that will likely all get modified once the encapsulated changes are done.
| } | ||
|
|
||
| /** Standalone ArrayBuffer copy of a byte payload. */ | ||
| function toArrayBuffer(bytes) { |
…fhir # Conflicts: # pnpm-lock.yaml
…fhir # Conflicts: # package.json # packages/media/README.md # packages/media/package.json # packages/media/src/index.js # packages/media/test/bundle.test.js # packages/video/package.json # packages/video/src/encapsulated/encapsulatedVideo.js # packages/video/src/encapsulated/index.js # packages/video/src/eventStream/fromVideo.js # packages/video/src/image/index.js # packages/video/src/image/mp4Info.js # packages/video/src/index.js # packages/video/test/encapsulatedVideo.test.js # packages/video/test/eventStream/fromVideo.test.js # packages/video/test/mp4Info.test.js # pnpm-lock.yaml # src/eventStream/api.js # test/eventStream/fromImage.test.js # test/eventStream/mediaFactories.test.js
fromFhir takes `patient` plus the createInstance options (instance, dataLevel, levels, predecessor, postProcess, baseDicom, overrides) and gives them to encapsulatePdf or buildImageDataset. The FHIR values (the patient demographics and the DocumentTitle) go in front of the caller overrides. The local datasetToMetaDict copy is replaced by datasetToDict. Add extractEncapsulated to @dcmjs-org/encapsulated. extractEncapsulatedPdf and the fhir documentReference mapper use it, in place of the local payloadBytes copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- parseJpegInfo gives DICOM bit depths (BitsAllocated 8 or 16, BitsStored) and the photometric interpretation from the SOF type, the sampling factors, the component IDs, and the Adobe APP14 transform. fromFhir writes BitsStored, PixelRepresentation, and PlanarConfiguration. - fromFhir selects the Bundle Patient from the subject reference, and throws when the Patient is not clear. - imagingStudyFromDatasets skips a dataset of another study. - A FHIR dateTime has a time only with TimezoneOffsetFromUTC; DocumentReference.date is written only as a full instant. - extractEncapsulated removes a pad byte without a declared length only for PDF, text, and XML types. - @dcmjs-org/core gets encodeBase64, base64ToArrayBuffer, toStringFirst, toFloatFirst, and MODALITY_DISPLAY; parser, generator, encapsulated, and fhir use them. - packages/fhir/README.md marks the API preliminary and gives the FHIR-USR and FHIR-IMP requirements. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- base64: use Uint8Array.prototype.toBase64 / Uint8Array.fromBase64 when
present, then Buffer, then chunked btoa/atob.
- B2: without options.subject, toFhir references ./patient and toBundle
gives each entry fullUrl ./entry/<n> and references the Patient entry.
- B3: no US Core birth-sex or clinical-sex extensions; gender only.
- B4: a FHIR Patient replaces the whole patient module, and an instance of
another PatientID throws.
- S1: a Bundle reference matches fullUrl exactly; only a relative
reference matches by id; more than one match throws.
- S2: a { BulkDataURI } payload gives attachment.url, not empty data.
- S3: strict DA/TM formats, with the legacy dot and colon forms.
- S4: skip a dataset with no Modality; numbers only as unsignedInt.
- S5: bodySite has no code system; laterality L/R/B are SNOMED codes.
- S6: a lossy JPEG gets LossyImageCompression 01 and the method.
- S7: toBundle skips a dataset of another patient or study.
- S8: requirements for the changed behaviour in the core, imaging,
encapsulated, and fhir READMEs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Take the 1.0-beta design for every package that the assemblies #577, #585, #588 and #584 merged: @dcmjs-org/encapsulated replaces @dcmjs-org/pdfs, @dcmjs-org/imaging holds buildImageDataset and parseJpegInfo, and @dcmjs-org/media and @dcmjs-org/fhir come from 1.0-beta unchanged. Keep only the wrapper on top: the @dcmjs-org/dcmjs rename without "private", the media/encapsulated/image/fhir namespaces in src/index.js, the root dependency on @dcmjs-org/media, test/bundle-size.test.js, and the pnpm 12.9.1 pin. The dcmjs.fhir namespace tests move from packages/fhir/test to test/fhirNamespace.test.js, so the package tests stay off the root wrapper. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This is the assembly PR for the FHIR package. It merges
release/1.0-beta-fhirinto1.0-beta. It contains PRs #574, #579, #582, and #589, and the fixes of two reviews of this PR.What the PR adds
@dcmjs-org/fhirmaps DICOM data to FHIR R4/R4B resources, and maps FHIR patient data back to DICOM.toFhir(dataset)gives{ patient, imagingStudy, documentReference }for one naturalized instance.toBundle(datasets)gives acollectionBundle: one Patient, a DocumentReference for each document, and one ImagingStudy.patientToDataset(patient)gives the four DICOM patient attributesPatientName,PatientID,PatientBirthDate, andPatientSex.DicomEventStream.fromFhir(resource, options)makes a DICOM instance from a DocumentReference or Media with inline data, or from a Bundle that holds one.DicomEventStream#toFhir()maps one instance of a stream to FHIR.User requirements
packages/fhir/README.mdhas a§ User requirementssection (FHIR-USR-1 to FHIR-USR-10) and a§ Implementation requirementssection (FHIR-IMP-1 to FHIR-IMP-4). The most important user rules are:id, nometa.tags, no storage references, and no profile extensions.validationLogwarning:toBundle, a dataset of another patient.dateTimehas a time only when the dataset hasTimezoneOffsetFromUTC. Otherwise the value is the date only.DocumentReference.dateis written only when the date, the time, and the timezone are all present.fromFhirarepatientplus thecreateInstanceoptions of@dcmjs-org/core. The calleroverrideswin over the FHIR values. A FHIR Patient replaces the whole patient module. Aninstanceof another PatientID throws an error.subjectreference of the content resource selects the Patient. The reference must match one Patient entry. OtherwisefromFhirthrows an error.options.subject, the resources reference the Patient with a relative path into the returned object (./patient,./entry/<n>). These paths are not FHIR server references. The consumer replaces them when it stores the resources.Changes in other packages
The PR also changes these packages. Each change has a requirement in the README of the package.
@dcmjs-org/core(CORE-USR-16 to CORE-USR-18, CORE-IMP-12) has new exports:encodeBase64andbase64ToArrayBuffer. They use the nativeUint8Arraybase64 methods when present, then Node'sBuffer, thenbtoa/atob. The parser, the generator, the encapsulated package, and the fhir package now use these functions, and their local copies are removed.@dcmjs-org/parserstill exportsbase64ToArrayBuffer.toStringFirstandtoFloatFirst: the first value of a naturalized attribute as a string or as a number, ornull.MODALITY_DISPLAY: the display names of the Modality codes.@dcmjs-org/encapsulated(ENC-USR-6, ENC-IMP-8) has a new exportextractEncapsulated(dataset)for every document type.extractEncapsulatedPdfuses it.extractEncapsulatedreturnsnullfor a{ BulkDataURI }payload.EncapsulatedDocumentLength, it removes a trailing pad byte only for PDF, text, and XML types. A binary type, for example STL, keeps every byte.@dcmjs-org/imaging(IMG-USR-11):parseJpegInfonow gives DICOM values.bitsAllocatedis 8 or 16, and the newbitsStoredis the sample precision.photometricInterpretationcomes from the SOF type, the chroma subsampling, the component IDs, and the Adobe APP14 transform.Changes of user-facing behaviour
@dcmjs-org/fhiris a new package. The changes below are changes against the earlier commits of this PR, and against1.0-beta.parseJpegInfo(...).bitsAllocatedis now 16 for a 12-bit JPEG. Before, the value was the sample precision (12).fromFhir,fromPdf,fromImage, andfromVideotake the DICOM attributes inoverrides. An attribute at the top level of the options has no effect.imagingStudy.startedis the date only (for example"2001-01-01") when the dataset has noTimezoneOffsetFromUTC. Before, the value had a time with no timezone, which is not valid FHIR.us-core-birthsexorus-core-sexextension. DICOMPatientSexis an administrative value, and DICOM does not record the birth sex or the clinical sex.bodySitehas no code system, because a DICOM defined term is not a SNOMED CT display.lateralityL, R, and B are SNOMED CT codes.bytesToBase64. UseencodeBase64of@dcmjs-org/core.Review fixes
The first review fixed these items, from the PR #512 review map:
{ InlineBinary }.EncapsulatedDocumentLengthgives the exact document length.uid: null.HumanNamebecomes a single-component PN.The reviews of this PR found more items. The fixes are:
fromFhirhasBitsStored,HighBit,PixelRepresentation,PlanarConfiguration, the correct photometric interpretation, andLossyImageCompression"01" for a lossy JPEG.fullUrlexactly. It does not match an absolute reference byidalone.{ BulkDataURI }document givesattachment.url, and not an emptydatavalue.One known item stays open by decision:
toBundlewritesBundle.totalon acollectionBundle.Merge with
1.0-betaThis branch now contains
1.0-betaat 685beff, with #577, #585, and #588. The merge uses the1.0-betaversions of the media, video, and imaging files. The merge removespackages/pdfs, because@dcmjs-org/encapsulatedreplaces it. The diff against1.0-betanow holds only the FHIR package, the event-stream integration, and the changes of the section "Changes in other packages".How to test
From the repository root:
On the branch tip 34d3fa1, this command gave 33 suites and 579 tests that pass, and 1 skipped test.
eslintandprettier --checkon the changed files give no errors.In the full suite, three tests in
test/data.test.jsfailed on one local machine withENOENTin the local test-data cache. The failures are not related to this PR.🤖 Generated with Claude Code