Skip to content

Update to geotiff 3 #951

@xinaesthete

Description

@xinaesthete

This came to my attention because of #949

According to their documentation there are performance / memory benefits to the newer version, but also breaking API changes that would impact both internal code and also possibly users who have registered codecs ala #903 (we currently have roughly equivalent code in MDV and I think Xenium Explorer does something similar).

Although having said that, the migration doc https://www.npmjs.com/package/geotiff#7-custom-decoders seems to not exactly correspond to the implementation I've used

class JPEG2000Decoder extends BaseDecoder {
  constructor(fileDirectory) { ... }
  async decodeBlock(buffer( { ... }
}

vs their migration docs:

Before (v2):

class MyDecoder extends BaseDecoder {
  async decode(fileDirectory, buffer) {
    // decode using fileDirectory properties
  }
}

After (v3):

class MyDecoder extends BaseDecoder {
  constructor(parameters) {
    super(parameters);
    // parameters extracted once during construction
  }

  async decode(buffer) {
    // decode using this.parameters
  }
}

// Register with parameter extraction function
addDecoder(
  12345, // compression ID
  () => import('./mydecoder.js').then(m => m.default),
  async (fileDirectory) => {
    return {
      ...await defaultDecoderParameterFn(fileDirectory),
      myCustomParam: await fileDirectory.loadValue('MyCustomTag')
    };
  }
);

Anyway, not sure what kind of difference it might make, but thought I may as well track separately rather than in "Out of memory error" bug issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions