def getSubjectSessions(self): global getHCP # self.sessionsComboBox.clear() getHCP.Subject = str(self.subjectsListWidget.currentItem().text()) # getHCP.Subject = str(self.subjectsComboBox.currentText()) Sessions = getHCP.getSubjectSessions() SessionsList = list(set(Sessions.get('Sessions'))) # self.sessionsTextEdit.setText('\n'.join(Sessions.get('Sessions'))) # self.sessionsComboBox.addItems(SessionsList) self.sessionsListWidget.clear() for i in xrange(0, len(SessionsList)): self.sessionsListWidget.addItem(SessionsList[i])
#=============================================================================== # grab output files... # NOTES: need to deal with xtr QC... #=============================================================================== for i in xrange(0, len(inputSubjectsList)): getHCP.Subject = inputSubjectsList[i] print i, getHCP.Subject getHCP.Session = getHCP.Subject + '_strc' getHCP.SessionType = 'Structural' # getHCP.AssessorDataType = 'qcAssessmentData' AssessorIDs = getHCP.getAssessorIDs( ) currSessions, currSessionType = getHCP.getSubjectSessions() StrcIdx = [k for k, element in enumerate(currSessionType) if element == 'strc'] for j in xrange(0, len(StrcIdx)): writeScanQuality = list() writeScanSeries = list() writeAssessorFileURIList = list() getHCP.Session = currSessions[StrcIdx[j]] # get quality and scan type to match up with QC output... Quality, ScanId, Series, Sessions, ScanType = getHCP.getSessionQuality() #=============================================================================== # make a list of quality and series for printing... ScanTypeIdx = [k for k, element in enumerate(ScanType) if (element == 'T1w') or (element == 'T2w')] for k in xrange(0, len(ScanTypeIdx)):
if (Pipeline == 'FunctionalHCP'): PipelineSubString = ['fnc', 'task', 'rest'] elif (Pipeline == 'StructuralHCP'): PipelineSubString = ['strc'] elif (Pipeline == 'DiffusionHCP'): PipelineSubString = ['diff'] elif (Pipeline == 'FIX_HCP'): PipelineSubString = ['fnc', 'rest'] elif (Pipeline == 'TaskfMRIHCP'): PipelineSubString = ['fnc'] else: PipelineSubString = None UsableList = ['good', 'excellent', 'usable', 'undetermined'] linIdx = 0 for h in xrange(0, len(SubjectsList)): getHCP.Subject = SubjectsList[h] SubjectSessions = getHCP.getSubjectSessions() SubjectMetaData = getHCP.getSubjectMeta() # find correct session... for i in xrange(0, len(SubjectSessions.get('Sessions'))): getHCP.Session = SubjectSessions.get('Sessions')[i] sessionMeta = getHCP.getSessionMeta() if (FunctSeries != None) and (FunctSeries in sessionMeta.get('Series')): break else: try: getHCP.Session = SubjectSessions.get('Sessions')[SubjectSessions.get('Types').index(PipelineSubString[0])] except: break sessionMeta = getHCP.getSessionMeta()
T1wList.append('T1wDividedByT2w.nii.gz') T1wList.append('T1wDividedByT2w_ribbon.nii.gz') T1wList.append('brainmask_fs.nii.gz') T1wList.append('wmparc.nii.gz') T1wList.append('BiasField_acpc_dc.nii.gz') # # SourceDir = '/MNINonLinear/xfms' xfmsList = list() xfmsList.append('acpc_dc2standard.nii.gz') xfmsList.append('NonlinearRegJacobians.nii.gz') xfmsList.append('standard2acpc_dc.nii.gz') #=============================================================================== getHCP.DestinationDir = DestDir getHCP.Project = Project getHCP.Subject = Subject SubjectSessions, SubjectSessionsType = getHCP.getSubjectSessions() SubjectResources = getHCP.getSubjectResources() SubjectSessionsUniq = set(SubjectResources.get('FileSessions')) print 'Length of unique File Names, URIs, Sessions, and Labels: %s %s %s %s' % ( len(set(SubjectResources.get('FileNames'))), len(set(SubjectResources.get('FileURIs'))), len(set(SubjectResources.get('FileSessions'))), len(set(SubjectResources.get('FileLabels')))) Keywords = [ 'MNINonLinear', 'MNINonLinear/Native', 'MNINonLinear/fsaverage_LR32k', 'T1w/Native' ] FileURIs = SubjectResources.get('FileURIs') FileSessions = SubjectResources.get('FileSessions')
#=============================================================================== # grab output files... # NOTES: need to deal with xtr QC... #=============================================================================== for i in xrange(0, len(inputSubjectsList)): getHCP.Subject = inputSubjectsList[i] print i, getHCP.Subject getHCP.Session = getHCP.Subject + '_strc' getHCP.SessionType = 'Structural' # getHCP.AssessorDataType = 'qcAssessmentData' AssessorIDs = getHCP.getAssessorIDs() currSessions, currSessionType = getHCP.getSubjectSessions() StrcIdx = [ k for k, element in enumerate(currSessionType) if element == 'strc' ] for j in xrange(0, len(StrcIdx)): writeScanQuality = list() writeScanSeries = list() writeAssessorFileURIList = list() getHCP.Session = currSessions[StrcIdx[j]] # get quality and scan type to match up with QC output... Quality, ScanId, Series, Sessions, ScanType = getHCP.getSessionQuality( ) #===============================================================================
# getScanParms # getServer # getSessionId # getSessionMeta # getSessionQuality # getSubjectResourceMeta # getSubjectResourcesMeta # getSubjects # getSubjectSessions # getSubjectsSessions # getURLString #============================================================================== Projects = getHCP.getProjects() getHCP.Subject = getHCP.Subjects[0] getHCP.SubjectSessions = getHCP.getSubjectSessions() getHCP.Session = getHCP.SubjectSessions.get('Sessions')[0] getHCP.SessionMeta = getHCP.getSessionMeta() ScanParms = getHCP.getScanParms() ScanMeta = getHCP.getScanMeta() print ScanMeta.get('URIs')[ScanMeta.get('Collections').index('NIFTI')] writeHCP.writeFileFromURL(getHCP, ScanMeta.get('URIs')[ScanMeta.get('Collections').index('NIFTI')]) if (getHCP.Server.find('intradb') != -1): AssessorIDs = getHCP.getAssessorIDs( ) AssessorFileURIList = getHCP.getAssessorOutputFile( AssessorIDs )
# getScanParms # getServer # getSessionId # getSessionMeta # getSessionQuality # getSubjectResourceMeta # getSubjectResourcesMeta # getSubjects # getSubjectSessions # getSubjectsSessions # getURLString # ============================================================================== Projects = getHCP.getProjects() getHCP.Subject = getHCP.Subjects[0] getHCP.SubjectSessions = getHCP.getSubjectSessions() getHCP.Session = getHCP.SubjectSessions.get("Sessions")[0] getHCP.SessionMeta = getHCP.getSessionMeta() ScanParms = getHCP.getScanParms() ScanMeta = getHCP.getScanMeta() print ScanMeta.get("URIs")[ScanMeta.get("Collections").index("NIFTI")] writeHCP.writeFileFromURL(getHCP, ScanMeta.get("URIs")[ScanMeta.get("Collections").index("NIFTI")]) if getHCP.Server.find("intradb") != -1: AssessorIDs = getHCP.getAssessorIDs() AssessorFileURIList = getHCP.getAssessorOutputFile(AssessorIDs) print getHCP.getProjects() print getHCP.SessionId, getHCP.getSessionId()
else: BuildArray = numpy.tile(BuildList, 1) if (Pipeline == 'FunctionalHCP'): PipelineSubString = ['fnc', 'task', 'rest'] elif (Pipeline == 'StructuralHCP'): PipelineSubString = ['strc'] elif (Pipeline == 'DiffusionHCP'): PipelineSubString = ['diff'] elif (Pipeline == 'FIX_HCP'): PipelineSubString = ['fnc', 'rest'] elif (Pipeline == 'TaskfMRIHCP'): PipelineSubString = ['fnc'] else: PipelineSubString = None UsableList = ['good', 'excellent', 'usable', 'undetermined'] linIdx = 0 for h in xrange(0, len(SubjectsList)): getHCP.Subject = SubjectsList[h] SubjectSessions = getHCP.getSubjectSessions() SubjectMetaData = getHCP.getSubjectMeta() # find correct session... for i in xrange(0, len(SubjectSessions.get('Sessions'))): getHCP.Session = SubjectSessions.get('Sessions')[i] sessionMeta = getHCP.getSessionMeta() if (FunctSeries != None) and (FunctSeries in sessionMeta.get('Series')): break else: try: getHCP.Session = SubjectSessions.get('Sessions')[ SubjectSessions.get('Types').index(PipelineSubString[0])] except: break