@dcmjs-org/imaging 0.0.0-bootstrap.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/License.txt +22 -0
- package/README.md +252 -0
- package/dist/index.cjs +692 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +683 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +23 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/derivedImageAttributes.js","../src/buildImageDataset.js","../src/jpegInfo.js","../src/h264.js"],"sourcesContent":["// packages/imaging/src/derivedImageAttributes.js\n//\n// The attributes that mark an image as derived from other images, and the\n// base block that adds them to a composition.\n\nimport { log } from \"@dcmjs-org/core\";\n\nconst REQUIRED_KEYS = [\"SOPClassUID\", \"SOPInstanceUID\"];\n\n/** True when a source says that it was lossy compressed (\"01\"). */\nfunction isLossySource(source) {\n return [].concat(source.LossyImageCompression).includes(\"01\");\n}\n\n/** The derivedFrom list; an empty list throws. */\nfunction sourceList(derivedFrom, caller) {\n const sources = [].concat(derivedFrom ?? []);\n if (!sources.length) {\n throw new Error(`${caller}: derivedFrom needs at least one instance`);\n }\n return sources;\n}\n\n/** The values of a multi-valued attribute as a list, without empty values. */\nfunction valueList(value) {\n return [].concat(value ?? []).filter(item => item !== \"\" && item !== null);\n}\n\n/** One value as itself, several values as an array, none as undefined. */\nfunction multiValue(values) {\n return values.length > 1 ? values : values[0];\n}\n\n/**\n * The attributes of an image that is derived from other images. The function\n * returns only these attributes; it does not change any input.\n *\n * - `ImageType`: `[\"DERIVED\", \"SECONDARY\"]`.\n * - `SourceImageSequence`: one item for each `derivedFrom` instance, in\n * order, with `ReferencedSOPClassUID` and `ReferencedSOPInstanceUID`.\n * - `LossyImageCompression`: `\"01\"` by default, `\"00\"` for `lossy: false`.\n * When a source has `\"01\"`, the result is `\"01\"` also for `lossy: false`,\n * because a lossy image stays lossy (PS3.3 C.7.6.1.1.5).\n * - `LossyImageCompressionMethod` and `LossyImageCompressionRatio`: the\n * values of each lossy source, in `derivedFrom` order, then `method` and\n * `ratio` of a `lossy` object (PS3.3 C.7.6.1.1.5 keeps every lossy step).\n * One value is a plain value; more values are an array. When the\n * number of ratios differs from the number of methods, the result has no\n * ratio, and the function logs a warning.\n *\n * Each `derivedFrom` item is a naturalized instance, full or partial. It must\n * have `SOPClassUID` and `SOPInstanceUID`; the function throws an error that\n * names a missing keyword. An empty `derivedFrom` throws.\n *\n * @param {Object|Object[]} derivedFrom - the source instance(s), at least one\n * @param {Object} [options]\n * @param {boolean|{method: string, ratio: number}} [options.lossy=true]\n * @returns {Object} the derived-image attributes\n */\nexport function derivedImageAttributes(derivedFrom, { lossy } = {}) {\n const sources = sourceList(derivedFrom, \"derivedImageAttributes\");\n const SourceImageSequence = sources.map((source, index) => {\n const missing = REQUIRED_KEYS.filter(key => !source?.[key]);\n if (missing.length) {\n throw new Error(\n `derivedImageAttributes: derivedFrom[${index}] is missing ` +\n `${missing.join(\" and \")}; each derivedFrom instance ` +\n `needs SOPClassUID and SOPInstanceUID`\n );\n }\n return {\n ReferencedSOPClassUID: source.SOPClassUID,\n ReferencedSOPInstanceUID: source.SOPInstanceUID\n };\n });\n\n const lossySources = sources.filter(isLossySource);\n const lossless = lossy === false && !lossySources.length;\n const attributes = {\n ImageType: [\"DERIVED\", \"SECONDARY\"],\n SourceImageSequence,\n LossyImageCompression: lossless ? \"00\" : \"01\"\n };\n const detail = lossy && typeof lossy === \"object\" ? lossy : {};\n const methods = lossySources.flatMap(source =>\n valueList(source.LossyImageCompressionMethod)\n );\n const ratios = lossySources.flatMap(source =>\n valueList(source.LossyImageCompressionRatio)\n );\n methods.push(...valueList(detail.method));\n ratios.push(...valueList(detail.ratio));\n if (methods.length) {\n attributes.LossyImageCompressionMethod = multiValue(methods);\n }\n if (ratios.length === methods.length) {\n if (ratios.length) {\n attributes.LossyImageCompressionRatio = multiValue(ratios);\n }\n } else if (ratios.length) {\n log.warn(\n `derivedImageAttributes: ${methods.length} lossy method(s) and ` +\n `${ratios.length} ratio(s) do not pair; the result has no ` +\n `LossyImageCompressionRatio`\n );\n }\n return attributes;\n}\n\n/**\n * A base block that adds {@link derivedImageAttributes} to a composition, in\n * the same shape as `nextSeriesNumberBase`. Put it after the block that sets\n * the default `ImageType` (`secondaryCaptureImageBase`), so that the derived\n * `ImageType` replaces the default. `buildImageDataset` adds it for\n * `derivedFrom`; a caller can also add it to a custom `baseDicom`. An empty\n * `derivedFrom` throws when the block is made.\n *\n * @param {Object|Object[]} derivedFrom - the source instance(s), at least one\n * @param {Object} [options]\n * @param {boolean|{method: string, ratio: number}} [options.lossy=true]\n * @returns {Function} a base block\n */\nexport function derivedImageBase(derivedFrom, { lossy } = {}) {\n const sources = sourceList(derivedFrom, \"derivedImageBase\");\n return () => derivedImageAttributes(sources, { lossy });\n}\n","// packages/imaging/src/buildImageDataset.js\n//\n// Build a full DICOM image instance from already-decoded pixels — the\n// codec-free image primitive of dcmjs. dcmjs deliberately ships no PNG/JPEG\n// codecs (browser + node compatible); callers decode with whatever fits\n// their environment (Canvas, pngjs, ...) and hand over pixels plus\n// geometry. Like encapsulate, this builds on createInstance and takes\n// the same options (attributes in `overrides`, a naturalized DICOM\n// provider), and returns a naturalized dataset ready for\n// datasetToDict()/datasetToBuffer().\n\nimport {\n combineBases,\n createInstance,\n defaultInstanceBase,\n EXPLICIT_LITTLE_ENDIAN\n} from \"@dcmjs-org/core\";\nimport { derivedImageBase } from \"./derivedImageAttributes.js\";\n\nconst SECONDARY_CAPTURE_SOP_CLASS_UID = \"1.2.840.10008.5.1.4.1.1.7\";\n\n/**\n * Secondary Capture identity, the default `ImageType` (ORIGINAL\\PRIMARY),\n * the SC Equipment `ConversionType` (WSD, workstation), and the Image module\n * content date and time.\n */\nfunction secondaryCaptureImageBase(context) {\n return {\n SOPClassUID: SECONDARY_CAPTURE_SOP_CLASS_UID,\n Modality: \"OT\",\n ConversionType: \"WSD\",\n ImageType: [\"ORIGINAL\", \"PRIMARY\"],\n ContentDate: context.date,\n ContentTime: context.time\n };\n}\n\n/**\n * The default base of `buildImageDataset`: core instance defaults and the\n * Secondary Capture block. It has no `predecessorBase`, so\n * `predecessor: true` has no effect; use\n * `combineBases(imageBase, predecessorBase)` for a predecessor\n * (CORE-USR-9). Use `.items` to build a variant.\n */\nconst imageBase = combineBases(defaultInstanceBase, secondaryCaptureImageBase);\n\n// The decodedImage field of each geometry keyword (IMG-USR-2).\nconst GEOMETRY_FIELDS = {\n Rows: \"rows\",\n Columns: \"columns\",\n SamplesPerPixel: \"samplesPerPixel\",\n PhotometricInterpretation: \"photometricInterpretation\",\n BitsAllocated: \"bitsAllocated\",\n BitsStored: \"bitsStored\",\n HighBit: \"highBit\",\n PixelRepresentation: \"pixelRepresentation\",\n PlanarConfiguration: \"planarConfiguration\",\n NumberOfFrames: \"numberOfFrames\"\n};\n\nconst isPresent = value =>\n value !== undefined && value !== null && value !== \"\";\n\n/** The single value of a naturalized attribute, or undefined when empty. */\nfunction singleValue(value) {\n const single = Array.isArray(value) ? value[0] : value;\n return isPresent(single) ? single : undefined;\n}\n\n/**\n * Normalize a typed-array view to an exact ArrayBuffer. Another value is\n * returned as it is; the function does not check the type (CORE-IMP-11).\n */\nfunction toExactArrayBuffer(bytes) {\n if (ArrayBuffer.isView(bytes)) {\n return bytes.buffer.slice(\n bytes.byteOffset,\n bytes.byteOffset + bytes.byteLength\n );\n }\n return bytes;\n}\n\n/**\n * The geometry that the decoded input gives (IMG-USR-2): each explicit\n * `decodedImage` field, plus the values that the payload determines.\n * `BitsAllocated` comes from the typed-array width of `pixels`,\n * `PixelRepresentation` 1 from a signed typed array, and `NumberOfFrames`\n * from `encapsulated.frames.length`. Without `decodedImage.highBit`, a\n * decoded `bitsStored` gives `HighBit` = `bitsStored` - 1. The result has no\n * key for a value that the decoded input does not give: the builder\n * calculates no other value.\n */\nfunction decodedGeometry(decodedImage, encapsulated) {\n const geometry = {};\n for (const [keyword, field] of Object.entries(GEOMETRY_FIELDS)) {\n if (isPresent(decodedImage[field])) {\n geometry[keyword] = decodedImage[field];\n }\n }\n if (geometry.HighBit === undefined && geometry.BitsStored !== undefined) {\n geometry.HighBit = geometry.BitsStored - 1;\n }\n const { pixels } = decodedImage;\n if (!encapsulated) {\n // The typed array gives BitsAllocated and PixelRepresentation, so\n // a float array would write integer pixels (IMG-USR-9).\n if (pixels instanceof Float32Array || pixels instanceof Float64Array) {\n throw new Error(\n `buildImageDataset: decodedImage.pixels is a ` +\n `${pixels.constructor.name}; DICOM integer pixel data ` +\n `needs an integer typed array`\n );\n }\n const elementBits = pixels.BYTES_PER_ELEMENT * 8;\n if (\n geometry.BitsAllocated !== undefined &&\n geometry.BitsAllocated !== elementBits\n ) {\n throw new Error(\n `buildImageDataset: bitsAllocated ${geometry.BitsAllocated} ` +\n `does not match the ${elementBits}-bit typed array provided`\n );\n }\n geometry.BitsAllocated = elementBits;\n if (\n geometry.PixelRepresentation === undefined &&\n (pixels instanceof Int8Array ||\n pixels instanceof Int16Array ||\n pixels instanceof Int32Array)\n ) {\n geometry.PixelRepresentation = 1;\n }\n } else {\n // The fragment list is the ground truth for the frame count. An\n // explicit count that disagrees hides frames (review finding 10).\n const frameCount = encapsulated.frames.length;\n if (\n geometry.NumberOfFrames !== undefined &&\n geometry.NumberOfFrames !== frameCount\n ) {\n throw new Error(\n `buildImageDataset: decodedImage.numberOfFrames ` +\n `(${geometry.NumberOfFrames}) does not match ` +\n `options.encapsulated.frames.length (${frameCount})`\n );\n }\n geometry.NumberOfFrames = frameCount;\n }\n return geometry;\n}\n\n/**\n * The requirement checks of IMG-USR-9 on the effective values: the decoded\n * value, else the value of `dataset` (base, inherited, or override).\n * `Rows` and `Columns` must be positive integers, so one of the two sources\n * must give them. For another absent value, the check uses the old default\n * only inside the computation, and does not write it: `SamplesPerPixel` 1\n * and `NumberOfFrames` 1. The photometric check needs a\n * `PhotometricInterpretation`.\n */\nfunction checkGeometry(geometry, dataset, pixels) {\n const effective = keyword =>\n geometry[keyword] !== undefined\n ? geometry[keyword]\n : singleValue(dataset[keyword]);\n for (const keyword of [\"Rows\", \"Columns\"]) {\n const value = effective(keyword);\n if (!Number.isInteger(value) || value <= 0) {\n throw new Error(\n `buildImageDataset: ${keyword} must be a positive integer ` +\n `(decodedImage.${GEOMETRY_FIELDS[keyword]}, or the ` +\n `merged dataset), got ${value}`\n );\n }\n }\n const samplesPerPixel = effective(\"SamplesPerPixel\") ?? 1;\n const photometricInterpretation = effective(\"PhotometricInterpretation\");\n\n if (photometricInterpretation !== undefined) {\n const monochrome = /^MONOCHROME[12]$/.test(photometricInterpretation);\n const color = /^(RGB|YBR_)/.test(photometricInterpretation);\n if (monochrome && samplesPerPixel !== 1) {\n throw new Error(\n `buildImageDataset: ${photometricInterpretation} requires ` +\n `samplesPerPixel 1, got ${samplesPerPixel}`\n );\n }\n if (color && samplesPerPixel !== 3) {\n throw new Error(\n `buildImageDataset: ${photometricInterpretation} requires ` +\n `samplesPerPixel 3, got ${samplesPerPixel}`\n );\n }\n }\n\n if (!pixels) {\n return;\n }\n const rows = effective(\"Rows\");\n const columns = effective(\"Columns\");\n const numberOfFrames = effective(\"NumberOfFrames\") ?? 1;\n // Native pixels always give BitsAllocated (decodedGeometry).\n const bitsAllocated = geometry.BitsAllocated;\n const expected =\n rows * columns * samplesPerPixel * numberOfFrames * (bitsAllocated / 8);\n if (pixels.byteLength !== expected) {\n throw new Error(\n `buildImageDataset: pixel buffer is ${pixels.byteLength} ` +\n `bytes but ${rows}x${columns}x${samplesPerPixel}` +\n `${numberOfFrames > 1 ? `x${numberOfFrames} frames` : \"\"} at ` +\n `${bitsAllocated} bits needs ${expected} — fix the geometry ` +\n `or the decode`\n );\n }\n}\n\n/**\n * Build a naturalized DICOM image dataset from decoded pixels with\n * {@link createInstance}, then set the pixel data.\n *\n * The options follow CORE-USR-1 (`packages/core/README.md`); the image rules\n * are IMG-USR-n in `packages/imaging/README.md`. The options object holds\n * the controls; the DICOM attributes go in `options.overrides`, a\n * naturalized DICOM provider with the forms of `baseDicom`. An extra option\n * key has no effect (CORE-USR-7). With `dataLevel: \"series\"`, `instance` is\n * the sample instance in the series (CORE-USR-5).\n *\n * For a non-empty `derivedFrom`, the base is\n * `combineBases(baseDicom, derivedImageBase(derivedFrom, { lossy }))`\n * (IMG-IMP-1). The builder removes its control keys `derivedFrom`, `lossy`,\n * and `encapsulated` before the call (CORE-IMP-9). After the call, it\n * checks the effective geometry (IMG-USR-9), writes only the geometry that\n * the decoded input gives (IMG-USR-2), and sets the pixel encoding and\n * `PixelData`.\n *\n * @example\n * buildImageDataset(decodedImage, {\n * instance,\n * derivedFrom: source,\n * overrides: { SeriesDescription: \"Thumbnail\" }\n * });\n *\n * @param {Object} decodedImage - the decoded pixels and geometry. Each\n * geometry field has no default. A field that is not given writes\n * nothing, and the value of the base, `instance`, or `overrides` stays.\n * @param {Uint8Array|Int8Array|Uint16Array|Int16Array} [decodedImage.pixels]\n * interleaved decoded samples in an integer typed array; required unless\n * options.encapsulated\n * @param {number} [decodedImage.rows] else the merged `Rows`\n * @param {number} [decodedImage.columns] else the merged `Columns`\n * @param {number} [decodedImage.samplesPerPixel]\n * @param {string} [decodedImage.photometricInterpretation]\n * @param {number} [decodedImage.bitsAllocated] must match the typed-array\n * width of `pixels`, which always gives `BitsAllocated`\n * @param {number} [decodedImage.bitsStored]\n * @param {number} [decodedImage.highBit] else `bitsStored` - 1 when\n * `decodedImage.bitsStored` is given\n * @param {number} [decodedImage.pixelRepresentation] else 1 for a signed\n * typed array\n * @param {number} [decodedImage.planarConfiguration] written only when the\n * effective `SamplesPerPixel` is more than 1\n * @param {number} [decodedImage.numberOfFrames] must match\n * `encapsulated.frames.length`, which always gives `NumberOfFrames`\n * @param {Object} [options] - the {@link createInstance} options\n * (`instance`, `dataLevel`, `levels`, `predecessor`, `postProcess`,\n * `overrides`), plus:\n * @param {*} [options.baseDicom=imageBase] - base blocks\n * @param {Object|Object[]} [options.derivedFrom] - the naturalized\n * instance(s) that the image is derived from; each needs SOPClassUID and\n * SOPInstanceUID. An empty array is the same as no `derivedFrom`.\n * @param {boolean|{method: string, ratio: number}} [options.lossy=true] -\n * the lossy compression of a derivation; no effect without `derivedFrom`\n * @param {{transferSyntaxUID: string, frames: Array}} [options.encapsulated]\n * - pre-encoded frames and their transfer syntax, in place of pixels\n * @returns {Object} naturalized dataset with _meta and _vrMap\n */\nfunction buildImageDataset(decodedImage = {}, options = {}) {\n const {\n baseDicom = imageBase,\n derivedFrom,\n lossy,\n encapsulated,\n ...rest\n } = options;\n if (decodedImage.pixels && encapsulated) {\n throw new Error(\n \"buildImageDataset: pass either decodedImage.pixels or \" +\n \"options.encapsulated, not both\"\n );\n }\n\n // The transfer syntax and the frames are used below (IMG-USR-9).\n if (\n encapsulated &&\n (!encapsulated.transferSyntaxUID || !encapsulated.frames?.length)\n ) {\n throw new Error(\n \"buildImageDataset: options.encapsulated needs \" +\n \"{ transferSyntaxUID, frames: [bytes, ...] }\"\n );\n }\n\n const geometry = decodedGeometry(decodedImage, encapsulated);\n\n const sources = [].concat(derivedFrom ?? []);\n const dataset = createInstance({\n ...rest,\n baseDicom: sources.length\n ? combineBases(baseDicom, derivedImageBase(sources, { lossy }))\n : baseDicom\n });\n checkGeometry(geometry, dataset, !encapsulated && decodedImage.pixels);\n\n // A decoded value replaces the base, inherited, or override value. A\n // value that the decoded input does not give stays (IMG-USR-2).\n const { PlanarConfiguration, NumberOfFrames, ...always } = geometry;\n Object.assign(dataset, always);\n if (\n PlanarConfiguration !== undefined &&\n singleValue(dataset.SamplesPerPixel) > 1\n ) {\n dataset.PlanarConfiguration = PlanarConfiguration;\n }\n // A single-frame IOD has no NumberOfFrames, so a frame count of 1 from\n // frames.length is written only to replace an existing value.\n if (\n NumberOfFrames !== undefined &&\n (NumberOfFrames > 1 ||\n isPresent(decodedImage.numberOfFrames) ||\n isPresent(dataset.NumberOfFrames))\n ) {\n dataset.NumberOfFrames = NumberOfFrames;\n }\n // Encapsulated pixel data is always OB (PS3.5 A.4).\n dataset._vrMap = {\n ...(dataset._vrMap || {}),\n PixelData:\n !encapsulated && singleValue(dataset.BitsAllocated) === 16\n ? \"OW\"\n : \"OB\"\n };\n // instanceBase supplies Explicit VR Little Endian; set the transfer\n // syntax only for encapsulated frames, or when the merged _meta has no\n // transfer syntax. The copy keeps overrides._meta of the caller\n // unchanged (CORE-USR-13).\n const hasTransferSyntax = Boolean(dataset._meta?.TransferSyntaxUID);\n dataset._meta = { ...(dataset._meta || {}) };\n if (encapsulated || !hasTransferSyntax) {\n dataset._meta.TransferSyntaxUID = {\n Value: [\n encapsulated\n ? encapsulated.transferSyntaxUID\n : EXPLICIT_LITTLE_ENDIAN\n ]\n };\n }\n\n dataset.PixelData = encapsulated\n ? encapsulated.frames.map(frame => toExactArrayBuffer(frame))\n : toExactArrayBuffer(decodedImage.pixels);\n\n return dataset;\n}\n\nexport {\n buildImageDataset,\n imageBase,\n secondaryCaptureImageBase,\n SECONDARY_CAPTURE_SOP_CLASS_UID\n};\n","// src/image/jpegInfo.js\n//\n// Minimal JPEG header inspection: read the SOF (start-of-frame) segment to\n// recover the geometry DICOM needs (Rows/Columns/SamplesPerPixel/precision)\n// and identify the matching transfer syntax — WITHOUT decoding any pixels.\n// JPEG is a legal DICOM transfer syntax, so JPEG bytes can be carried as\n// encapsulated PixelData verbatim; only the frame header must be understood.\n\nconst JPEG_BASELINE_TS = \"1.2.840.10008.1.2.4.50\"; // SOF0, process 1\nconst JPEG_EXTENDED_TS = \"1.2.840.10008.1.2.4.51\"; // SOF1, processes 2 & 4\nconst JPEG_LOSSLESS_TS = \"1.2.840.10008.1.2.4.57\"; // SOF3, process 14\n\nconst LOSSLESS_SOF_MARKERS = new Set([0xc3, 0xc7, 0xcb, 0xcf]);\nconst RGB_COMPONENT_IDS = [0x52, 0x47, 0x42]; // \"R\", \"G\", \"B\"\n\n/**\n * The PhotometricInterpretation of the compressed data (PS3.5 8.2.1), or\n * null when DICOM has no value for it (for example 4-component CMYK).\n *\n * - 1 component: MONOCHROME2.\n * - 3 components: RGB when the data has no colour transform, that is an\n * Adobe APP14 transform of 0, the component IDs \"R\", \"G\", \"B\", or a\n * lossless process. Otherwise YBR_FULL when no component is subsampled,\n * and YBR_FULL_422 when the chroma is subsampled.\n */\nfunction photometricInterpretation(sofMarker, components, adobeTransform) {\n if (components.length === 1) {\n return \"MONOCHROME2\";\n }\n if (components.length !== 3) {\n return null;\n }\n const isRgb =\n adobeTransform === 0 ||\n (adobeTransform === undefined &&\n components.every((c, i) => c.id === RGB_COMPONENT_IDS[i])) ||\n (adobeTransform === undefined && LOSSLESS_SOF_MARKERS.has(sofMarker));\n if (isRgb) {\n return \"RGB\";\n }\n const subsampled = components.some(\n c => c.sampling !== components[0].sampling\n );\n return subsampled ? \"YBR_FULL_422\" : \"YBR_FULL\";\n}\n\n/**\n * Read the JPEG frame header. The DICOM values are ready for\n * buildImageDataset: `bitsAllocated` is 8 or 16, `bitsStored` is the sample\n * precision, and `photometricInterpretation` follows PS3.5 8.2.1.\n *\n * @param {Uint8Array} bytes - JPEG file bytes (SOI onward)\n * @returns {{ rows, columns, samplesPerPixel, bitsAllocated, bitsStored,\n * photometricInterpretation: string|null,\n * transferSyntaxUID: string|null, sofMarker: number }}\n * @throws on non-JPEG input or a missing frame header\n */\nexport function parseJpegInfo(bytes) {\n if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8) {\n throw new Error(\"parseJpegInfo: input is not JPEG (missing SOI)\");\n }\n\n let adobeTransform;\n let offset = 2;\n while (offset + 4 <= bytes.length) {\n if (bytes[offset] !== 0xff) {\n offset++;\n continue;\n }\n const marker = bytes[offset + 1];\n // standalone markers without a length field\n if (marker === 0xd8 || (marker >= 0xd0 && marker <= 0xd7)) {\n offset += 2;\n continue;\n }\n if (marker === 0xd9 || marker === 0xda) {\n break; // EOI or start-of-scan: no SOF was seen\n }\n const length = (bytes[offset + 2] << 8) | bytes[offset + 3];\n\n // APP14 \"Adobe\": the transform byte follows \"Adobe\", the version,\n // and two flag words.\n if (\n marker === 0xee &&\n length >= 14 &&\n offset + 2 + length <= bytes.length &&\n String.fromCharCode(...bytes.subarray(offset + 4, offset + 9)) ===\n \"Adobe\"\n ) {\n adobeTransform = bytes[offset + 15];\n }\n\n // SOF0-SOF15, excluding DHT (C4), JPG (C8), DAC (CC)\n const isSof =\n marker >= 0xc0 &&\n marker <= 0xcf &&\n marker !== 0xc4 &&\n marker !== 0xc8 &&\n marker !== 0xcc;\n if (isSof) {\n // The six SOF fields span bytes[offset+4 .. offset+9], and the\n // declared segment must fit inside the input. Out-of-range reads\n // coerce to 0 in the bitwise math below, so a truncated JPEG\n // would silently return wrong geometry (review finding 9).\n const p = offset + 4;\n const samplesPerPixel = bytes[p + 5];\n if (\n length < 8 + 3 * (samplesPerPixel || 0) ||\n offset + 2 + length > bytes.length\n ) {\n throw new Error(\n \"parseJpegInfo: truncated SOF segment — the frame header does not fit in the input\"\n );\n }\n const components = [];\n for (let i = 0; i < samplesPerPixel; i++) {\n components.push({\n id: bytes[p + 6 + 3 * i],\n sampling: bytes[p + 7 + 3 * i]\n });\n }\n const precision = bytes[p];\n const info = {\n sofMarker: marker,\n bitsAllocated: precision > 8 ? 16 : 8,\n bitsStored: precision,\n rows: (bytes[p + 1] << 8) | bytes[p + 2],\n columns: (bytes[p + 3] << 8) | bytes[p + 4],\n samplesPerPixel,\n photometricInterpretation: photometricInterpretation(\n marker,\n components,\n adobeTransform\n ),\n transferSyntaxUID: null\n };\n if (marker === 0xc0) {\n info.transferSyntaxUID = JPEG_BASELINE_TS;\n } else if (marker === 0xc1) {\n info.transferSyntaxUID = JPEG_EXTENDED_TS;\n } else if (marker === 0xc3) {\n info.transferSyntaxUID = JPEG_LOSSLESS_TS;\n }\n // other SOFs (progressive C2, arithmetic, hierarchical) have no\n // DICOM transfer syntax — transferSyntaxUID stays null and the\n // caller decides how loudly to complain.\n return info;\n }\n offset += 2 + length;\n }\n throw new Error(\n \"parseJpegInfo: no frame header (SOF) found — truncated or invalid JPEG\"\n );\n}\n","// packages/imaging/src/h264.js\n//\n// H.264 profile/level → DICOM transfer syntax mapping. Pure lookup, no codec\n// and no MP4 container knowledge — just the rule that says which encapsulated\n// transfer syntax can carry a given AVC stream (Supplement 225). Lives in\n// imaging because it's shared: video's MP4 header inspection uses it to label\n// a stream, and image builders can use it too.\n\n// Fragmentable MPEG-4 AVC/H.264 High Profile transfer syntaxes (Sup 225).\n// The fragmentable \".1\" family is always chosen because the encapsulation\n// writer emits the stream as N >= 1 fragments.\nconst H264_HIGH_41_FRAGMENTABLE = \"1.2.840.10008.1.2.4.102.1\";\nconst H264_HIGH_42_FRAGMENTABLE = \"1.2.840.10008.1.2.4.104.1\";\n\n// AVC profile_idc values that fit inside the \"High Profile\" transfer\n// syntaxes: Baseline (66) and Main (77) are strict subsets of High (100).\nconst H264_SUPPORTED_PROFILES = new Set([66, 77, 100]);\n\n/**\n * Map an AVC profile/level pair to the DICOM transfer syntax that carries it,\n * or null when no defined syntax fits (High-10/422/444 profiles, levels above\n * 4.2, HEVC, ...). level_idc is the H.264 level times ten (41 = Level 4.1).\n *\n * @param {number} profileIdc\n * @param {number} levelIdc\n * @returns {string|null}\n */\nexport function h264TransferSyntaxUID(profileIdc, levelIdc) {\n if (!H264_SUPPORTED_PROFILES.has(profileIdc)) {\n return null;\n }\n if (levelIdc <= 41) {\n return H264_HIGH_41_FRAGMENTABLE;\n }\n if (levelIdc === 42) {\n return H264_HIGH_42_FRAGMENTABLE;\n }\n return null;\n}\n"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;;AAIA,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAC;;AAEvD;AACA,SAAS,aAAa,CAAC,MAAM,EAAE;AAC/B,IAAI,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;AACjE;;AAEA;AACA,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
@@ -1,11 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcmjs-org/imaging",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
|
+
"description": "Lightweight, codec-free image building for dcmjs: turn already-decoded pixels into a conformant DICOM image instance, and inspect JPEG/H.264 headers without decoding. The heavy MP4/video processing lives in @dcmjs-org/video",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.mjs",
|
|
9
|
+
"require": "./dist/index.cjs"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
5
17
|
"license": "MIT",
|
|
6
18
|
"repository": {
|
|
7
19
|
"type": "git",
|
|
8
20
|
"url": "git+https://github.com/dcmjs-org/dcmjs.git",
|
|
9
21
|
"directory": "packages/imaging"
|
|
10
|
-
}
|
|
11
|
-
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@dcmjs-org/core": "1.0.0-beta.10"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rollup -c ../../rollup.packages.config.mjs"
|
|
28
|
+
},
|
|
29
|
+
"module": "./dist/index.mjs"
|
|
30
|
+
}
|