Skip to content

Commit

Permalink
remove percentage from measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Aug 22, 2024
1 parent 26edabb commit c4f2f4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions markimg/markimg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit c4f2f4d

Please sign in to comment.