Skip to content

Commit

Permalink
fix(typescript): add imageType property to Image
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Apr 11, 2024
1 parent e5fce53 commit 2f1b5a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
Image,
Mesh,
PolyData,
} from 'itk-wasm'

import compressStringify from './compress-stringify.js'
import parseStringDecompress from './parse-string-decompress.js'
import { dir } from 'console'

export function imageToJson(image: Image): string {
const level = 5

const directionBytes = new Uint8Array(image.direction.buffer)
image.direction = await compressStringify(directionBytes, { compressionLevel: level, stringify: True })

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import setMatrixElement from '../set-matrix-element.js'
import Metadata from './metadata.js'

class Image {
imageType: ImageType

name: string = 'image'

origin: number[]
Expand All @@ -18,8 +20,9 @@ class Image {

data: null | TypedArray

constructor (public readonly imageType = new ImageType()) {
const dimension = imageType.dimension
constructor (public readonly it = new ImageType()) {
this.imageType = it
const dimension = it.dimension
this.origin = new Array(dimension)
this.origin.fill(0.0)

Expand Down

0 comments on commit 2f1b5a7

Please sign in to comment.