<div dir="ltr">Hi all.<div>In my VTK-based Java application, I am reading a "raw volume file" (containing a set of CT slices) through some Java code looking like this:</div><div><br></div><div><div>[...]</div><div>vtkImageReader imageReaderVTK =  new vtkImageReader();</div><div>imageReaderVTK.FileLowerLeftOn();</div><div>imageReaderVTK.SetFileDimensionality(3);</div><div>imageReaderVTK.SetFileName(curRawVolFile.getAbsolutePath());</div><div>imageReaderVTK.SetDataExtent(0, sliceCols - 1,</div><div>                      0, sliceRows - 1,</div><div>                      0, numOfUsedImages - 1);</div><div>imageReaderVTK.SetDataSpacing(xSpacing, ySpacing, zSpacing);</div><div>imageReaderVTK.SetDataOrigin(0.0, 0.0, 0.0);</div><div>imageReaderVTK.SetDataScalarTypeToUnsignedShort();</div><div>imageReaderVTK.SetDataByteOrderToBigEndian();</div><div><br></div><div>// The following call may cause a process crash due to out-of-memory</div><div>imageReaderVTK.UpdateWholeExtent();</div><div>[...]</div></div><div><br></div><div>I am then passing this volume to a vtkImagePlaneWidget for some reslicing.</div><div><br></div><div>As the last comment (in the code fragment above) suggests, in some cases I get a crash of the JVM process, due to the fact the reader goes out of memory while actually reading and allocating the whole volume in memory. This especially happens when using a 32-bit JRE.</div><div>I understand that I cannot read a huge volume in memory if just a small amount of memory is available to the process, but my question is:</div><div>is there a way to manage "more gracefully" this out-of-memory from Java code, in such a way to be able to inform the user that "Not enough memory is available to read this volume", instead of causing a JVM crash?</div><div><br></div><div>I am using VTK 6.1.0.</div><div><br></div><div>Thanks for any hint/suggestion about this topic.</div><div><br></div><div>Best regards,</div><div><br></div><div>Marco</div><div><br></div></div>