@abasb75/dicom-parser 0.0.1-test → 0.0.3-a

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/README.md CHANGED
@@ -1,68 +1,24 @@
1
- # @abasb75/dicom-parser
1
+ # DICOM Parser
2
2
 
3
- ```sh
4
- npm i @abasb75/dicom-parser --save
5
- ```
6
-
7
-
8
- #Usage
9
-
10
- 1. For Download dicom and parse from url:
11
-
12
- ```javascript
13
- import { loadAndParseFromUrl } from "@abasb75/dicom-parser";
14
-
15
- ...
16
- const url = "....dcm";
17
- loadAndParseFromUrl(url)
18
- .then(dataset=>{
19
- console.log(dataset);
20
- })
21
- .catch(err=>{
22
- console.log(error);
23
- })
24
-
25
- ```
26
-
27
-
28
- 2. For parse dataset from local files:
3
+ A lightweight and simple DICOM parser designed for browser and Node.js environments.
4
+ This library extracts metadata and pixel information from raw DICOM files using a clean and intuitive API.
29
5
 
30
- ```javascript
31
- import { loadAndParseFromFiles } from "@abasb75/dicom-parser";
6
+ ---
32
7
 
33
- ...
34
-
35
- loadAndParseFromFiles(file)
36
- .then(dataset=>{
37
- console.log(dataset);
38
- })
39
- .catch(err=>{
40
- console.log(error);
41
- });
42
-
43
- ```
44
-
45
- 3. For parsing arrayBuffer:
46
-
47
- ```javascript
48
- import { parse } from "@abasb75/dicom-parser";
49
-
50
- ...
51
-
52
- const dataset = parse(arrayBuffer);
8
+ ## 📦 Installation
53
9
 
10
+ ```bash
11
+ npm install @abasb75/dicom-parser
54
12
  ```
55
13
 
14
+ ## 🚀 Usage
56
15
 
57
- 4. Getting value for dicom tag
58
-
59
- ```javascript
16
+ To use this library, you must provide the ArrayBuffer of a DICOM file.
60
17
 
61
- ...
18
+ ```js
19
+ import { parse } from '@abasb75/dicom-parser';
62
20
 
63
- const transferSyntaxUID = dataset.get(0x0002,0x0010);
64
- const transferSyntaxUID = dataset.string(0x0002,0x0010);
21
+ const dataset = parse(dicomBuffer as ArrayBuffer);
65
22
 
66
- ...
67
-
68
- ```
23
+ console.log({ dataset });
24
+ ```
@@ -0,0 +1,138 @@
1
+ interface DicomVOILutModule {
2
+ voiLUTFunction: string;
3
+ windowWidth: number | undefined;
4
+ windowCenter: number | undefined;
5
+ voiLUTSequence: unknown;
6
+ lutDescriptor: any;
7
+ lutExplanation: any;
8
+ lutData: any;
9
+ windowCenterAndWidthExplanation: string;
10
+ }
11
+ interface DicomPatientModule {
12
+ patientName: string;
13
+ patientID: string;
14
+ typeofPatientID: string;
15
+ patientSex: string;
16
+ patientBirthDate: string;
17
+ patientAge: string;
18
+ patientSize: string;
19
+ otherPatientIDs: string;
20
+ otherPatientNames: string;
21
+ patientWeight: string;
22
+ }
23
+ interface DicomPixelModule {
24
+ photometricInterpretation: string;
25
+ numberOfFrames: number | undefined;
26
+ pixelRepresentation: number | undefined;
27
+ pixelSpacing: any | undefined;
28
+ rows: number | number | undefined;
29
+ columns: number | number | undefined;
30
+ bitsAllocated: number | undefined;
31
+ highBit: number | undefined;
32
+ bitsStored: number | undefined;
33
+ samplesPerPixel: number | undefined;
34
+ pixelDataProviderURL: any;
35
+ pixelPaddingRangeLimit: any;
36
+ extendedOffsetTable: any;
37
+ extendedOffsetTableLengths: any;
38
+ pixelAspectRatio: any;
39
+ planarConfiguration: number | undefined;
40
+ redPaletteColorLookupTableDescriptor: unknown;
41
+ greenPaletteColorLookupTableDescriptor: unknown;
42
+ bluePaletteColorLookupTableDescriptor: unknown;
43
+ alphaPaletteColorLookupTableDescriptor: unknown;
44
+ redPaletteColorLookupTableData: any;
45
+ greenPaletteColorLookupTableData: any;
46
+ bluePaletteColorLookupTableData: any;
47
+ alphaPaletteColorLookupTableData: any;
48
+ segmentedRedPaletteColorLookupTableData: any;
49
+ segmentedGreenPaletteColorLookupTableData: any;
50
+ segmentedBluePaletteColorLookupTableData: any;
51
+ segmentedAlphaPaletteColorLookupTableData: any;
52
+ pixelMeasuresSequence: any;
53
+ spacingBetweenSlices: any;
54
+ }
55
+ interface DicomScalingModule {
56
+ rescaleSlope: number | undefined;
57
+ rescaleIntercept: number | undefined;
58
+ modality: string;
59
+ rescaleType: any;
60
+ }
61
+ interface PaletteColorDataColor {
62
+ data: Uint8Array[] | Uint16Array[];
63
+ firstInputValueMapped: number;
64
+ lutEntries: number;
65
+ bitsPerEntry: number;
66
+ littleEndian: boolean;
67
+ }
68
+ interface PaletteColorData {
69
+ red: PaletteColorDataColor | undefined;
70
+ green: PaletteColorDataColor | undefined;
71
+ blue: PaletteColorDataColor | undefined;
72
+ alpha: PaletteColorDataColor | undefined;
73
+ }
74
+
75
+ interface DatasetProperties {
76
+ littleEndian: boolean;
77
+ implicit: boolean;
78
+ elements: {
79
+ [key: string]: any;
80
+ };
81
+ bytes: Uint8Array;
82
+ transferSyntaxUID?: string | undefined | null;
83
+ prefix?: string | undefined | null;
84
+ metadata?: {
85
+ [key: string]: any;
86
+ } | undefined | null;
87
+ deflated?: boolean | undefined | null;
88
+ }
89
+ declare class Dataset {
90
+ static Float: string;
91
+ static Integer: string;
92
+ littleEndian: boolean;
93
+ implicit: boolean;
94
+ elements: {
95
+ [key: string]: any;
96
+ };
97
+ transferSyntaxUID: string | null | undefined;
98
+ prefix?: string | undefined | null;
99
+ metadata?: {
100
+ [key: string]: any;
101
+ } | undefined | null;
102
+ deflated?: boolean | undefined | null;
103
+ bytes: Uint8Array;
104
+ /** modules */
105
+ voiLUTModule: DicomVOILutModule | null;
106
+ patientModule: DicomPatientModule | null;
107
+ pixelModule: DicomPixelModule | null;
108
+ scalingModule: DicomScalingModule | null;
109
+ constructor(properties: DatasetProperties);
110
+ get(group: number | string, element?: number | null | undefined): any;
111
+ date(group: number, element: number): any;
112
+ int(group: number, element: number): number | number[];
113
+ float(group: number, element: number): number | number[];
114
+ time(group: number, element: number): any;
115
+ getGeometricTags(tagName: string, frameIndex?: number): any;
116
+ getPixelTypes(): "Float" | "Integer";
117
+ hasPixelData(): boolean;
118
+ getPixelData(frameIndex?: number): DataView;
119
+ getPaletteColorData(): PaletteColorData;
120
+ /** module geter */
121
+ getPatientModule(): DicomPatientModule;
122
+ getVOILutModule(): DicomVOILutModule;
123
+ getScalingModule(): DicomScalingModule;
124
+ getPixelModule(frameIndex?: number): DicomPixelModule;
125
+ recalculeModules(): void;
126
+ }
127
+
128
+ declare function loadAndParseFromUrl(url: string): Promise<Dataset>;
129
+ declare function loadAndParseFromFiles(file: File): Promise<Dataset>;
130
+ declare function parse(dicomBuffer: ArrayBuffer): Dataset;
131
+ declare const _default: {
132
+ parse: typeof parse;
133
+ loadAndParseFromFiles: typeof loadAndParseFromFiles;
134
+ loadAndParseFromUrl: typeof loadAndParseFromUrl;
135
+ Dataset: typeof Dataset;
136
+ };
137
+
138
+ export { Dataset, _default as default, loadAndParseFromFiles, loadAndParseFromUrl, parse };
@@ -0,0 +1,138 @@
1
+ interface DicomVOILutModule {
2
+ voiLUTFunction: string;
3
+ windowWidth: number | undefined;
4
+ windowCenter: number | undefined;
5
+ voiLUTSequence: unknown;
6
+ lutDescriptor: any;
7
+ lutExplanation: any;
8
+ lutData: any;
9
+ windowCenterAndWidthExplanation: string;
10
+ }
11
+ interface DicomPatientModule {
12
+ patientName: string;
13
+ patientID: string;
14
+ typeofPatientID: string;
15
+ patientSex: string;
16
+ patientBirthDate: string;
17
+ patientAge: string;
18
+ patientSize: string;
19
+ otherPatientIDs: string;
20
+ otherPatientNames: string;
21
+ patientWeight: string;
22
+ }
23
+ interface DicomPixelModule {
24
+ photometricInterpretation: string;
25
+ numberOfFrames: number | undefined;
26
+ pixelRepresentation: number | undefined;
27
+ pixelSpacing: any | undefined;
28
+ rows: number | number | undefined;
29
+ columns: number | number | undefined;
30
+ bitsAllocated: number | undefined;
31
+ highBit: number | undefined;
32
+ bitsStored: number | undefined;
33
+ samplesPerPixel: number | undefined;
34
+ pixelDataProviderURL: any;
35
+ pixelPaddingRangeLimit: any;
36
+ extendedOffsetTable: any;
37
+ extendedOffsetTableLengths: any;
38
+ pixelAspectRatio: any;
39
+ planarConfiguration: number | undefined;
40
+ redPaletteColorLookupTableDescriptor: unknown;
41
+ greenPaletteColorLookupTableDescriptor: unknown;
42
+ bluePaletteColorLookupTableDescriptor: unknown;
43
+ alphaPaletteColorLookupTableDescriptor: unknown;
44
+ redPaletteColorLookupTableData: any;
45
+ greenPaletteColorLookupTableData: any;
46
+ bluePaletteColorLookupTableData: any;
47
+ alphaPaletteColorLookupTableData: any;
48
+ segmentedRedPaletteColorLookupTableData: any;
49
+ segmentedGreenPaletteColorLookupTableData: any;
50
+ segmentedBluePaletteColorLookupTableData: any;
51
+ segmentedAlphaPaletteColorLookupTableData: any;
52
+ pixelMeasuresSequence: any;
53
+ spacingBetweenSlices: any;
54
+ }
55
+ interface DicomScalingModule {
56
+ rescaleSlope: number | undefined;
57
+ rescaleIntercept: number | undefined;
58
+ modality: string;
59
+ rescaleType: any;
60
+ }
61
+ interface PaletteColorDataColor {
62
+ data: Uint8Array[] | Uint16Array[];
63
+ firstInputValueMapped: number;
64
+ lutEntries: number;
65
+ bitsPerEntry: number;
66
+ littleEndian: boolean;
67
+ }
68
+ interface PaletteColorData {
69
+ red: PaletteColorDataColor | undefined;
70
+ green: PaletteColorDataColor | undefined;
71
+ blue: PaletteColorDataColor | undefined;
72
+ alpha: PaletteColorDataColor | undefined;
73
+ }
74
+
75
+ interface DatasetProperties {
76
+ littleEndian: boolean;
77
+ implicit: boolean;
78
+ elements: {
79
+ [key: string]: any;
80
+ };
81
+ bytes: Uint8Array;
82
+ transferSyntaxUID?: string | undefined | null;
83
+ prefix?: string | undefined | null;
84
+ metadata?: {
85
+ [key: string]: any;
86
+ } | undefined | null;
87
+ deflated?: boolean | undefined | null;
88
+ }
89
+ declare class Dataset {
90
+ static Float: string;
91
+ static Integer: string;
92
+ littleEndian: boolean;
93
+ implicit: boolean;
94
+ elements: {
95
+ [key: string]: any;
96
+ };
97
+ transferSyntaxUID: string | null | undefined;
98
+ prefix?: string | undefined | null;
99
+ metadata?: {
100
+ [key: string]: any;
101
+ } | undefined | null;
102
+ deflated?: boolean | undefined | null;
103
+ bytes: Uint8Array;
104
+ /** modules */
105
+ voiLUTModule: DicomVOILutModule | null;
106
+ patientModule: DicomPatientModule | null;
107
+ pixelModule: DicomPixelModule | null;
108
+ scalingModule: DicomScalingModule | null;
109
+ constructor(properties: DatasetProperties);
110
+ get(group: number | string, element?: number | null | undefined): any;
111
+ date(group: number, element: number): any;
112
+ int(group: number, element: number): number | number[];
113
+ float(group: number, element: number): number | number[];
114
+ time(group: number, element: number): any;
115
+ getGeometricTags(tagName: string, frameIndex?: number): any;
116
+ getPixelTypes(): "Float" | "Integer";
117
+ hasPixelData(): boolean;
118
+ getPixelData(frameIndex?: number): DataView;
119
+ getPaletteColorData(): PaletteColorData;
120
+ /** module geter */
121
+ getPatientModule(): DicomPatientModule;
122
+ getVOILutModule(): DicomVOILutModule;
123
+ getScalingModule(): DicomScalingModule;
124
+ getPixelModule(frameIndex?: number): DicomPixelModule;
125
+ recalculeModules(): void;
126
+ }
127
+
128
+ declare function loadAndParseFromUrl(url: string): Promise<Dataset>;
129
+ declare function loadAndParseFromFiles(file: File): Promise<Dataset>;
130
+ declare function parse(dicomBuffer: ArrayBuffer): Dataset;
131
+ declare const _default: {
132
+ parse: typeof parse;
133
+ loadAndParseFromFiles: typeof loadAndParseFromFiles;
134
+ loadAndParseFromUrl: typeof loadAndParseFromUrl;
135
+ Dataset: typeof Dataset;
136
+ };
137
+
138
+ export { Dataset, _default as default, loadAndParseFromFiles, loadAndParseFromUrl, parse };