def getSessionResourceMeta(self): global getHCP getHCP.Resource = str(self.resourcesListWidget.currentItem().text()) ResourceMeta = getHCP.getSubjectResourceMeta() # 'Name', 'Bytes', 'URI', 'Path', 'Readable', 'RealPath', 'Label', 'Format', 'Contents' Names = ResourceMeta.get('Name') Bytes = ResourceMeta.get('Bytes') URIs = ResourceMeta.get('URI') self.sessionMetaTableWidget.clearSpans() self.sessionMetaTableWidget.setRowCount(0) self.sessionMetaTableWidget.setHorizontalHeaderItem( 0, QtGui.QTableWidgetItem('File Name')) self.sessionMetaTableWidget.setHorizontalHeaderItem( 1, QtGui.QTableWidgetItem('Bytes')) self.sessionMetaTableWidget.setHorizontalHeaderItem( 2, QtGui.QTableWidgetItem('URI')) for i in xrange(0, len(Names)): self.sessionMetaTableWidget.removeRow(i) self.sessionMetaTableWidget.insertRow(i) self.sessionMetaTableWidget.setItem( i, 0, QtGui.QTableWidgetItem(Names[i])) self.sessionMetaTableWidget.setItem( i, 1, QtGui.QTableWidgetItem(Bytes[i])) self.sessionMetaTableWidget.setItem( i, 2, QtGui.QTableWidgetItem(URIs[i]))
def getSessionResourceMeta(self): global getHCP getHCP.Resource = str(self.resourcesListWidget.currentItem().text()) ResourceMeta = getHCP.getSubjectResourceMeta() # 'Name', 'Bytes', 'URI', 'Path', 'Readable', 'RealPath', 'Label', 'Format', 'Contents' Names = ResourceMeta.get('Name') Bytes = ResourceMeta.get('Bytes') URIs = ResourceMeta.get('URI') self.sessionMetaTableWidget.clearSpans() self.sessionMetaTableWidget.setRowCount(0) self.sessionMetaTableWidget.setHorizontalHeaderItem(0, QtGui.QTableWidgetItem('File Name')) self.sessionMetaTableWidget.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem('Bytes')) self.sessionMetaTableWidget.setHorizontalHeaderItem(2, QtGui.QTableWidgetItem('URI')) for i in xrange(0, len(Names)): self.sessionMetaTableWidget.removeRow(i) self.sessionMetaTableWidget.insertRow(i) self.sessionMetaTableWidget.setItem(i, 0, QtGui.QTableWidgetItem(Names[i])) self.sessionMetaTableWidget.setItem(i, 1, QtGui.QTableWidgetItem(Bytes[i])) self.sessionMetaTableWidget.setItem(i, 2, QtGui.QTableWidgetItem(URIs[i]))
OutputFileName = list() OutputFileURIName = list() OutputFilePathName = list() if (Resource is not None): #=========================================================================== # check for session on input, if not present do the full Resources call, this is a resource hog... #=========================================================================== if (getHCP.Session == None): SubjectResourcesMeta = getHCP.getSubjectResourcesMeta() getHCP.Session = SubjectResourcesMeta.get('Session')[SubjectResourcesMeta.get('Label').index(Resource)] if (Resource in SubjectResourcesMeta.get('Label')): getHCP.Resource = Resource ResourceMeta = getHCP.getSubjectResourceMeta() else: print 'ERROR: %s not in %s resources.' % (Resource, Subject) sys.exit() else: getHCP.Resource = Resource ResourceMeta = getHCP.getSubjectResourceMeta() for i in xrange(0, len(ResourceMeta.get('Path'))): #======================================================================= # if entire RESOURCE is requested... #======================================================================= if (Files == None):
OutputFileName = list() OutputFileURIName = list() OutputFilePathName = list() if (Resource is not None): #=========================================================================== # check for session on input, if not present do the full Resources call, this is a resource hog... #=========================================================================== if (getHCP.Session == None): SubjectResourcesMeta = getHCP.getSubjectResourcesMeta() getHCP.Session = SubjectResourcesMeta.get('Session')[ SubjectResourcesMeta.get('Label').index(Resource)] if (Resource in SubjectResourcesMeta.get('Label')): getHCP.Resource = Resource ResourceMeta = getHCP.getSubjectResourceMeta() else: print 'ERROR: %s not in %s resources.' % (Resource, Subject) sys.exit() else: getHCP.Resource = Resource ResourceMeta = getHCP.getSubjectResourceMeta() for i in xrange(0, len(ResourceMeta.get('Path'))): #======================================================================= # if entire RESOURCE is requested... #======================================================================= if (Files == None):
print SubmitStr if Launch: # os.system(SubmitStr) subprocess.call(SubmitStr, shell=True) #======================================================================= # StructuralHCP #======================================================================= elif (Pipeline == 'StructuralHCP'): PathMatch = list() ScanIdList = list() StructResources = ['T1w_MPR1_unproc', 'T1w_MPR2_unproc', 'T2w_SPC1_unproc', 'T2w_SPC2_unproc'] getHCP.Resource = StructResources[0] resourceMeta = getHCP.getSubjectResourceMeta() StructuralSeriesDescDict = {'T1w_MPR1' : 'T1w_MPR1', 'T1w_MPR2' : 'T1w_MPR2', 'T2w_SPC1' : 'T2w_SPC1', 'T2w_SPC2' : 'T2w_SPC2'} StructuralSeriesDescScanIdDict = {'T1w_MPR1' : None, 'T1w_MPR2' : None, 'T2w_SPC1' : None, 'T2w_SPC2' : None} StructuralSeriesQualityDict = {'T1w_MPR1' : None, 'T1w_MPR2' : None, 'T2w_SPC1' : None, 'T2w_SPC2' : None} StructuralSeriesList = ['T1w_MPR1', 'T1w_MPR2', 'T2w_SPC1', 'T2w_SPC2'] # grab the fieldmap ids... fieldmapMagIdx = seriesList.index('FieldMap_Magnitude') filedmapPhaIdx = seriesList.index('FieldMap_Phase') if (typeList[fieldmapMagIdx] == 'FieldMap') and (qualityList[fieldmapMagIdx] in UsableList): MagScanId = idList[fieldmapMagIdx] getHCP.Scan = MagScanId magScanParms = getHCP.getScanParms()
if ('404 Error' in subjectResources): pass else: subjectResources = subjectResources.get('Names') SubjectListTmp = list() SubjectResourceTmp = list() for j in xrange(0, len(subjectResources)): if ('preproc' in subjectResources[j]) and ('Structural' not in subjectResources[j]): currResource = subjectResources[j] preprocIdx = currResource.find('_preproc') currSeries = currResource[0:preprocIdx] getHCP.Resource = subjectResources[j] preprocMeta = getHCP.getSubjectResourceMeta() tailCount = 0 for k in xrange(0, len(PackageTail)): if (currSeries + PackageTail[k] in preprocMeta.get('Name') ): # print '%s%s found...' % (currSeries, PackageTail[k]) tailCount += 1 namesCount = 0 for k in xrange(0, len(PackageNames)): if (PackageNames[k] in preprocMeta.get('Name') ): print '%s found...' % (PackageNames[k]) namesCount += 1 if (tailCount == len(PackageTail)) and (namesCount == len(PackageNames)): SubjectResourceTmp.append(subjectResources[j])
pass else: subjectResources = subjectResources.get('Names') SubjectListTmp = list() SubjectResourceTmp = list() for j in xrange(0, len(subjectResources)): if ('preproc' in subjectResources[j]) and ('Structural' not in subjectResources[j]): currResource = subjectResources[j] preprocIdx = currResource.find('_preproc') currSeries = currResource[0:preprocIdx] getHCP.Resource = subjectResources[j] preprocMeta = getHCP.getSubjectResourceMeta() tailCount = 0 for k in xrange(0, len(PackageTail)): if (currSeries + PackageTail[k] in preprocMeta.get('Name')): # print '%s%s found...' % (currSeries, PackageTail[k]) tailCount += 1 namesCount = 0 for k in xrange(0, len(PackageNames)): if (PackageNames[k] in preprocMeta.get('Name')): print '%s found...' % (PackageNames[k]) namesCount += 1 if (tailCount == len(PackageTail)) and (namesCount == len(PackageNames)):
# os.system(SubmitStr) subprocess.call(SubmitStr, shell=True) #======================================================================= # StructuralHCP #======================================================================= elif (Pipeline == 'StructuralHCP'): PathMatch = list() ScanIdList = list() StructResources = [ 'T1w_MPR1_unproc', 'T1w_MPR2_unproc', 'T2w_SPC1_unproc', 'T2w_SPC2_unproc' ] getHCP.Resource = StructResources[0] resourceMeta = getHCP.getSubjectResourceMeta() StructuralSeriesDescDict = { 'T1w_MPR1': 'T1w_MPR1', 'T1w_MPR2': 'T1w_MPR2', 'T2w_SPC1': 'T2w_SPC1', 'T2w_SPC2': 'T2w_SPC2' } StructuralSeriesDescScanIdDict = { 'T1w_MPR1': None, 'T1w_MPR2': None, 'T2w_SPC1': None, 'T2w_SPC2': None } StructuralSeriesQualityDict = { 'T1w_MPR1': None,