@flywheel-io/fw-file-rs 0.1.3 → 0.1.4
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 +43 -0
- package/fw_file_rs_bg.wasm +0 -0
- package/package.json +11 -1
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# fw-file-rs
|
|
2
|
+
|
|
3
|
+
JavaScript/WebAssembly bindings for the [fw-file-rs][fw-file-rs-repo] Rust library.
|
|
4
|
+
This package lets you work with DICOM files directly in the browser.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
import init, { get_dcm_meta, WasmDeidProfile } from "fw-file-rs";
|
|
10
|
+
|
|
11
|
+
// initialize the WASM module (required before use)
|
|
12
|
+
await init();
|
|
13
|
+
|
|
14
|
+
const dcmBytes = await read_until_pixel_data(file);
|
|
15
|
+
// extract metadata from a DICOM file
|
|
16
|
+
const tags = [
|
|
17
|
+
"StudyInstanceUID",
|
|
18
|
+
"SeriesInstanceUID",
|
|
19
|
+
// tags below are needed for splitting localizer
|
|
20
|
+
"InstanceNumber",
|
|
21
|
+
"ImagePositionPatient",
|
|
22
|
+
"ImageOrientationPatient",
|
|
23
|
+
"Rows",
|
|
24
|
+
"Columns",
|
|
25
|
+
];
|
|
26
|
+
const meta = get_dcm_meta(dcmBytes, tags);
|
|
27
|
+
// group DICOM files by StudyInstanceUID and SeriesInstanceUID and split localizer
|
|
28
|
+
const groups = group_dcm_meta(metas, ["StudyInstanceUID", "SeriesInstanceUID"], true);
|
|
29
|
+
|
|
30
|
+
// de-identify a DICOM file using a YAML profile
|
|
31
|
+
const yaml = `
|
|
32
|
+
version: 1
|
|
33
|
+
name: profile
|
|
34
|
+
dicom:
|
|
35
|
+
fields:
|
|
36
|
+
- name: PatientName
|
|
37
|
+
replace-with: REDACTED
|
|
38
|
+
`;
|
|
39
|
+
const profile = WasmDeidProfile.from_yaml(yaml);
|
|
40
|
+
const result = profile.deid_dcm(dcmBytes);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[fw-file-rs-repo]: https://gitlab.com/flywheel-io/tools/lib/fw-file-rs
|
package/fw_file_rs_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flywheel-io/fw-file-rs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Flywheel <support@flywheel.io>"
|
|
6
|
+
],
|
|
7
|
+
"description": "JavaScript/WebAssembly bindings for fw-file rust crate",
|
|
8
|
+
"version": "0.1.4",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://gitlab.com/flywheel-io/tools/lib/fw-file-rs"
|
|
13
|
+
},
|
|
5
14
|
"files": [
|
|
6
15
|
"fw_file_rs_bg.wasm",
|
|
7
16
|
"fw_file_rs.js",
|
|
8
17
|
"fw_file_rs.d.ts"
|
|
9
18
|
],
|
|
10
19
|
"main": "fw_file_rs.js",
|
|
20
|
+
"homepage": "https://gitlab.com/flywheel-io/tools/lib/fw-file-rs",
|
|
11
21
|
"types": "fw_file_rs.d.ts",
|
|
12
22
|
"sideEffects": [
|
|
13
23
|
"./snippets/*"
|