-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3c36de
commit 7ea2d81
Showing
26 changed files
with
1,075 additions
and
865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { deserialize } from "./numpy"; | ||
import type { InlineDecodeable, IntermediateMask } from "./types"; | ||
|
||
export default (inline: InlineDecodeable): IntermediateMask | null => { | ||
let base64: string; | ||
if (typeof inline === "string") { | ||
base64 = inline; | ||
} else if (typeof inline?.$binary?.base64 === "string") { | ||
base64 = inline.$binary.base64; | ||
} | ||
|
||
if (!base64) { | ||
return null; | ||
} | ||
|
||
const data = deserialize(base64); | ||
const [height, width] = data.shape; | ||
|
||
return { | ||
data, | ||
image: new ArrayBuffer(width * height * 4), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { getFetchFunction } from "@fiftyone/utilities"; | ||
import { decode } from "decode-tiff"; | ||
import type { OverlayMask } from "../../numpy"; | ||
|
||
export default async (url: string) => { | ||
const buffer: ArrayBuffer = await getFetchFunction()( | ||
"GET", | ||
url, | ||
null, | ||
"arrayBuffer" | ||
); | ||
const result = decode(buffer); | ||
return {} as OverlayMask; | ||
import * as tiff from "geotiff"; | ||
import type { OverlayMask } from "./types"; | ||
|
||
export default async (blob: Blob) => { | ||
const r = await tiff.fromBlob(blob); | ||
const image = await r.getImage(); | ||
console.log(image.getHeight(), image.getWidth()); | ||
console.log(r); | ||
console.log(image); | ||
|
||
console.log(); | ||
|
||
const data = await image.readRGB(); | ||
|
||
if (!(data instanceof Uint8Array)) { | ||
throw new Error("wrong"); | ||
} | ||
|
||
return { | ||
arrayType: "Uint8Array", | ||
buffer: data.buffer, | ||
shape: [4, 4], | ||
channels: 2, | ||
} as OverlayMask; | ||
}; |
Oops, something went wrong.