Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_run(){
var inputBuffer = this._getInput(0);
if(!inputBuffer){
console.warn("TiffDecoder requires an ArrayBuffer as input \"0\". Unable to continue.");
return;
}
var success = false;
try{
var tiffData = geotiff.parse(inputBuffer);
var tiffImage = tiffData.getImage();
var data = tiffImage.readRasters( {interleave: true} );
var width = tiffImage.getWidth();
var height = tiffImage.getHeight();
var ncpp = tiffImage.getSamplesPerPixel();
if(ncpp == (data.length / (width*height))){
success = true;
}
if( success ){
var outputImg = this._addOutput( Image2D );
outputImg.setData( data, width, height, ncpp);
}else{
console.warn("Tiff support is experimental and this file is not compatible.");