Skip to content
Snippets Groups Projects
Commit de5013fc authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Small bugfixes in atlasq, which never arose because I assumed that all atlas

files have int type, which they don't. Also atlases handles spaces in XML
specifications
parent 716f5b18
No related branches found
No related tags found
No related merge requests found
......@@ -483,8 +483,8 @@ class AtlasDescription(object):
self.atlasID = atlasID
self.specPath = op.abspath(filename)
self.name = header.find('name').text
self.atlasType = header.find('type').text.lower()
self.name = header.find('name').text.strip()
self.atlasType = header.find('type').text.strip().lower()
# Spelling error in some of the atlas.xml files.
if self.atlasType == 'probabalistic':
......@@ -501,8 +501,8 @@ class AtlasDescription(object):
for image in images:
# Every image must also have a summary image
imagefile = image.find('imagefile') .text
summaryimagefile = image.find('summaryimagefile').text
imagefile = image.find('imagefile') .text.strip()
summaryimagefile = image.find('summaryimagefile').text.strip()
# Assuming that the path
# names begin with a slash
......@@ -533,7 +533,7 @@ class AtlasDescription(object):
for i, label in enumerate(labels):
name = label.text
name = label.text.strip()
index = int( label.attrib['index'])
x = float(label.attrib['x'])
y = float(label.attrib['y'])
......
......@@ -171,8 +171,8 @@ def queryLongOutput(atlas, sources, types, allLabels, allProps):
label = labels[0]
name = names[ 0]
if label is None:
label = np.nan
if label is None: label = np.nan
else: label = int(label)
fields = ['name', 'index']
values = [name, label]
......@@ -304,7 +304,7 @@ def ohi(namespace):
props, labels = zip(*reversed(sorted(zip(props, labels))))
for label, prop in zip(labels, props):
label = atlasDesc.labels[label].name
label = atlasDesc.labels[int(label)].name
labelStrs.append('{:d}% {}'.format(int(round(prop)), label))
if len(labelStrs) == 0: labels = 'No label found!'
......@@ -331,7 +331,7 @@ def labelNames(atlas, labels):
for l in labels:
if l is None: names.append('No label')
else: names.append(atlas.desc.labels[l].name)
else: names.append(atlas.desc.labels[int(l)].name)
return names
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment