Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
How to draw 2d plane on canvas from a Typed array?

I am drawing a 2D image from the values of a transverse plane in a Uint8ClampedArray onto a canvas like this:

enter image description here

Code:

  // Cols and Rows are always 512 in my case
  var cols = 512;
  var rows = 512;

  // offset to specified slice
  var sliceSize = cols * rows;
  var sliceOffset = sliceSize * slice;
  var thisSliceData = typedArray.slice(sliceOffset, sliceOffset + sliceSize);

for (var row = 0; row < rows; row++) {
  var rowOffset = row * cols;

  for (var col = 0; col < cols; col++) {
    var offset = sliceOffset + rowOffset + col;
    var value = typedArray[offset]; //

    canvasImage.data[(rowOffset + col) * 4] = value;
    canvasImage.data[(rowOffset + col) * 4 + 1] = value;
    canvasImage.data[(rowOffset + col) * 4 + 2] = value;
    canvasImage.data[(rowOffset + col) * 4 + 3] = 255;
  }
}

I would like to be able to get the sagittal and coronal planes as well. I'm having a hard time wrapping my head around it. How do I tweak the code to get those?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!