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

Fix to fsl.data.mesh.findReferenceImage

parent f52857e3
No related branches found
No related tags found
No related merge requests found
......@@ -243,7 +243,7 @@ def loadVTKPolydataFile(infile):
def getFIRSTPrefix(modelfile):
"""If the given ``vtk`` file was generated by `FIRST
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FIRST>`_, this function
will return the file prefix. Otherwise an ``Exception`` will be
will return the file prefix. Otherwise a ``ValueError`` will be
raised.
"""
......@@ -268,8 +268,18 @@ def findReferenceImage(modelfile):
try:
prefix = getFIRSTPrefix(modelfile)
return fslimage.addExt(prefix, mustExist=True)
dirname = op.dirname(modelfile)
prefixes = [getFIRSTPrefix(modelfile)]
except:
return None
if prefixes[0].endswith('_first'):
prefixes.append(prefixes[0][:-6])
for p in prefixes:
try:
return fslimage.addExt(op.join(dirname, p), mustExist=True)
except:
continue
return None
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