crashing when using clip over Image (Uniform Rectilinear Grid)

Hello,
I am opening a raw image file using the following function:
def readRawFile(volFilePath=‘’,volInfoFilePath=‘’,format=‘.vol’):
if volFilePath[-4:]!=format:
volFilePath+=format
if volInfoFilePath==‘’:
volInfoFilePath=volFilePath+‘.info’
infoValues = {}
with open(volInfoFilePath, “r”) as f:
for line in f:
line = line.strip()
if “=” in line:
key, value = line.split(“=”)
key = key.strip()
value = value.strip()
infoValues[key] = value
imageReaderSource=ImageReader(registrationName=volFilePath.split(‘/’[-1].replace(format,‘’), FileNames=[volFilePath])
imageReaderSource.Set(
DataScalarType=‘float’,
DataByteOrder=‘LittleEndian’,
DataSpacing=[float(infoValues[“voxelSize”]) for i in range(3)],
DataExtent=[0, int(infoValues[“NUM_X”])-1, 0, int(infoValues[“NUM_Y”])-1, 0, int(infoValues[“NUM_Z”])-1],)
UpdatePipeline()
return imageReaderSource,infoValues

and while I am not having issues with slicing the source generated, when I use clip paraview crashes with the following error:

( 76.501s) [paraview ]vtkGenericDataArray.txx:377 ERR| vtkDoubleArray (0x33040200): Unable to allocate 8589934592 elements of size 8 bytes.
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
error: exception occurred: Subprocess aborted
critical: In unknown, line 0
critical: Cannot open data file " "" "

Here is your answer, looks like there is too big of an allocation (70Gb).

Is that data big ?

yes it is! but what I dont understand is that even if i do a clip box with a few elements (really small box) it crashes also (when I am having 10gb remaining, and I am consuming 32gb for the original data and i am selecting less than 1% of the volume of it).

I suspect an allocation on the entire domain, definitely a bug to fix here.

if internal to kitware i dont have an issue to share the data (i send it to you in a private link) you want me to report an issue or do something else?

Ill try to repro first.

1 Like

here if you want you can get the save state (althought there is absolutily nothing fancy on it, only the source filter fo the image reader). i really need to be able to extract the data so i can work on (right now i am stock with this). the data I send you a private message with the .vol file and .vol.info file to be downloaded from a tar file

Indeed, please share a state file, as I dont know how you configured the ImageReader.

here you have the parameters,

1 Like

I confirm that during the application of clip, I see a spike usage of RAM which is then release immediatly. This definitely looks llike an allocation that should not be done, please open an issue.

1 Like