Skip to content

Commit

Permalink
build(dicom): Bump package to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Aug 4, 2023
1 parent aa5f73d commit a7dacbc
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"build:bindgen:python:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b wasi-build bindgen --interface python --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.5.1 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python-web-demo:compress-stringify": "./src/itk-wasm-cli.js -s packages/compress-stringify -b emscripten-build bindgen --interface python-web-demo --package-name itkwasm-compress-stringify --package-description \"Zstandard compression and decompression and base64 encoding and decoding in WebAssembly.\" --package-version 0.5.1 --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:emscripten:dicom": "node ./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build build",
"build:bindgen:typescript:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build bindgen --package-version 2.1.0 --package-name @itk-wasm/dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b wasi-build bindgen --package-version 2.1.0 --interface python --package-name itkwasm-dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:typescript:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b emscripten-build bindgen --package-version 3.0.0 --package-name @itk-wasm/dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:bindgen:python:dicom": "./src/itk-wasm-cli.js -s packages/dicom -b wasi-build bindgen --package-version 3.0.0 --interface python --package-name itkwasm-dicom --package-description \"Read files and images related to DICOM file format.\" --repository 'https://github.com/InsightSoftwareConsortium/itk-wasm'",
"build:emscripten:packages": "npm run build:emscripten:compress-stringify && npm run build:bindgen:typescript:compress-stringify && npm run build:emscripten:dicom && npm run build:bindgen:typescript:dicom",
"build:wasi": "node ./src/build-wasi.js && npm run build:wasi:packages",
"build:wasi:compress-stringify": "node ./src/itk-wasm-cli.js -i itkwasm/wasi:latest -s packages/compress-stringify -b wasi-build build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.1.0"
__version__ = "3.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path
import os
from typing import Dict, Tuple, Optional
from typing import Dict, Tuple, Optional, List

from .js_package import js_package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path
import os
from typing import Dict, Tuple, Optional
from typing import Dict, Tuple, Optional, List

from .js_package import js_package

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated file. Do not edit.

from pathlib import Path
import os
from typing import Dict, Tuple, Optional, List

from .js_package import js_package

from itkwasm.pyodide import (
to_js,
to_py,
js_resources
)
from itkwasm import (
InterfaceTypes,
Image,
BinaryFile,
)

async def read_image_dicom_file_series_async(
input_images: List[os.PathLike] = [],
single_sorted_series: bool = False,
) -> Tuple[Image, Dict]:
"""Read a DICOM image series and return the associated image volume
:param input_images: File names in the series
:type input_images: os.PathLike
:param single_sorted_series: The input files are a single sorted series
:type single_sorted_series: bool
:return: Output image volume
:rtype: Image
:return: Output sorted filenames
:rtype: Dict
"""
js_module = await js_package.js_module
web_worker = js_resources.web_worker

kwargs = {}
if input_images is not None:
kwargs["inputImages"] = to_js(BinaryFile(input_images))
if single_sorted_series:
kwargs["singleSortedSeries"] = to_js(single_sorted_series)

outputs = await js_module.readImageDicomFileSeries(web_worker, **kwargs)

output_web_worker = None
output_list = []
outputs_object_map = outputs.as_object_map()
for output_name in outputs.object_keys():
if output_name == 'webWorker':
output_web_worker = outputs_object_map[output_name]
else:
output_list.append(to_py(outputs_object_map[output_name]))

js_resources.web_worker = output_web_worker

if len(output_list) == 1:
return output_list[0]
return tuple(output_list)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path
import os
from typing import Dict, Tuple, Optional
from typing import Dict, Tuple, Optional, List

from .js_package import js_package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path
import os
from typing import Dict, Tuple, Optional
from typing import Dict, Tuple, Optional, List

from .js_package import js_package

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.1.0"
__version__ = "3.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Generated file. Do not edit.

from pathlib import Path, PurePosixPath
import os
from typing import Dict, Tuple, Optional, List

from importlib_resources import files as file_resources

_pipeline = None

from itkwasm import (
InterfaceTypes,
PipelineOutput,
PipelineInput,
Pipeline,
Image,
BinaryFile,
)

def read_image_dicom_file_series(
input_images: List[os.PathLike] = [],
single_sorted_series: bool = False,
) -> Tuple[Image, Dict]:
"""Read a DICOM image series and return the associated image volume
:param input_images: File names in the series
:type input_images: os.PathLike
:param single_sorted_series: The input files are a single sorted series
:type single_sorted_series: bool
:return: Output image volume
:rtype: Image
:return: Output sorted filenames
:rtype: Dict
"""
global _pipeline
if _pipeline is None:
_pipeline = Pipeline(file_resources('itkwasm_dicom_wasi').joinpath(Path('wasm_modules') / Path('read-image-dicom-file-series.wasi.wasm')))

pipeline_outputs: List[PipelineOutput] = [
PipelineOutput(InterfaceTypes.Image),
PipelineOutput(InterfaceTypes.JsonObject),
]

pipeline_inputs: List[PipelineInput] = [
]

args: List[str] = ['--memory-io',]
# Inputs
# Outputs
args.append('0')
args.append('1')
# Options
if len(input_images) > 1:
if len(input_images) < 1:
raise ValueError('"input-images" option must have a length > 1')

args.append('--input-images')
for value in input_images:
input_file = str(PurePosixPath(input_images))
pipeline_inputs.append(PipelineInput(InterfaceTypes.BinaryFile, BinaryFile(value)))
args.append(input_file)

if single_sorted_series:
args.append('--single-sorted-series')


outputs = _pipeline.run(args, pipeline_outputs, pipeline_inputs)

result = (
outputs[0].data,
outputs[1].data.data,
)
return result

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.1.0"
__version__ = "3.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List

from itkwasm import (
environment_dispatch,
Image,
BinaryFile,
)

def read_image_dicom_file_series(
input_images: List[os.PathLike] = [],
single_sorted_series: bool = False,
) -> Tuple[Image, Dict]:
"""Read a DICOM image series and return the associated image volume
:param input_images: File names in the series
:type input_images: os.PathLike
:param single_sorted_series: The input files are a single sorted series
:type single_sorted_series: bool
:return: Output image volume
:rtype: Image
:return: Output sorted filenames
:rtype: Dict
"""
func = environment_dispatch("itkwasm_dicom", "read_image_dicom_file_series")
output = func(input_images=input_images, single_sorted_series=single_sorted_series)
return output
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated file. Do not edit.

import os
from typing import Dict, Tuple, Optional, List

from itkwasm import (
environment_dispatch,
Image,
BinaryFile,
)

async def read_image_dicom_file_series_async(
input_images: List[os.PathLike] = [],
single_sorted_series: bool = False,
) -> Tuple[Image, Dict]:
"""Read a DICOM image series and return the associated image volume
:param input_images: File names in the series
:type input_images: os.PathLike
:param single_sorted_series: The input files are a single sorted series
:type single_sorted_series: bool
:return: Output image volume
:rtype: Image
:return: Output sorted filenames
:rtype: Dict
"""
func = environment_dispatch("itkwasm_dicom", "read_image_dicom_file_series_async")
output = await func(input_images=input_images, single_sorted_series=single_sorted_series)
return output
2 changes: 1 addition & 1 deletion packages/dicom/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@itk-wasm/dicom",
"version": "2.1.0",
"version": "3.0.0",
"description": "Read files and images related to DICOM file format.",
"type": "module",
"module": "./dist/bundles/dicom.js",
Expand Down

0 comments on commit a7dacbc

Please sign in to comment.