imageDataTo3DArray = (imageData) => {
  // Get image dimension (assume square image)
  let width = Math.sqrt(imageData.length / 4);

  // Create array placeholder for each channel
  let imageArray = [init2DArray(width, width, 0), init2DArray(width, width, 0),
    init2DArray(width, width, 0)];
  
  // Iterate through the data to fill out channel arrays above
  for (let i = 0; i < imageData.length; i++) {
    let pixelIndex = Math.floor(i / 4),
      channelIndex = i % 4,
      row = Math.floor(pixelIndex / width),
      column = pixelIndex % width;
    
    if (channelIndex < 3) {
      imageArray[channelIndex][row][column] = imageData[i];
    }
  }

  return imageArray;
}
Convert canvas image data into a 3D array with dimension [height, width, 3].
Each pixel is in 0-255 scale.
@param {[int8]} imageData Canvas image data