Skip to content

Commit

Permalink
Convert the hierarchy path scan string to a number.
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Apr 24, 2015
1 parent d9f3b46 commit 9635993
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions qipipe/pipeline/qipipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ def _run_with_xnat_input(*inputs, **opts):
sess = hierarchy.pop('experiment', None)
if not sess:
raise ArgumentError("The XNAT path is missing a session: %s" % path)
scan = hierarchy.pop('scan', None)
if not scan:
scan_s = hierarchy.pop('scan', None)
if not scan_s:
raise ArgumentError("The XNAT path is missing a scan: %s" % path)
scan = int(scan_s)
# The XNAT scan object must exist.
scan_obj = xnat.find(prj, sbj, sess, scan=scan)
if not scan_obj or not scan_obj.exists():
Expand Down Expand Up @@ -221,15 +222,15 @@ def _run_with_xnat_input(*inputs, **opts):

def _scan_resource_exists(project, subject, session, scan, resource):
"""
@return whether the given XNAT scan resource exists
:return: whether the given XNAT scan resource exists
"""
with qixnat.connect() as xnat:
rsc_obj = xnat.find(project, subject, session, scan=scan,
resource=resource)
exists = rsc_obj and rsc_obj.files().get()
status = 'found' if exists else 'not found'
logger(__name__).debug("The %s %s %s scan %d resource %s was %s." %
(project, subject, session, scan, resource, status))
(project, subject, session, scan, resource, status))

return exists

Expand Down

0 comments on commit 9635993

Please sign in to comment.