<div dir="ltr">Hi Michael,<div><br></div><div>I looked through the code for vtkDataSetSurfaceFilter (used internally by vtkDataSetMapper), and it uses 'double' for the vtkPoints if the input is vtkImageData.  It probably does this because the Origin and Spacing of vtkImageData are stored as 'double'.  This isn't going to account for 12GB, however.</div><div><br></div><div>If you run vtkDataSetSurfaceFilter yourself, then you can use vtkDataSetSurfaceFilter::UseStripsOn() to reduce the size of the cell array.  This should be safe as long as your input uses point scalars (typical for images).  Also, depending on the precise amount of memory it saves, you might get some clues as to where the memory is being lost.</div><div><br></div><div>Since I work primarily with images, my preferred method of displaying large images is to use vtkImageResliceMapper with ResampleToScreenPixelsOn() and SeparateWindowLevelOperationOff().  The first option ensures that the generated texture is only as large as the render window.  The second option ensures that the generation of the RGBA texture from the image is performed in one step, without requiring any intermediate data storage.  Only a few (usually just two) triangles are used.  It's a totally different pipeline from the usual VTK geometry rendering pipeline, however, so it would add complexity to your app if your usual focus is on geometry.</div><div><br></div><div> - David</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 23, 2018 at 2:06 PM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We have a Tiled data set consisting of a 9x5 grid of images. Each image is 1292x968 grayscale. We are reading all of the images into a VTK based application to render. After the data finally rendered (Took about 5 minutes on an iMac Pro with Vega64 GPU) we took a look at the memory usage of the app. Before loading the data it was sitting at about 390MB. After loading and rendering it was taking somewhere from 16GB~17GB. I have tried to "do the math" to account for all the memory but I am coming up _really_ short in trying to account for what could be taking up all the memory. As a check we loaded the same dataset into ParaView and ParaView took around 20GB so we are not that far off. Just seems like that is a lot of memory to use. But maybe I'm just not familiar enough with the VTK and the OpenGL backend to understand why that much memory is required.<br>
<br>
Math Part:<br>
1292 * 968 * 54 = 67,535,424 bytes of uint8 data.<br>
If there are triangles being rendered then I would assume that roughly there is 1293*969*54 = 1,252,917 verts @ 12 bytes each = 15,035,004 Bytes. Then we need to generate Triangles so that is 2 Triangles per voxel = 1292*968*54*2=135,070,848 cells. Maybe 4 size_t (64bit ints) for the description of the cell to get us to 4,322,267,136 bytes to hold the triangle information. We need to generate RGBA color for the actual rendering: 1292 * 968 * 54*4 = 270,141,696 bytes.<br>
<br>
      67,535,424<br>
      15,035,004<br>
4,322,267,136<br>
   270,141,696<br>
---------------------<br>
4,674,979,260 Total Bytes.<br>
<br>
Where is the other 12GB of memory being taken up? A gentle explanation would be wonderful. We are trying to figure out if we are doing something wrong in the codes.<br>
<br>
--<br>
Michael Jackson | Owner, President<br>
      BlueQuartz Software<br>
[e] <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
[w] <a href="http://www.bluequartz.net" rel="noreferrer" target="_blank">www.bluequartz.net</a><br></blockquote></div></div></div></div>