Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Float32Array to papaya.Container.addImage #225

Open
gaiborjosue opened this issue Feb 6, 2024 · 1 comment
Open

Float32Array to papaya.Container.addImage #225

gaiborjosue opened this issue Feb 6, 2024 · 1 comment

Comments

@gaiborjosue
Copy link

gaiborjosue commented Feb 6, 2024

Hello @rii-mango,

I am currently having a bit of trouble trying to add as an overlay to my current container (0) the output of a tensorflow model (Float32Array).

I read the documentation, and it says that it does accept arrays as input instead of image URLS. Thus, my approach was the following:

            let predictionArray = prediction.dataSync();

            let params = [];

            params["binaryImages"] = {lut: "Spectrum"};

            papaya.Container.addImage(0, [predictionArray], params);

However, I am getting the following error:

papaya.js:3723 Uncaught (in promise) RangeError: Invalid string length
    at Float32Array.join (<anonymous>)
    at Float32Array.toString (<anonymous>)
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at papaya.Container.findLoadableImage 

Is my approach right? If not, how can I achieve the overlay to the original container with the new output array?

Thank you!

@gaiborjosue
Copy link
Author

gaiborjosue commented Feb 7, 2024

Hello @rii-mango; quick update. I got past the previous error, but now I get a new type of error.

I figured out I needed to convert my Array output to an array buffer with the correct size. Now that I feed it correctly the same way as before, this is the new error I am getting:

Uncaught (in promise) TypeError: a[0].lastIndexOf is not a function
    at papaya.volume.Volume.readURLs (papaya.js:3026:109)
    at papaya.viewer.Viewer.loadOverlay (papaya.js:3371:362)
    at papaya.viewer.Viewer.loadImage (papaya.js:3366:123)
    at papaya.Container.addImage (papaya.js:3666:215)
    at loadModel (researchexperiment/:142:30)

Could you please tell me what this refers to and whether my approach to adding the image is correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant