pvcdir, exists = bg.make_dir(pth, 'pvc_metzler') if exists: logging.error('%s exists, remove to re-run' % (pvcdir)) continue # get ponsnormd globstr = '%s/nonan-ponsnormed_%s*nii*' % (pth, subid) ponsnormd = pp.find_single_file(globstr) if ponsnormd is None: logging.error('%s missing, skipping' % (globstr)) continue # copy ponsnormd to pvc directory cponsnormd = bg.copy_file(ponsnormd, pvcdir) # get raparc corgdir = os.path.join(pth, 'coreg_mri2fdg') globstr = '%s/rB*aparc_aseg.nii' % (corgdir) raparc = pp.find_single_file(globstr) if raparc is None: logging.error('%s missing, skipping ' % (globstr)) continue #copy raparc_aseg to pvd dir craparc = bg.copy_file(raparc, pvcdir) # make brainamsk bmask = metzler.make_aseg_brainmask(craparc) os.unlink(craparc) smooth_bmask = pp.fname_presuffix(bmask, prefix='s') _ = metzler.smooth_mask_nipy(bmask, smooth_bmask) ero_bmask = metzler.fsl_erode2d(bmask) pvcpet = metzler.calc_pvc(cponsnormd, ero_bmask, smooth_bmask) os.unlink(cponsnormd) logging.info('Created %s' % (pvcpet))
pvcdir, exists = bg.make_dir(dvrdir, 'pvc_metzler') if exists: logging.error('%s exists, remove to re-run' % (pvcdir)) continue # get dvr globstr = '%s/DVR-%s*nii*' % (dvrdir, subid) dvr = pp.find_single_file(globstr) if dvr is None: logging.error('%s missing, skipping' % (globstr)) continue # copy dvr to pvc directory cdvr = bg.copy_file(dvr, pvcdir) # get raparc corgdir = os.path.join(pth, 'coreg') globstr = '%s/rB*aparc_aseg.nii' % (corgdir) raparc = pp.find_single_file(globstr) if raparc is None: logging.error('%s missing, skipping ' % (globstr)) continue #copy raparc_aseg to pvd dir craparc = bg.copy_file(raparc, pvcdir) # make brainamsk bmask = metzler.make_aseg_brainmask(craparc) os.unlink(craparc) smooth_bmask = pp.fname_presuffix(bmask, prefix='s') _ = metzler.smooth_mask_nipy(bmask, smooth_bmask) ero_bmask = metzler.fsl_erode2d(bmask) pvcpet = metzler.calc_pvc(cdvr, ero_bmask, smooth_bmask) os.unlink(cdvr) logging.info('Created %s' % (pvcpet))
if exists: logging.error('%s exists, remove to re-run'%(pvcdir)) continue # get ponsnormd globstr = '%s/nonan-ponsnormed_%s*nii*'%(pth,subid) ponsnormd = pp.find_single_file(globstr) if ponsnormd is None: logging.error('%s missing, skipping'%(globstr)) continue # copy ponsnormd to pvc directory cponsnormd = bg.copy_file(ponsnormd, pvcdir) # get raparc corgdir = os.path.join(pth, 'coreg_mri2fdg') globstr = '%s/rB*aparc_aseg.nii'%(corgdir) raparc = pp.find_single_file(globstr) if raparc is None: logging.error('%s missing, skipping '%(globstr)) continue #copy raparc_aseg to pvd dir craparc = bg.copy_file(raparc, pvcdir) # make brainamsk bmask = metzler.make_aseg_brainmask(craparc) os.unlink(craparc) smooth_bmask = pp.fname_presuffix(bmask, prefix='s') _ = metzler.smooth_mask_nipy(bmask, smooth_bmask) ero_bmask = metzler.fsl_erode2d(bmask) pvcpet = metzler.calc_pvc(cponsnormd, ero_bmask, smooth_bmask) os.unlink(cponsnormd) logging.info('Created %s'%(pvcpet))
pvcdir, exists = bg.make_dir(dvrdir, "pvc_metzler") if exists: logging.error("%s exists, remove to re-run" % (pvcdir)) continue # get dvr globstr = "%s/DVR-%s*nii*" % (dvrdir, subid) dvr = pp.find_single_file(globstr) if dvr is None: logging.error("%s missing, skipping" % (globstr)) continue # copy dvr to pvc directory cdvr = bg.copy_file(dvr, pvcdir) # get raparc corgdir = os.path.join(pth, "coreg") globstr = "%s/rB*aparc_aseg.nii" % (corgdir) raparc = pp.find_single_file(globstr) if raparc is None: logging.error("%s missing, skipping " % (globstr)) continue # copy raparc_aseg to pvd dir craparc = bg.copy_file(raparc, pvcdir) # make brainamsk bmask = metzler.make_aseg_brainmask(craparc) os.unlink(craparc) smooth_bmask = pp.fname_presuffix(bmask, prefix="s") _ = metzler.smooth_mask_nipy(bmask, smooth_bmask) ero_bmask = metzler.fsl_erode2d(bmask) pvcpet = metzler.calc_pvc(cdvr, ero_bmask, smooth_bmask) os.unlink(cdvr) logging.info("Created %s" % (pvcpet))