Why VTK filters behave strangely when I feed my dataset to them?

I have vtkUnstructuredGrid that has a vector array in it. All the cell types in this vtkUnstructuredGrid are VTK_VOXEL and my vector array is attributed to the cells (i.e. cell data). Now I want to extract the cell centers of these voxels by using vtkCellCenters and then resample this point cloud to a vtkImage by using vtkResampleToImage. This is my code:

reader = vtk.vtkXMLUnstructuredGridReader()

ug = reader.GetOutput()

cleaner = vtk.vtkCleanUnstructuredGrid()

ugCleaned = cleaner.GetOutput()

cellCenters = vtk.vtkCellCenters()
ugCellCenters = cellCenters.GetOutput()
bounds = ugCellCenters.GetBounds()

rangeX = int((bounds[1] - bounds[0]) / deltaX)
rangeY = int((bounds[3] - bounds[2]) / deltaX)
rangeZ = int((bounds[5] - bounds[4]) / deltaX)

resampleFilter = vtk.vtkResampleToImage()
resampleFilter.SetSamplingDimensions(rangeX, rangeY, rangeZ)

sg = resampleFilter.GetOutput()

print np.unique(vtk_to_numpy(sg.GetPointData().GetArray('vtkValidPointMask')))

Unfortunately, I can’t provide the file to test and reproduce the thing that I’m seeing due to its large size. But basically, at the end the thing that I print is the mask for the points inside my vtkUnstructuredGrid and outside my vtkUnstructuredGrid, so I expect to get: [0,1], but I’m getting [0], which means the filter thinks all the points are outside of my vtkUnstructuredGrid. Long story short: I don’t think it’s a problem specifically related to vtkResampleToImage. The interesting thing is that If I apply a vtkClipDataSet before sending my vtkUnstructuredGrid to resampler, everything works fine, but I don’t want to clip my dataset, when I don’t need it, and for some reason I want to just work with my original data. The other interesting thing is that some other filters for example to create streamline shows same behavior and it doesn’t produce any result at all, but for example glyph filter just works fine. I have this problem with this only dataset that contains voxels and not any other dataset that I worked until now. Any idea what’s going on here? Does VTK has any problem with an unstructured grid composed of only voxels?