Repository navigation
feat: support the OL (Other Long) value representation - #632
Merged
Merged
Conversation
OL was missing entirely. VRinstances held only OB, OD, OF and OW, so
createByTypeString("OL") fell through to the "Invalid vr type" path and
returned UN - an OL element could not be written at all, and reading one
gave back an element whose VR was wrong on the wire.
It is a stream of 32 bit words, so it behaves exactly like its siblings: a
32 bit length, a single value, no multiplicity. The implementation is the
same BinaryRepresentation subclass with "OL" added to length32VRs and
singleVRs.
What needs it: the large mesh attributes of Surface Segmentation. Triangle
Point Index List (0066,0023) is OW, and 16 bit indices cap a surface at
65535 points; Long Triangle Point Index List (0066,0041) is the OL form
that lifts the cap, along with its Edge (0066,0042) and Vertex (0066,0043)
counterparts. Surfaces of a few million vertices are ordinary output from a
marching-cubes or surface-nets pipeline, so this is not an edge case.
Two things a reviewer should know, neither of them fixed here:
- The dictionary that ships with dcmjs still lists (0066,0041) as UL with
VM 3-3n. That is the definition CP-1365 left behind and CP-1499 ("Fix CP
1365 setback with Long xxx Index List VR") corrected to OL/1. Writing by
TAG is unaffected; writing by KEYWORD needs _vrMap to say which VR is
meant, which already works and now has a test. Regenerating the
dictionary is a separate change.
- OV (Other Very Long) is the same gap and is deliberately not included, to
keep this to one topic. It would be the same three lines.
#622 adds a binaryVRWordWidths table for byte swapping in Explicit VR Big
Endian; when both land, OL needs an entry of 4 there, since PS3.5 requires
swapping within each 32 bit word. The two branches do not otherwise touch
the same lines.
All seven tests fail without the change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
✅ Deploy Preview for dcmjs2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
wayfarer3130
approved these changes
Nov 11, 2026
|
🎉 This PR is included in version 0.52.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Nov 24, 2026
wayfarer3130
added a commit
that referenced
this pull request
Nov 25, 2026
* fix: support the OL (Other Long) value representation 1.0 port of #632 (commit 5b215ca). The Vrs registry in packages/core had no OL class, so createByTypeString("OL") fell back to UN. Add OtherLongString, a BinaryRepresentation like OF and OD, register it in Vrs, and give OL the seed flags "length32 single byteStream" in constants/vrs.js. These are the flags of 0.x: a 32 bit length, a single value, and not in the read-side singleVRs list. The 0.x test test/other-long.test.js moves to test/issues/pr632-other-long.test.js. Six of its seven tests fail without the change; the _vrMap test already passes. Other changes for OL: - The #457 contract test pinned OL as a UN fallback; it now pins only OV and SV. - test/core/registries.test.js uses OV as its unknown VR for registerVr, because OL is now registered. - The texts that said OL has no class change: the vrs.js comment, the registerVr example, REG-I-5 in docs/specs/registries-implementation.md, the createByTypeString comment, and the absentValues comment. - The bundle-size ceilings move to 1.081 and 1.063 for the new class. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: record that OL reads and writes as OL Maintainer decision Q2 of the review of the 1.0 port of #632: one line in docs/MIGRATION.md, and one bullet in beta-1-release-notes.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(core): support the SV and OV value representations Maintainer request on #653. Before, OV and SV fell back to UN, so an element could not be written with its own VR. - OV: OtherVeryLongString, a BinaryRepresentation with raw bytes, like OL. Seed flags "length32 single byteStream", the same as OL; OB, OW and OF also have readSingle, but OL and OV do not, so the exported singleVRs list does not change (REG-I-4). - SV: Signed64BitVeryLong extends Unsigned64BitVeryLong, which now takes the type and the stream accessor (BigUint64 or BigInt64). SV reads a BigInt with readBigInt64 and writes with writeBigInt64, and coerces a Number or a numeric string with BigInt(), as UV does. Seed flags "binary length32", the same as UV. - BufferStream.readBigInt64/writeBigInt64 and SplitDataView.getBigInt64/setBigInt64 mirror the BigUint64 methods. - VALID_VRS, BULKDATA_VRS, BINARY_VRS and the schema rules already listed OV and SV. No other code special-cases UV. Tests: test/issues/vr-sv-ov.test.js (OV bytes; SV negative, the 64 bit limits and a Number input) fails before this change. The #457 test and the registerVr test of test/core/registries.test.js now use codes that are not DICOM VRs (ZZ, QQ, XX), and the #457 once-per-type test now expects exactly one warning. test/core/absentValues.test.js no longer filters the "Invalid vr type" warning. Docs: the JSDoc of UV, SV and OV cites PS3.5 Section 6.2, Table 6.2-1. REG-I-5, the docs/MIGRATION.md OL line and the beta 1 release notes bullet now cover OV and SV. The bundle-size ceilings move to 1.083 and 1.065. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(generator): write SV and UV to DICOM JSON as a Number or a string DicomWebJsonWriter put the BigInt value of an SV or UV element in Value, and JSON.stringify threw. PS3.18 Table F.2.3-1 allows a Number or a String, so a safe integer is a Number and a larger value is a decimal string, as for DS and IS beyond 2^53. Also: rewrap a long JSDoc line, rename the #457 describe title, and raise the bundle ceilings to 1.086 and 1.067 after the merge of 1.0-beta (measured x1.0851 and x1.0666). Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
OLwas missing entirely.VRinstancesheld onlyOB,OD,OFandOW, socreateByTypeString("OL")fell through to the "Invalid vr type … - using UN" path. AnOLelement could not be written at all, and reading one produced an element whose VR was wrong on the
wire.
It is a stream of 32-bit words, so it behaves exactly like its siblings: a 32-bit length, a single
value, no multiplicity. The implementation is the same
BinaryRepresentationsubclass, plus"OL"in
length32VRsandsingleVRs.What needs it
The large mesh attributes of Surface Segmentation.
TrianglePointIndexList(0066,0023) isOW,and 16-bit indices cap a surface at 65 535 points.
LongTrianglePointIndexList(0066,0041) isthe
OLform that lifts the cap, with its Edge (0066,0042) and Vertex (0066,0043) counterparts.Surfaces of a few million vertices are ordinary output from a marching-cubes or surface-nets
pipeline — the case that prompted this was 6 million — so the
OWcap is reached routinely ratherthan exceptionally.
Two things for a reviewer, neither fixed here
ULwith VM3-3n. That is the definitionCP-1365 left behind and CP-1499
("Fix CP 1365 setback with Long xxx Index List VR") corrected to
OL/1. Writing by tag isunaffected; writing by keyword needs
_vrMapto say which VR is meant, which already worksand now has a test. Regenerating the dictionary is a separate change, and since the dictionary is
generated rather than hand-edited it did not belong in this PR.
OV(Other Very Long) is the same gap, deliberately left out to keep this to one topic. Itwould be the same three lines.
Interaction with #622
#622 adds a
binaryVRWordWidthstable for byte swapping in Explicit VR Big Endian. When both land,OLneeds an entry of4there, since PS3.5 requires swapping within each 32-bit word. The twobranches do not otherwise touch the same lines, so they merge cleanly in either order — this one is
based on
master, not on #622.Tests
test/other-long.test.js, 7 tests: thatOLresolves to a real VR rather thanUNand reports a32-bit length and no multiplicity; a round trip of values above
0xFFFF; the bytes on the wirecarrying
OLand a 32-bit length; a 600 000-index surface; an empty value; the_vrMaproute forwriting by keyword; and a lossless re-encode.
All seven fail without the change.
Full suite: 26 suites / 361 tests.
Disclosure
AI-assisted (Claude), per the process in #517.