Exemplo n.º 1
0
opts,args = Util.getopt_long(sys.argv[1:],optstruct)

imagedir = args[0]

print imagedir+'/*.%s' % opts['imageformat']

image1 = sorted(glob(imagedir+'/*.%s' % opts['imageformat']))[0]
iname = os.path.split(image1)[1]
inum = os.path.splitext(iname)[0]
digits = len(inum)

#check if re-zeroing is required:
if int(inum) != 0:
	print >> sys.stderr, 'first image (%s) does not start at zero; reindexing' % image1
	vidtools.rename_images_from_zero(imagedir,type=opts['imageformat'],digits=digits)
	image1 = sorted(glob(imagedir+'/*.%s' % opts['imageformat']))[0]
	iname = os.path.split(image1)[1]
	inum = os.path.splitext(iname)[0]
	if int(inum) == 0:
		print >> sys.stderr, 'reindexing complete'
	else:
		raise ValueError, 'Re-indexing called, but first frame is %s (%s) - aborting' % (inum,image1)

if opts.get('resolution',None):
	res_str = '-s %s' % opts['resolution']
else:
	res_str = ''

if opts.get('startframe',None) and opts.get('endframe',None):
	startsecs = opts['startframe']/float(opts['fps'])
Exemplo n.º 2
0
        print >> sys.stderr, 'get current image count ...',
        current_image_count = len(glob(outroot+'/images/*.png'))
        print >> sys.stderr, '%s' % current_image_count
        
        print >> sys.stderr, 'target image count: %s' % ((source_image_count*0.98) -  (segment_step * 3))
        if current_image_count + (segment_step * 3) < source_image_count*0.98:
            print >> sys.stderr,'rerunning due to missing images' #gaps:',gaps
            restart_z=None
        else:
            print >> sys.stderr,'output frame .png files pass contiguity check'
            rerun = False


    merge = 'png2vid.py -c -i %s -v %s -n %s -b %s -f %s %s/images/' % (FORMAT,opts['vid_format'],movie,opts['vid_bitrate'],fps,outroot)
    print >> sys.stderr,'re-zeroing %s output images' % len(glob(outroot+'/images/*.png'))
    vidtools.rename_images_from_zero(outroot+'/images')
    print >> sys.stderr,'rendering movie, log written to %s\n' % (logfile)
    jids,ndict = LSF.lsf_jobs_submit([merge],logfile,'hoekstra',jobname_base='video')
    jobids.update(jids)
    namedict.update(ndict)    


micefiles = sorted(glob(outroot+'/*-*.mice'))
#locsfiles = sorted(glob(outroot+'/*-*.mouselocs'))
#locsummfiles = sorted(glob(outroot+'/*-*.locsumm'))
framefiles = sorted(glob(outroot+'/*-*.frame'))
#miceoutlinefiles = sorted(glob(outroot+'/*-*.miceoutline'))
micezfiles = sorted(glob(outroot+'/*-*.micez'))
micesizefiles = sorted(glob(outroot+'/*-*.micesize'))

if opts['ground_anchors'] is not None:
Exemplo n.º 3
0
opts, args = Util.getopt_long(sys.argv[1:], optstruct)

imagedir = args[0]

print imagedir + '/*.%s' % opts['imageformat']

image1 = sorted(glob(imagedir + '/*.%s' % opts['imageformat']))[0]
iname = os.path.split(image1)[1]
inum = os.path.splitext(iname)[0]
digits = len(inum)

#check if re-zeroing is required:
if int(inum) != 0:
    print >> sys.stderr, 'first image (%s) does not start at zero; reindexing' % image1
    vidtools.rename_images_from_zero(imagedir,
                                     type=opts['imageformat'],
                                     digits=digits)
    image1 = sorted(glob(imagedir + '/*.%s' % opts['imageformat']))[0]
    iname = os.path.split(image1)[1]
    inum = os.path.splitext(iname)[0]
    if int(inum) == 0:
        print >> sys.stderr, 'reindexing complete'
    else:
        raise ValueError, 'Re-indexing called, but first frame is %s (%s) - aborting' % (
            inum, image1)

if opts.get('resolution', None):
    res_str = '-s %s' % opts['resolution']
else:
    res_str = ''
Exemplo n.º 4
0
            print >>sys.stderr, "rerunning due to missing images"  # gaps:',gaps
            restart_z = None
        else:
            print >>sys.stderr, "output frame .png files pass contiguity check"
            rerun = False

    merge = "png2vid.py -c -i %s -v %s -n %s -b %s -f %s %s/images/" % (
        FORMAT,
        opts["vid_format"],
        movie,
        opts["vid_bitrate"],
        fps,
        outroot,
    )
    print >>sys.stderr, "re-zeroing %s output images" % len(glob(outroot + "/images/*.png"))
    vidtools.rename_images_from_zero(outroot + "/images")
    print >>sys.stderr, "rendering movie, log written to %s\n" % (logfile)
    jids, ndict = LSF.lsf_jobs_submit([merge], logfile, "hoekstra", jobname_base="video")
    jobids.update(jids)
    namedict.update(ndict)


micefiles = sorted(glob(outroot + "/*-*.mice"))
# locsfiles = sorted(glob(outroot+'/*-*.mouselocs'))
# locsummfiles = sorted(glob(outroot+'/*-*.locsumm'))
framefiles = sorted(glob(outroot + "/*-*.frame"))
# miceoutlinefiles = sorted(glob(outroot+'/*-*.miceoutline'))
micezfiles = sorted(glob(outroot + "/*-*.micez"))
micesizefiles = sorted(glob(outroot + "/*-*.micesize"))

if opts["ground_anchors"] is not None: