def open_subjects_file(self):
        control_location = os.getenv('XNAT_PBS_JOBS_CONTROL', default="")

        options = QFileDialog.Options()
        #options |= QFileDialog.DontUseNativeDialog
        #subject_file_name, other_stuff = QFileDialog.getOpenFileName(self, "Open Subject File", "", "Subject Files (*.subjects);;All Files (*)", options=options)
        subject_file_name, other_stuff = QFileDialog.getOpenFileName(
            self,
            "Open Subject File",
            control_location,
            "Subject Files (*.subjects);;All Files (*)",
            options=options)
        if subject_file_name:
            new_subject_list = hcp7t_subject.read_subject_info_list(
                subject_file_name, separator=":")
            self.controlPanel.subject_list = new_subject_list
Beispiel #2
0
def main():
    # create a parser object for getting the command line arguments
    parser = my_argparse.MyArgumentParser()

    parser.add_argument('-a', '--all-subjects=', dest='all_subjects', required=True, type=str)
    parser.add_argument('-t', '--todo-subjects=', dest='todo_subjects', required=True, type=str)

    args = parser.parse_args()

    # print("Retrieving all subjects from: " + args.all_subjects)
    all_subjects_list = hcp7t_subject.read_subject_info_list(args.all_subjects, separator=":")

    # print("Retrieving subject ids in TODO list from: " + args.todo_subjects)
    to_do_subjects_list = []

    to_do_ids_file = open(args.todo_subjects, "r")
    for line in to_do_ids_file:
        subject_id = line[:-1]

        for subject in all_subjects_list:
            if subject_id == subject.subject_id:
                print(str(subject))
                break
    """Outputs a message that is prefixed by the module file name."""
    print(os.path.basename(__file__) + ": " + msg)


if __name__ == "__main__":

    # Get environment variables
    subject_files_dir = os.getenv('SUBJECT_FILES_DIR')
    if subject_files_dir is None:
        _inform("Environment variable SUBJECT_FILES_DIR must be set!")
        sys.exit(1)

    # Get list of all HCP7T subjects
    all_subjects_file_name = subject_files_dir + os.sep + 'FunctionalPreprocessingHCP7T.subjects.everybody'
    _inform("Retrieveing all subjects from: " + all_subjects_file_name)
    all_subjects_list = hcp7t_subject.read_subject_info_list(all_subjects_file_name)

    # _inform("all_subjects_list: " + str(all_subjects_list))

    # Get list of subject IDs that need to be packaged
    subjects_to_use_file_name = subject_files_dir + os.sep + 'CreateAllPackages.subjects'
    _inform("Retrieving subjects to use from: " + subjects_to_use_file_name)
    subject_ids_to_use_list = hcp7t_subject.read_subject_id_list(subjects_to_use_file_name)

    _inform("subject_ids_to_use_list: " + str(subject_ids_to_use_list))

    # get full subject information for all subjects that are in the subject_ids_to_use_list
    subjects_to_use_list = [subj_info for subj_info in all_subjects_list if subj_info.subject_id in subject_ids_to_use_list]

    # write out the subjects_to_use_list
    hcp7t_subject.write_subject_info_list('newlist', subjects_to_use_list)
            self.increment_shadow_number()

            time.sleep(60)
            

if __name__ == "__main__":

    # Get environment variables
    scripts_home = os.getenv('SCRIPTS_HOME')
    if scripts_home is None:
        _inform("Environment variable SCRIPTS_HOME must be set!")
        sys.exit(1)

    home = os.getenv('HOME')
    if home is None:
        _inform("Environment variable HOME must be set!")
        sys.exit(1)

    # Get Connectome DB credentials
    userid = input("Connectome DB Username: "******"Connectome DB Password: ")

    # Get list of subjects to process
    subject_file_name = file_utils.get_subjects_file_name(__file__)
    _inform('Retrieving subject list from: ' + subject_file_name)
    subject_list = hcp7t_subject.read_subject_info_list(subject_file_name)

    # Process subjects in list
    batch_submitter = DeDriftAndResampleHcp7T_HighResBatchSubmitter()
    batch_submitter.submit_jobs(subject_list)
    parser = my_argparse.MyArgumentParser(
        description="Submit a batch of HCP 7T MultiRunIcaFix Jobs")

    # option arguments
    # The -f or --force option tells this program to ignore the fact that a job may
    # already be running for a specified subject/scan and submit jobs anyhow.
    # Keep in mind that this will very likely royally screw up the mechanism for
    # keeping track of whether jobs are queued or running for that subject/scan.
    # But sometimes, particularly during testing, it is useful and necessary.
    parser.add_argument('-f',
                        '--force',
                        dest='force',
                        action='store_true',
                        required=False,
                        default=False)

    # parse the command line arguments
    args = parser.parse_args()

    # get Database credentials
    userid = input("DB Username: "******"DB Password: "******"Retrieving subject list from: " + subject_file_name)
    subject_list = hcp7t_subject.read_subject_info_list(subject_file_name,
                                                        separator=":")

    do_submissions(userid, password, subject_list, args.force)
            submitter.put_server = put_server

            submitter.submit_jobs()


if __name__ == "__main__":

    # Get Environment varialbles
    xnat_pbs_jobs_home = os.getenv('XNAT_PBS_JOBS')
    if not xnat_pbs_jobs_home:
        _inform("Environment variable XNAT_PBS_JOBS must be set!")
        sys.exit(1)

    # home = os.getenv('HOME')
    # if home == None:
    #     _inform("Environment variable HOME must be set!")
    #     sys.exit(1)

    # Get Connectome DB credentials
    userid = input("Connectome DB Username: "******"Connectome DB Password: ")

    # Get list of subjects to process
    subject_file_name = 'SubmitDiffusionPreprocessingHCP7TBatch.subjects'
    _inform('Retrieving subject list from: ' + subject_file_name)
    subject_list = hcp7t_subject.read_subject_info_list(subject_file_name)

    # Process the subjects in the list
    batch_submitter = BatchSubmitter()
    batch_submitter.submit_jobs(subject_list)
                                scan_results_dict['resource_exists'],
                                scan_results_dict['resource_date'],
                                scan_results_dict['files_exist']])

        afile.write(output_str + os.linesep)
        print(output_str)

    print("")


if __name__ == "__main__":

    # get list of subjects to check
    subject_file_name = file_utils.get_subjects_file_name(__file__)
    logger.info("Retrieving subject list from: " + subject_file_name)
    subject_list = hcp7t_subject.read_subject_info_list(subject_file_name, separator="\t")

    # create list of scans to check
    scans_to_check_list = []
    scans_to_check_list.append('rfMRI_REST1_PA')
    scans_to_check_list.append('rfMRI_REST2_AP')
    scans_to_check_list.append('rfMRI_REST3_PA')
    scans_to_check_list.append('rfMRI_REST4_AP')
    scans_to_check_list.append('tfMRI_MOVIE1_AP')
    scans_to_check_list.append('tfMRI_MOVIE2_PA')
    scans_to_check_list.append('tfMRI_MOVIE3_PA')
    scans_to_check_list.append('tfMRI_MOVIE4_AP')

    # open complete and incomplete files for writing
    complete_file = open('complete.status', 'w')
    incomplete_file = open('incomplete.status', 'w')