def get_volume(self, offset, offset_inner=None): if offset_inner == None: offset_inner = -pow(10., 38) cnt = 0. scl = Scaler(self._voxels) vo = scl.scale(self._voxels.shape[0]*2, self._voxels.shape[1]*2, self._voxels.shape[2]*2).value print vo.shape for val in vo.flatten(): if (val < offset) and (val > offset_inner): cnt += 1. return cnt*(self.spc/2)**3
def get_voxels(self, refine=1): scaler = Scaler(self._voxels) dims = (self._voxels.shape[0]*refine,self._voxels.shape[1]*refine,self._voxels.shape[2]*refine) return scaler.scale(*dims).value