Esempio n. 1
0
        mean_40_60min = pp.make_mean_40_60(allrealigned)

        # clean up
        # remove copied unrealigned frames
        bg.remove_files(newnifti)

        # QA
        # make 4d for QA
        qadir, exists = qa.make_qa_dir(realigndir, name='data_QA')
        data4d = qa.make_4d_nibabel(allrealigned, outdir=qadir)
        #snrimg = qa.gen_sig2noise_img(data4d,qadir)
        #artout = qa.run_artdetect(data4d,tmpparameterfile)
        #qa.screen_data_dirnme(data4d, qadir)
        qa.plot_movement(tmpparameterfile, subid)
        qa.calc_robust_median_diff(data4d)
        qa.screen_pet(data4d)

        # Coregister cerebellum, brainmask and aparc_aseg to pet space
        #
        logging.info('Coreg %s' % (subid))
        coregdir, exists = bg.make_dir(pth, 'coreg')
        if exists:
            logging.warning('%s exists, remove to rerun' % (coregdir))
            continue
        # copy brainmask, aparc_aseg, cerebellum to coreg dir
        basedir, _ = os.path.split(pth)
        # brainmask
        globstr = os.path.join(basedir, 'anatomy', 'brainmask.nii*')
        brainmask = pp.find_single_file(globstr)
        if brainmask is None:
            logging.error('%s not found. skipping' % globstr)
Esempio n. 2
0
        movedmean = bg.copy_file(meanimg, nifti_dir)

        # QA
        if not hasqa:
            logging.info("qa %s" % subid)
            qa.plot_movement(tmpparameterfile, subid)
            # get rid of NAN in files
            no_nanfiles = pp.clean_nan(tmprealigned)
            # make 4d volume to visualize movement
            img4d = qa.make_4d_nibabel(no_nanfiles)
            bg.zip_files(tmprealigned)
            # save qa image
            # qa.save_qa_img(img4d)
            qa.plot_movement(tmpparameterfile, subid)
            qa.calc_robust_median_diff(img4d)
            qa.screen_pet(img4d)
            # remove tmpfiles

            bg.remove_files(no_nanfiles)
            bg.remove_files(newnifti)

        # coreg pons to pet
        # find PONS
        pons_searchstr = "%s/ref_region/pons_tu.nii*" % tracerdir
        pons = pp.find_single_file(pons_searchstr)
        if "gz" in pons:
            pons = bg.unzip_file(pons)
        if pons is None:
            logging.warning("no pons_tu found for %s" % (subid))
            continue
        # find MRI
Esempio n. 3
0
        # clean up
        # remove copied unrealigned frames
        bg.remove_files(newnifti)
        

        # QA
        # make 4d for QA
        qadir, exists = qa.make_qa_dir(realigndir, name='data_QA')
        data4d = qa.make_4d_nibabel(allrealigned, outdir=qadir)
        #snrimg = qa.gen_sig2noise_img(data4d,qadir)
        #artout = qa.run_artdetect(data4d,tmpparameterfile)
        #qa.screen_data_dirnme(data4d, qadir)
        qa.plot_movement(tmpparameterfile, subid)
        qa.calc_robust_median_diff(data4d)
        qa.screen_pet(data4d)

        # Coregister cerebellum, brainmask and aparc_aseg to pet space
        #
        logging.info('Coreg %s'%(subid))
        coregdir, exists = bg.make_dir(pth, 'coreg')
        if exists:
            logging.warning('%s exists, remove to rerun'%(coregdir))
            continue
        # copy brainmask, aparc_aseg, cerebellum to coreg dir
        basedir, _ = os.path.split(pth)
        # brainmask
        globstr = os.path.join(basedir, 'anatomy', 'brainmask.nii*')
        brainmask = pp.find_single_file(globstr)
        if brainmask is None:
            logging.error('%s not found. skipping'%globstr)
        movedmean = bg.copy_file(meanimg, nifti_dir)

        #QA
        if not hasqa:
            logging.info('qa %s' % subid)
            qa.plot_movement(tmpparameterfile, subid)
            # get rid of NAN in files
            no_nanfiles = pp.clean_nan(tmprealigned)
            #make 4d volume to visualize movement
            img4d = qa.make_4d_nibabel(no_nanfiles)
            bg.zip_files(tmprealigned)
            #save qa image
            #qa.save_qa_img(img4d)
            qa.plot_movement(tmpparameterfile, subid)
            qa.calc_robust_median_diff(img4d)
            qa.screen_pet(img4d)
            #remove tmpfiles

            bg.remove_files(no_nanfiles)
            bg.remove_files(newnifti)

        # coreg pons to pet
        # find PONS
        pons_searchstr = '%s/ref_region/pons_tu.nii*' % tracerdir
        pons = pp.find_single_file(pons_searchstr)
        if 'gz' in pons:
            pons = bg.unzip_file(pons)
        if pons is None:
            logging.warning('no pons_tu found for %s' % (subid))
            continue
        # find MRI