def _calculateMatrix(self): P_ngtdm, angles = cMatrices.calculate_ngtdm( self.matrix, self.maskArray, numpy.array(self.settings.get('distances', [1])), self.coefficients['Ng'], self.settings.get('force2D', False), self.settings.get('force2Ddimension', 0)) # Delete empty grey levels P_ngtdm = numpy.delete(P_ngtdm, numpy.where(P_ngtdm[:, 0] == 0), 0) return P_ngtdm
def _calculateCMatrix(self): angles = imageoperations.generateAngles(self.boundingBoxSize, **self.kwargs) Ng = self.coefficients['Ng'] P_ngtdm = cMatrices.calculate_ngtdm(self.matrix, self.maskArray, angles, Ng) # Delete empty grey levels P_ngtdm = numpy.delete(P_ngtdm, numpy.where(P_ngtdm[:, 0] == 0), 0) # Normalize P_ngtdm[:, 0] (= p_i) P_ngtdm[:, 0] = P_ngtdm[:, 0] / self.coefficients['Np'] return P_ngtdm
def _calculateMatrix(self, voxelCoordinates=None): matrix_args = [ self.imageArray, self.maskArray, numpy.array(self.settings.get('distances', [1])), self.coefficients['Ng'], self.settings.get('force2D', False), self.settings.get('force2Ddimension', 0) ] if self.voxelBased: matrix_args += [self.settings.get('kernelRadius', 1), voxelCoordinates] P_ngtdm = cMatrices.calculate_ngtdm(*matrix_args) # shape (Nvox, Ng, 3) # Delete empty grey levels emptyGrayLevels = numpy.where(numpy.sum(P_ngtdm[:, :, 0], 0) == 0) P_ngtdm = numpy.delete(P_ngtdm, emptyGrayLevels, 1) return P_ngtdm