question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

3 channel image (RGB) example

See original GitHub issue

Hi jbms,

Do you have a working example for 3 channel image on Neuroglancer? I am trying to troubleshoot if chunking on CloudVolume is failing or the shader control needs to be configured differently. Perhaps, three channel image need to be converted to a gray scale image and then chunked?

Thank you so much for your help. -m

#uicontrol vec3 color color(default="blue")
#uicontrol float min slider(default=0, min=0, max=1, step=0.01)
#uicontrol float max slider(default=1, min=0, max=1, step=0.01)
#uicontrol float brightness slider(default=0, min=-1, max=1, step=0.1)
#uicontrol float contrast slider(default=0, min=-3, max=3, step=0.1)

float scale(float x) {
  return (x - min) / (max - min);
}

void main() {
  emitRGB(
    color * vec3(
      scale(
        toNormalized(getDataValue()))
       + brightness) * exp(contrast)
  );
}
Screen Shot 2021-05-17 at 7 21 06 PM Screen Shot 2021-05-17 at 7 21 32 PM

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
jbmscommented, May 18, 2021

It turns out the problem is that the chunk size you are using, [613, 2753, 1] is too large, as it results in Neuroglancer attempting to create a 3-d texture of size [613, 2753, 3].

The developer console shows:

texture_access.ts:317 WebGL: INVALID_VALUE: texImage3D: width, height or depth out of range

On my machine, webglreport.com (under webGL2 tab) shows a maximum 3d texture size of 2048, meaning all dimensions must be <= 2048.

Currently Neuroglancer always stores each chunk as a single texture. In principle Neuroglancer could do rechunking client side to avoid exceeding the maximum chunk size, but that is not implemented.

If you rewrite your volume to use a smaller chunk size it should work. I would recommend e.g. [512, 512, 1].

1reaction
jbmscommented, May 18, 2021

My email is jbms@google.com

Read more comments on GitHub >

github_iconTop Results From Across the Web

How fast in Python change 3 channel rgb color image to 1 ...
Every image has width of 32 pixels, height of 32 pixels, and 3 channels for RGB colors. I want to change them to...
Read more >
How do I split a color image into its 3 RGB channels?
Use imread(), then; Invert the images using img=255-img; if image is grayscale, make red, green, and blue equal to the image, otherwise get...
Read more >
How to Convert Three Channels of Colored Image into ...
RGB stands for Red, Green and Blue. An RGB image contains 3 channels each for RGB colour. It is represented by three 2-D...
Read more >
Understanding the concept of Channels in an Image - Medium
Unlike grayscale images, RGB images are three channeled. Each pixel is made up of three channels, with each channel representing a colour.
Read more >
Channel (digital image) - Wikipedia
Color digital images are made of pixels, and pixels are made of combinations of primary colors represented by a series of code. A...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found