def extract(self, experiment, variant, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"

        if not os.path.isfile(filepath):
            return ['NA'] * 3
        vd = VoxelData(filepath)
        dnaMatrix = vd.getDNAmatrix()
        if type(dnaMatrix) == types.BooleanType and not dnaMatrix:
            return ['NA'] * 3

        toCheck = []
        for x in range(10):
            for y in range(10):
                for z in range(10):
                    if int(dnaMatrix[z, y, x]) in [3, 4]:
                        val = int(dnaMatrix[z, y, x])
                        mirrors = [
                            (x, y, z),
                            (9 - x, y, z),
                            (x, 9 - y, z),
                            (x, y, 9 - z),
                            (y, x, z),
                            (x, z, y),
                            (z, y, x),
                            (9 - y, 9 - x, z),
                            (x, 9 - z, 9 - y),
                            (9 - z, y, 9 - x)
                        ]
                        mirrors = list(set(mirrors))
                        cellHash = str(x) + '-' + str(y) + '-' + str(z)
                        toCheck += zip(mirrors, [val] * len(mirrors), [cellHash] * len(mirrors))

        sameExisting = 0
        missing = 0
        counterExisting = 0
        musclesChecked = []
        for toCheckLocation in toCheck:
            val = toCheckLocation[1]
            knownMuscle = False
            if toCheckLocation[2] in musclesChecked:
                knownMuscle = True
            opposite = 4
            if val == 4:
                opposite = 3
            x, y, z = toCheckLocation[0]
            if int(dnaMatrix[x, y, z]) == val:
                sameExisting += 1
            elif int(dnaMatrix[x, y, z]) == opposite:
                counterExisting += 1
            else:
                if not knownMuscle:
                    missing += 1

            if not knownMuscle:
                musclesChecked.append(toCheckLocation[2])

        return [sameExisting, counterExisting, missing]
    def extract(self, experiment, type, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"
        if os.path.isfile(filepath):
            vd = VoxelData(filepath)
            lifetime = vd.getLifeTime()
            if not lifetime:
                return ['NA']
            return [lifetime]

        else:
            return ['NA']
    def extract(self, experiment, type, indiv):
        noResultVal = ['NA', 'NA', 'NA']
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"
        if os.path.isfile(filepath):
            vd = VoxelData(filepath)
            relCounts = vd.getRelCounts()
            if not relCounts:
                return noResultVal

            return [relCounts["fat"], relCounts["muscle"], relCounts["bone"]]
        else:
            return noResultVal
    def extract(self, experiment, type, indiv):
        noResultVal = ["NA", "NA", "NA"]
        filepath = GetAltFile.getAltPopFile(experiment, type, indiv)
        if filepath != False:
            vd = VoxelData(filepath)
            relCounts = vd.getRelCounts()
            if not relCounts:
                return noResultVal

            return [relCounts["fat"], relCounts["muscle"], relCounts["bone"]]
        else:
            return noResultVal
    def extract(self, experiment, type, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"
        if os.path.isfile(filepath):
            vd = VoxelData(filepath)
            absCounts = vd.getAbsCounts()
            if not absCounts:
                return ['NA']
            probability = (absCounts["fat"] / 1000.0) * 0.5
            return [probability]

        else:
            return ['NA']
    def extract(self, experiment, type, indiv):
        noResultVal = ['NA'] * 4
        filepath = GetAltFile.getAltPopFile(experiment, type, indiv)
        if filepath != False:
            vd = VoxelData(filepath)
            absCounts = vd.getAbsCounts()
            if not absCounts:
                return noResultVal

            return [absCounts["fat"], absCounts["muscle"], absCounts["bone"], sum(absCounts.values())]

        else:
            return noResultVal
    def extract(self, experiment, type, indiv):
        noResultVal = ['NA'] * 4
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"
        if os.path.isfile(filepath):
            vd = VoxelData(filepath)
            absCounts = vd.getAbsCounts()
            if not absCounts:
                return noResultVal

            return [absCounts["fat"], absCounts["muscle"], absCounts["bone"], sum(absCounts.values())]

        else:
            return noResultVal
    def extract(self, experiment, variant, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"

        if not os.path.isfile(filepath):
            return ['NA'] * 6
        vd = VoxelData(filepath)
        dnaMatrix = vd.getDNAmatrix()
        if type(dnaMatrix) == types.BooleanType and not dnaMatrix:
            return ['NA'] * 6

        muscleBottom = 0
        for x in range(10):
            for y in range(10):
                for z in range(3):
                    if int(dnaMatrix[z, y, x]) in [3, 4]:
                        muscleBottom += 1

        muscleTop = 0
        for x in range(10):
            for y in range(10):
                for z in range(3):
                    if int(dnaMatrix[z + 7, y, x]) in [3, 4]:
                        muscleTop += 1

        muscleCenter = 0
        for x in range(4):
            for y in range(4):
                for z in range(4):
                    if int(dnaMatrix[z + 3, y + 3, x + 3]) in [3, 4]:
                        muscleCenter += 1

        muscleOuter = 0
        for x in [0, 1, 8, 9]:
            for y in [0, 1, 8, 9]:
                for z in [0, 1, 8, 9]:
                    if int(dnaMatrix[z, y, x]) in [3, 4]:
                        muscleOuter += 1

        muscleTotal = vd.dna.count("3") + vd.dna.count("4")

        if muscleTotal > 0:
            muscleCenterRel = float(muscleCenter) / muscleTotal
            muscleOuterRel = float(muscleOuter) / muscleTotal
        else:
            muscleCenterRel = 0.0
            muscleOuterRel = 0.0

        return [muscleBottom, muscleTop, muscleCenter, muscleOuter, muscleCenterRel, muscleOuterRel]
    def extract(self, experiment, type, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"

        if not os.path.isfile(filepath):
            return ['NA']
        vd = VoxelData(filepath)
        dnaMatrix = vd.getDNAmatrix().astype(int)

        H = 0
        total = 1000
        for i in range(5):
            count = (dnaMatrix == i).sum()
            p_i = count/total
            if p_i == 0:
                H -= 0
            else:
                H -= p_i * math.log(p_i,2)

        return [H]
    def extract(self, experiment, type, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"

        if not os.path.isfile(filepath):
            return ["NA"] * 4
        vd = VoxelData(filepath)
        dnaMatrix = vd.getDNAmatrix()
        if isinstance(dnaMatrix, bool):
            return ["NA"] * 4
        dnaMatrix = dnaMatrix.astype(int)
        ratio, triangles = self.calc_complexity(dnaMatrix)
        limbs = self.calc_limbs(dnaMatrix)

        ratio_norm = ratio  # No normalization because values are already 0..1
        triangles_norm = (triangles - 12) / (70 - 12)  # Normalization according to the data used to generate PCAvector
        limbs_norm = (limbs - 1) / (5 - 1)  # Normalization according to the data used to generate PCAvector

        shapeComplexity = np.dot(self.PCAvector, np.array([ratio_norm, triangles_norm, limbs_norm]))

        return [ratio, triangles, limbs, shapeComplexity]
    def extract(self, experiment, variant, indiv):
        filepath = experiment[2] + os.path.sep + PathConfig.populationFolderNormal + os.path.sep + indiv[0] + "_vox.vxa"

        if os.path.isfile(filepath):
            vd = VoxelData(filepath)
            dnaMatrix = vd.getDNAmatrix()
            if type(dnaMatrix) == types.BooleanType and not dnaMatrix:
                return ['NA'] * 6

            zMin = 9999
            zMax = 0
            for x in range(10):
                for y in range(10):
                    zColumn = [cell for cell in dnaMatrix[:, y, x] if cell != "0"]
                    zMax = max(len(zColumn), zMax)
                    zMin = min(len(zColumn), zMin)

            yMin = 9999
            yMax = 0
            for x in range(10):
                for z in range(10):
                    yColumn = [cell for cell in dnaMatrix[z, :, x] if cell != "0"]
                    yMax = max(len(yColumn), yMax)
                    yMin = min(len(yColumn), yMin)

            xMin = 9999
            xMax = 0
            for z in range(10):
                for y in range(10):
                    xColumn = [cell for cell in dnaMatrix[z, y, :] if cell != "0"]
                    xMax = max(len(xColumn), xMax)
                    xMin = min(len(xColumn), xMin)

            return [xMax, yMax, zMax, xMin, yMin, zMin]

        else:
            return ['NA'] * 6