_getDataSubsetInfo(subset)

[PRIVATE] Return some infomation about the data subset so that it's easier to parse later

Parameters

  • Object subset :

    can be a typedArray or a complex object

Returns

Object :

reconstruction info about this subset

enableDataCompression(b)

Set a boolean to secify if data should be compressed or not

Parameters

  • Boolean b :

    true to compress, false to not compress

getOutput

Get the output

Returns

Object :

the output, or null

reset

reset inputs and inputs

run

Launch the encoding of the block

setInput(obj)

Specify an input to the encoder

Parameters

  • Object obj :

    an object candidate, containing a _data and _metadata attributes

determineDataCase(data)

[STATIC] Give in what case we fall when we want to use this data. Cases are described at the top

Parameters

  • Whatever data :

    a piec of data, object, array, typed array...

Returns

Number :

the case

isGoodCandidate(obj)

Check if the given object is a good intput candidate

Parameters

  • Object obj :

    an object candidate, containing a _data and _metadata attributes

Returns

Boolean :

true if good candidate, false if not

_getDataTypeFromByteStreamInfo(bsi)

Get the array type based on byte stream info. The returned object can be used as a constructor

Parameters

  • bsi :

Returns

Function :

constructor of a typed array

getOutput

Get the output

Returns

Object :

the output, or null

reset

reset inputs and inputs

setInput(buff)

Specify an input

Parameters

  • ArrayBuffer buff :

    the arraybuffer that contains some data to be deserialized

PixBinDecoder

A PixBinDecoder instance decodes a *.pixp file and output an Image2D or Image3D. The input, specified by .addInput(...) must be an ArrayBuffer (from an UrlToArrayBufferFilter, an UrlToArrayBufferReader or anothrer source ).

Usage

Instance members

#_parseIndex

[PRIVATE]

_parseIndex

[PRIVATE]

#enableBlockVerification(b)

Specify wether or not the bin decoder must perform a checksum verification for each block to be decoded.

enableBlockVerification(b)

Specify wether or not the bin decoder must perform a checksum verification for each block to be decoded.

Parameters

  • Boolean b :

    true to perfom verification, false to skip it (default: false)

#fetchBlock(n, forceDecoding)

Fetch a block at the given index. The first time it called on a block, this block will be read from the stream and decoded. If a block is already decoded, it will be retrieved as is without trying to re-decode it, unless forceDecoding is true.

fetchBlock(n, forceDecoding)

Fetch a block at the given index. The first time it called on a block, this block will be read from the stream and decoded. If a block is already decoded, it will be retrieved as is without trying to re-decode it, unless forceDecoding is true.

Parameters

  • Number n :

    the index of the block to fetch

  • Boolean forceDecoding :

    force the decoding even though it was already decoded

Returns

Object :

the decoded block, containing _data_, _metadata and originalBlockType

#getBinCreationDate

Get the creation date of the file in the ISO8601 format

getBinCreationDate

Get the creation date of the file in the ISO8601 format

Returns

String :

the data

#getBinDescription

Get the description of the PixBin file

getBinDescription

Get the description of the PixBin file

Returns

String :

the description

#getBinUserObject

The userObject is a generic container added to the PixBin. It can carry all sorts of data. If not specified during encoding, it's null.

getBinUserObject

The userObject is a generic container added to the PixBin. It can carry all sorts of data. If not specified during encoding, it's null.

Returns

Object :

the userObject

#getBlockDescription(n)

Get the description of the block at the given index

getBlockDescription(n)

Get the description of the block at the given index

Parameters

  • Number n :

    the index of the block

Returns

String :

the description of this block

#getBlockType(n)

Get the original type of the block. Convenient for knowing how to rebuild the object in its original form.

getBlockType(n)

Get the original type of the block. Convenient for knowing how to rebuild the object in its original form.

Parameters

  • Number n :

    the index of the block

Returns

String :

the type ( comes from constructor.name )

#getNumberOfBlocks

Get the number of blocks encoded in this PixBin file

getNumberOfBlocks

Get the number of blocks encoded in this PixBin file

Returns

Number
#getOutput

Get the the decoded output

getOutput

Get the the decoded output

Returns

Object :

a decoded object

#isValid

To be called after setInput. Tells if the buffer loaded is valid or not.

isValid

To be called after setInput. Tells if the buffer loaded is valid or not.

Returns

Boolean :

true if valid, false if not.

#reset

reset I/O and data to query

reset

reset I/O and data to query

#setInput(buff)

Specify an input

setInput(buff)

Specify an input

Parameters

PixBinEncoder

A PixBinEncoder instance takes an Image2D or Image3D as input with addInput(...) and encode it so that it can be saved as a *.pixp file. An output filename can be specified using .setMetadata("filename", "yourName.pixp");, by default, the name is "untitled.pixp". When update() is called, a gzip blog is prepared as output[0] and can then be downloaded when calling the method .download(). The gzip blob could also be sent over AJAX using a third party library.

Usage

Static members

.MAGIC_NUMBER

[static] the first sequence of bytes for a pixbin file is this ASCII string

MAGIC_NUMBER

[static] the first sequence of bytes for a pixbin file is this ASCII string

Instance members

#addInput(obj)

Add an input. Multiple inputs can be added.

addInput(obj)

Add an input. Multiple inputs can be added.

Parameters

  • Object obj :

    an object that comtain _data and _metadata

#enableDataCompression(b)

Set a boolean to secify if data should be compressed or not

enableDataCompression(b)

Set a boolean to secify if data should be compressed or not

Parameters

  • Boolean b :

    true to compress, false to not compress

#getOutput

Get the output

getOutput

Get the output

Returns

ArrayBuffer :

the encoded data as a buffer

#reset

[PRIVATE] reset inputs and inputs

reset

[PRIVATE] reset inputs and inputs

#run

Launch the encoding

run

Launch the encoding

#setOption(optionName, value)

Overwrite one of the default options.

setOption(optionName, value)

Overwrite one of the default options.

Parameters

  • String optionName :

    one of "madeWith" (default: "pixbincodec_js"), "userObject" (default: null), "description" (default: null)

  • value :