def calculateDiameters(self): """ Calculate maximum diameters in 2D and 3D using C extension. Function returns a tuple with 4 elements: 0. Maximum 2D diameter Slice (XY Plane, Axial) 1. Maximum 2D diameter Column (ZX Plane, Coronal) 2. Maximum 2D diameter Row (ZY Plane, Sagittal) 3. Maximum 3D diameter """ self.logger.debug('Calculating Maximum diameters in C') Ns = len(self.labelledVoxelCoordinates[0]) return cShape.calculate_diameter(self.maskArray, self.pixelSpacing, Ns)
def _calculateCDiameters(self): """ Calculate maximum diameters in 2D and 3D using C extension. Function returns a tuple with 4 elements: 0. Maximum 2D diameter Slice (XY Plane, Axial) 1. Maximum 2D diameter Column (ZX Plane, Coronal) 2. Maximum 2D diameter Row (ZY Plane, Sagittal) 3. Maximum 3D diameter """ self.logger.debug('Calculating Maximum 3D diameter in C') Ns = self.targetVoxelArray.size size = numpy.max(self.matrixCoordinates, 1) - numpy.min( self.matrixCoordinates, 1) + 1 angles = imageoperations.generateAngles(size) return cShape.calculate_diameter(self.maskArray, self.pixelSpacing, angles, Ns)