Regarding 3D image formation with vtkPNGReader

I have total 12,000 .png images. Out of those, if I pass 2,000 images on vtkPNGReader() then it is possible to see their 3D images. But when this number increases (>2,000) then it doesn’t show any kind of expected results. So, is there any possibility of vtk library limitations disturbing the analysis of more number of .png images at a time?

Most likely you run out of memory. Do you get an error complaining that memory allocation fails?

How many rows and columns are in one image? How much physical RAM do you have and how much virtual memory have you configured in your operating system settings?

If you’re visualizing it using the GPU volume mapper, perhaps you’re hitting a GPU 3D texture size limit. What GPU is this? If it’s an old Sandy Bridge era GPU from Intel, I think they have a 2048 limit on the texture size (Haswell GPUs might too I think). I know VTK has some mechanism for splitting the volume into multiple textures when rendering it, to work around such limitations, but I can’t remember the name of the functions. I know it comes at some performance loss.

It could also be GPU memory exhaustion of course. Are there any errors printed to stout/stderr by VTK?

A stack of 2,000 or so of 2D images can be regarded as a 3D volume. Then the “curse of dimensionality” strikes… 2k * 1000x1000 images mean 2 billion cells. If you have single precision RGB values in each cell, that translates to roughly 2k * 1000x1000 * float,float,float = 24GB. As you can see, volume rendering escalate quite quickly, thus it calls for some preprocessing step (e.g. level-of-detail or volume slicing) instead of shoving all your data into the graphics card’s memory.

I have 16GB RAM and i dont have external GPU. I got following error when i rendering vtkVolume data.

ERROR: In C:\VPP\standalone-build\VTK-source\Rendering\VolumeOpenGL2\vtkVolumeTexture.cxx, line 748 vtkVolumeTexture (000001E46B7D4D40): Invalid texture dimensions [240, 240, 12840]

What is your GPU then ?
Looks like you do not have enough GPU memory.

That translates to 8.8GB (RGB, float) to be loaded into your graphics card. 11.8GB if the texture is RGBA, float. My high-end video card has 16GB. Even that is not too roomy for that figure. You have to check yours. If you are on Windows, you can check this out:

1 Like

Hello Snehal,

Can you give me some pointers on how to read the stack of PNG files and see their 3D images ?