Skip to content

Commit

Permalink
refactor: mark migration of image and mesh io function to packages
Browse files Browse the repository at this point in the history
Re: InsightSoftwareConsortium#1010

BREAKING_CHANGE: readImageArrayBuffer has been migrated to @itk-wasm/image-io as readImageFile
BREAKING_CHANGE: readImageBlob has been migrated to @itk-wasm/image-io as readImageFile
BREAKING_CHANGE: readImageFile has been migrated to @itk-wasm/image-io as readImageFile
BREAKING_CHANGE: readImageFileSeries has been migrated to @itk-wasm/image-io readImageFileSeries
BREAKING_CHANGE: readImageLocalFile has been migrated to @itk-wasm/image-io readImageFileNode
BREAKING_CHANGE: readMeshArrayBuffer has been migrated to @itk-wasm/mesh-io readMeshFile
BREAKING_CHANGE: readMeshFile has been migrated to @itk-wasm/mesh-io readMeshFile
BREAKING_CHANGE: readMeshLocalFile has been migrated to @itk-wasm/mesh-io readMeshFileNode
BREAKING_CHANGE: writeImageArrayBuffer has been migrated to @itk-wasm/image-io writeImageFile
BREAKING_CHANGE: writeImageLocalFile has been migrated from @itk-wasm/image-io writeImageFileNode
  • Loading branch information
thewtex committed Dec 15, 2023
1 parent 14fca69 commit 88a6de3
Show file tree
Hide file tree
Showing 42 changed files with 253 additions and 673 deletions.
10 changes: 10 additions & 0 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ guide](doc/content/docs/itk_js_to_itk_wasm_migration_guide.md).
- readImageLocalDICOMFileSeries has been migrated to @itk-wasm/dicom as readImageDicomFileSeriesNode
- meshToPolyData, meshToPolyDataNode, polyDataToMesh, polyDataToMeshNode have been migrated to @itk-wasm/mesh-to-poly-data
- High level IO function have been removed: readArrayBuffer, readBlob, readFile, readLocalFile, writeLocalFile
- readImageArrayBuffer has been migrated to @itk-wasm/image-io as readImageFile
- readImageBlob has been migrated to @itk-wasm/image-io as readImageFile
- readImageFile has been migrated to @itk-wasm/image-io as readImageFile
- readImageFileSeries has been migrated to @itk-wasm/image-io readImageFileSeries
- readImageLocalFile has been migrated to @itk-wasm/image-io readImageFileNode
- readMeshArrayBuffer has been migrated to @itk-wasm/mesh-io readMeshFile
- readMeshFile has been migrated to @itk-wasm/mesh-io readMeshFile
- readMeshLocalFile has been migrated to @itk-wasm/mesh-io readMeshFileNode
- writeImageArrayBuffer has been migrated to @itk-wasm/image-io writeImageFile
- writeImageLocalFile has been migrated from @itk-wasm/image-io writeImageFileNode

## From 1.0.0-b.101 to 1.0.0-b.102

Expand Down
25 changes: 21 additions & 4 deletions docs/development/itk_js_to_itk_wasm_migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ The following DICOM image IO functions have been migrated to the `@itk-wasm/dico
5. `readDICOMTagsArrayBuffer` -> `readDicomTags`
6. `readDICOMTagsLocalFile` -> `readDicomTagsNode`

### Migrated image-io and mesh-io functions

The following image and mesh IO functions have been migrated to the `@itk-wasm/image-io`
and `@itk-wasm/mesh-io` package. Their interface changed in some cases.

1. `readImageArrayBuffer` -> `readImageFile`
2. `readImageBlob` -> `readImageFile`
3. `readImageFileSeries` -> `readImageFileSeries`
4. `readImageHTTP` -> `readImageHttp`
5. `readImageLocalFile` -> `readImageNode`
6. `readMeshArrayBuffer` -> `readMeshFile`
7. `readMeshBlob` -> `readMeshFile`
8. `readMeshLocalFile` -> `readMeshNode`
9. `writeImageArrayBuffer` -> `writeImageFile`
10. `writeImageLocalFile` -> `writeImageFileNode`
11. `writeMeshArrayBuffer` -> `writeMeshFile`
12. `writeMeshLocalFile` -> `writeMeshNode`

### MeshToPolyData

The following mesh to polydata conversion functions have been migrated to the `@itk-wasm/mesh-to-poly-data` package.
Expand All @@ -117,19 +135,18 @@ These are:
5. writeArrayBuffer
5. writeLocalFile


## CLI options

The `--image, -i` command line option for the `build` subcommand is now a global option for all subcommands. For examples

```
ITK-Wasm build --image itkwasm/emscripten src/dir
itk-wasm build --image itkwasm/emscripten src/dir
```

is now:

```
ITK-Wasm --image itkwasm/emscripten --source-dir src/dir build
itk-wasm --image itkwasm/emscripten --source-dir src/dir build
```

## Image data structure
Expand Down Expand Up @@ -164,7 +181,7 @@ Support for the legacy GE image file formats, i.e. GE4, GE5, GEAdw, is no longer

## IOTypes

The use of `IOTypes` in pipelines is deprecated and not expected to work in the future. These have been replaced by `InterfaceTypes`.
The use of `IOTypes` in pipelines is deprecated has been removed. These have been replaced by `InterfaceTypes`.

## Argument order when writing image, mesh binaries

Expand Down
11 changes: 10 additions & 1 deletion packages/core/typescript/itk-wasm/src/deprecated/index-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ import meshToPolyDataNode from "./mesh-to-poly-data-node.js"
export { meshToPolyDataNode }

import polyDataToMeshNode from "./poly-data-to-mesh-node.js"
export { polyDataToMeshNode }
export { polyDataToMeshNode }

import readMeshLocalFile from "./read-mesh-local-file.js"
export { readMeshLocalFile }

import writeImageLocalFile from "./write-image-local-file.js"
export { writeImageLocalFile }

import readImageLocalFile from "./read-image-local-file.js"
export { readImageLocalFile }
18 changes: 18 additions & 0 deletions packages/core/typescript/itk-wasm/src/deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,21 @@ export { meshToPolyData }

import polyDataToMesh from './poly-data-to-mesh.js'
export { polyDataToMesh }

import readImageArrayBuffer from './read-image-array-buffer.js'
export { readImageArrayBuffer }

import readImageBlob from './read-image-blob.js'
export { readImageBlob }

import readImageFile from './read-image-file.js'
export { readImageFile }

import readImageFileSeries from './read-image-file-series.js'
export { readImageFileSeries }

import readMeshArrayBuffer from './read-mesh-array-buffer.js'
export { readMeshArrayBuffer }

import readMeshFile from './read-mesh-file.js'
export { readMeshFile }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CastImageOptions from '../core/CastImageOptions.js'
import CastImageOptions from '../cast-image-options.js'

interface ReadImageArrayBufferOptions extends CastImageOptions {
mimeType?: string
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-nocheck

import ReadImageResult from "./read-image-result.js"
import ReadImageArrayBufferOptions from "./read-image-array-buffer-options.js"

/**
* @deprecated Use readImageArrayBuffer from @itk-wasm/image-io instead
*/
async function readImageArrayBuffer (webWorker: Worker | null, arrayBuffer: ArrayBuffer, fileName: string, options?: ReadImageArrayBufferOptions | string): Promise<ReadImageResult> {
throw new Error('readImageArrayBuffer is deprecated. Use readImageFile from @itk-wasm/image-io instead.')
}

export default readImageArrayBuffer
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-nocheck

import ReadImageResult from "./read-image-result.js"
import ReadImageArrayBufferOptions from "./read-image-array-buffer-options.js"

/**
* @deprecated Use readImageBlob from @itk-wasm/image-io instead
*/
async function readImageBlob (webWorker: Worker | null, blob: Blob, fileName: string, options?: ReadImageArrayBufferOptions | string): Promise<ReadImageResult> {
throw new Error('readImageBlob is deprecated. Use readImageFile from @itk-wasm/image-io instead.')
}

export default readImageBlob
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CastImageOptions from '../core/CastImageOptions.js'
import CastImageOptions from '../cast-image-options.js'

interface ReadImageFileSeriesOptions extends CastImageOptions {
zSpacing?: number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Image from '../core/interface-types/image.js'
import WorkerPool from '../core/WorkerPool.js'
import Image from '../interface-types/image.js'
import WorkerPool from '../worker-pool.js'

interface ReadImageFileSeriesResult {
image: Image
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @ts-nocheck

import ReadImageFileSeriesResult from './read-image-file-series-result.js'
import ReadImageFileSeriesOptions from './read-image-file-series-options.js'

/**
* @deprecated Use readImageFileSeries from @itk-wasm/image-io instead
*/
async function readImageFileSeries (
fileList: File[] | FileList,
options?: ReadImageFileSeriesOptions | number,
zOriginBackwardsCompatibility?: number,
sortedSeriesBackwardsCompatibility?: boolean
): Promise<ReadImageFileSeriesResult> {
throw new Error('readImageFileSeries is deprecated. Use readImageFileSeries from @itk-wasm/image-io instead.')
}

export default readImageFileSeries
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @ts-nocheck

import ReadImageResult from "./read-image-result.js"

import CastImageOptions from "../cast-image-options.js"

/**
* @deprecated Use readImageFile from @itk-wasm/image-io instead
*/
async function readImageFile (webWorker: Worker | null, file: File, options?: CastImageOptions): Promise<ReadImageResult> {
throw new Error('readImageFile is deprecated. Use readImageFile from @itk-wasm/image-io instead.')
}

export default readImageFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @ts-nocheck

import Image from '../interface-types/image.js'

import CastImageOptions from '../cast-image-options.js'

/**
* @deprecated Use readImageFileNode from @itk-wasm/image-io instead
*/
async function readImageLocalFile (filePath: string, options?: CastImageOptions): Promise<Image> {
throw new Error('readImageLocalFile is deprecated. Use readImageFileNode from @itk-wasm/image-io instead.')
}

export default readImageLocalFile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from '../core/interface-types/image.js'
import Image from '../interface-types/image.js'

interface ReadImageResult {
image: Image
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-nocheck

import ReadMeshResult from './read-mesh-result.js'

/**
* @deprecated Use readMeshArrayBuffer from @itk-wasm/image-io instead
*/
async function readMeshArrayBuffer (webWorker: Worker | null, arrayBuffer: ArrayBuffer, fileName: string, mimeType: string): Promise<ReadMeshResult> {
throw new Error('readMeshArrayBuffer is deprecated. Use readMeshFile from @itk-wasm/mesh-io instead.')
}

export default readMeshArrayBuffer
12 changes: 12 additions & 0 deletions packages/core/typescript/itk-wasm/src/deprecated/read-mesh-blob.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-nocheck

import ReadMeshResult from './read-mesh-result.js'

/**
* @deprecated Use readMeshBlob from @itk-wasm/mesh-io instead
*/
async function readMeshBlob (webWorker: Worker | null, blob: Blob, fileName: string, mimeType: string): Promise<ReadMeshResult> {
throw new Error('readMeshBlob is deprecated. Use readMeshFile from @itk-wasm/mesh-io instead.')
}

export default readMeshBlob
12 changes: 12 additions & 0 deletions packages/core/typescript/itk-wasm/src/deprecated/read-mesh-file.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-nocheck

import ReadMeshResult from './read-mesh-result.js'

/**
* @deprecated Use readMeshFile from @itk-wasm/mesh-io instead
*/
async function readMeshFile (webWorker: Worker | null, file: File): Promise<ReadMeshResult> {
throw new Error('readMeshFile is deprecated. Use readMeshFile from @itk-wasm/mesh-io instead.')
}

export default readMeshFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-nocheck

import Mesh from '../interface-types/mesh.js'

/**
* @deprecated Use readMeshFileNode from @itk-wasm/mesh-io instead
*/
async function readMeshLocalFile (filePath: string): Promise<Mesh> {
throw new Error('readMeshLocalFile is deprecated. Use readMeshFileNode from @itk-wasm/mesh-io instead.')
}

export default readMeshLocalFile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Mesh from '../core/interface-types/mesh.js'
import Mesh from '../interface-types/mesh.js'

interface ReadMeshResult {
mesh: Mesh
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-nocheck

import Image from '../interface-types/image.js'

import WriteImageOptions from './write-image-options.js'
import WriteArrayBufferResult from './write-array-buffer-result.js'

/**
* @deprecated Use writeImageFile from @itk-wasm/image-io instead
*/
async function writeImageArrayBuffer (webWorker: Worker | null, image: Image, fileName: string, options?: WriteImageOptions | string, useCompressionBackwardsCompatibility?: boolean
): Promise<WriteArrayBufferResult> {
throw new Error('writeImageArrayBuffer is deprecated. Use writeImageFile from @itk-wasm/image-io instead.')
}

export default writeImageArrayBuffer
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-nocheck

import WriteImageOptions from './write-image-options.js'

import Image from '../interface-types/image.js'

/**
* @deprecated Use writeImageFileNode from @itk-wasm/image-io instead
*/
async function writeImageLocalFile (image: Image, filePath: string, options?: WriteImageOptions | boolean
): Promise<null> {
throw new Error('writeImageLocalFile is deprecated. Use writeImageFileNode from @itk-wasm/image-io instead.')
}

export default writeImageLocalFile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CastImageOptions from '../core/CastImageOptions.js'
import CastImageOptions from '../cast-image-options.js'

interface WriteImageOptions extends CastImageOptions {
useCompression?: boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @ts-nocheck

import Mesh from '../interface-types/mesh.js'

import WriteArrayBufferResult from './write-array-buffer-result.js'
import WriteMeshOptions from './write-mesh-options.js'

/**
* @deprecated Use writeMeshFile from @itk-wasm/mesh-io instead
*/
async function writeMeshArrayBuffer (webWorker: Worker | null, mesh: Mesh, fileName: string, mimeType: string, options: WriteMeshOptions): Promise<WriteArrayBufferResult> {
throw new Error('writeMeshArrayBuffer is deprecated. Use writeMeshFile from @itk-wasm/mesh-io instead.')
}

export default writeMeshArrayBuffer
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// @ts-nocheck

import WriteMeshOptions from './write-mesh-options.js'

import Mesh from '../interface-types/mesh.js'

/**
* @deprecated Use writeMeshFileNode from @itk-wasm/mesh-io instead
*/
async function writeMeshLocalFile (mesh: Mesh, filePath: string, options: WriteMeshOptions): Promise<null> {
throw new Error('writeMeshLocalFile is deprecated. Use writeMeshFileNode from @itk-wasm/mesh-io instead.')
}

export default writeMeshLocalFile
File renamed without changes.
1 change: 1 addition & 0 deletions packages/image-io/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"axios": "^1.6.2",
"itk-wasm": "workspace:^",
"mime-types": "^2.1.35"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/image-io/typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export * from './pipelines-base-url.js'
export * from './pipeline-worker-url.js'

export readImageHttp from './read-image-http.js'

import ReadImageOptions from './read-image-options.js'
export type { ReadImageOptions }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import axios from 'axios'

import bufferToTypedArray from '../core/bufferToTypedArray.js'
import Image from '../core/interface-types/image.js'
import FloatTypes from '../core/interface-types/float-types.js'
import type TypedArray from '../core/TypedArray.js'
import { bufferToTypedArray, Image, FloatTypes, TypedArray } from 'itk-wasm'

async function readImageHTTP (url: string): Promise<Image> {
const imageResponse = await axios.get(`${url}/index.json`, { responseType: 'json' })
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 88a6de3

Please sign in to comment.