From c4f2f4d850caa5aee7d48b0ea173e0bd8e9a484b Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Thu, 22 Aug 2024 17:35:37 -0400 Subject: [PATCH] remove percentage from measurements --- markimg/markimg.py | 20 +++++++++----------- setup.py | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/markimg/markimg.py b/markimg/markimg.py index c331812..699f01c 100644 --- a/markimg/markimg.py +++ b/markimg/markimg.py @@ -501,10 +501,10 @@ def run(self, options): plt.text(x_pos, y_pos, leftFemurInfo, color='white', fontsize=options.textSize, rotation=90) femurDiffInfo = str(self.getDiff(d_lengths['Right femur'], d_lengths['Left femur'])) + f' {unit}, ' + \ - self.compareLength(d_lengths['Left femur'], d_lengths['Right femur']) + self.compareLength(d_lengths['Left femur'], d_lengths['Right femur']).split(':')[0] femurDiffText = 'Difference'.rjust(16) + f': {femurDiffInfo}' - d_femur['Difference'] = femurDiffInfo + d_femur['Difference'] = femurDiffInfo + self.compareLength(d_lengths['Left femur'], d_lengths['Right femur']).split(':')[1] x_pos = x_pos + line_gap plt.text(x_pos, y_pos, femurDiffText, color='white', fontsize=options.textSize, rotation=90) @@ -524,10 +524,10 @@ def run(self, options): plt.text(x_pos, y_pos, leftTibiaInfo, color='white', fontsize=options.textSize, rotation=90) tibiaDiffInfo = str(self.getDiff(d_lengths['Right tibia'], d_lengths['Left tibia'])) + f' {unit}, ' + \ - self.compareLength(d_lengths['Left tibia'], d_lengths['Right tibia']) + self.compareLength(d_lengths['Left tibia'], d_lengths['Right tibia']).split(':')[0] tibaiDiffText = 'Difference'.rjust(16) + f': {tibiaDiffInfo}' - d_tibia['Difference'] = tibiaDiffInfo + d_tibia['Difference'] = tibiaDiffInfo + self.compareLength(d_lengths['Left tibia'], d_lengths['Right tibia']).split(':')[1] x_pos = x_pos + line_gap plt.text(x_pos, y_pos, tibaiDiffText, color='white', fontsize=options.textSize, rotation=90) @@ -552,9 +552,9 @@ def run(self, options): totalComp = self.compareLength(self.getSum(d_lengths['Left femur'], d_lengths['Left tibia']), self.getSum(d_lengths['Right femur'], d_lengths['Right tibia'])) - totalDiffInfo = str(totalDiff) + f' {unit}, ' + totalComp + totalDiffInfo = str(totalDiff) + f' {unit}, ' + totalComp.split(':')[0] totalDiffText = 'Total difference'.rjust(16) + f': {totalDiffInfo}' - d_total['Difference'] = totalDiffInfo + d_total['Difference'] = totalDiffInfo + totalComp.split(':')[1] x_pos = x_pos + line_gap plt.text(x_pos, y_pos, totalDiffText, color='white', fontsize=options.textSize, rotation=90) @@ -668,15 +668,13 @@ def getSum(self, val1, val2): return sum def compareLength(self, left, right): - compareText = "equal" + compareText = "equal: 0.0%" diff_perc = "" try: if left > right: - compareText = f'left longer ' - diff_perc = f'({round(((left - right) / right) * 100, 1)}%)' + compareText = f'left longer: {round(((left - right) / right) * 100, 1)}%' elif right > left: - compareText = f'right longer ' - diff_perc = f'({round(((right - left) / left) * 100, 1)}%)' + compareText = f'right longer: {round(((right - left) / left) * 100, 1)}%' except ZeroDivisionError: compareText = "Error: ZeroDivisionError" diff --git a/setup.py b/setup.py index 41a1862..a48aa79 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='markimg', - version='1.5.2', + version='1.5.4', description='An app to mark landmark points and lines on an input image', long_description=readme, author='FNNDSC',