Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide option to make a 'presentation' video #66

Open
d2fong opened this issue Dec 20, 2019 · 6 comments
Open

provide option to make a 'presentation' video #66

d2fong opened this issue Dec 20, 2019 · 6 comments

Comments

@d2fong
Copy link
Contributor

d2fong commented Dec 20, 2019

  • would include when the stimulator turns on and off in the video
@d2fong d2fong added the maybe label Dec 20, 2019
@d2fong d2fong added this to the Behaviour 1.1.0 milestone Dec 20, 2019
@d2fong d2fong removed the maybe label Dec 20, 2019
@d2fong
Copy link
Contributor Author

d2fong commented Jan 23, 2020

new options:

  • avi, avi(for presentation)

@d2fong
Copy link
Contributor Author

d2fong commented Jan 23, 2020

sample python script for generating avi files:

import os
from ij import IJ, ImagePlus, ImageStack
from ij.io import Opener
from ij.plugin.filter import AVI_Writer
from ij.measure import Calibration




def is_tif_file(f):
	return f.split('.')[1] == 'tiff'

def tif_sort_key(f):
	return int(f.split('.')[0])

DIR = '/Users/dylan/data/full_tiff_stacks/jun/temp16/'
	
file_list = [ f for f in os.listdir(DIR) if is_tif_file(f)]
file_list.sort(key=tif_sort_key)

s = ImageStack()
o = Opener()

for f in file_list:
	imp = o.openTiff(DIR, f)
	s.addSlice(imp.getProcessor())

imp_to_avi = ImagePlus("avi", s)
ip = imp_to_avi.getProcessor()
#c = imp_to_avi.getCalibration()
#c.fps = 10.0
#imp_to_avi.setCalibration(c)
writer = AVI_Writer()

writer.writeImage(imp_to_avi, DIR + 'test.avi', 0, 0)

	
#f = FolderOpener()
#i = f.open('/Users/dylan/data/full_tiff_stacks/jun/temp16')
#print f.trimFileList([".csv"])
#print(i)

@d2fong
Copy link
Contributor Author

d2fong commented Jan 23, 2020

IJ.run("Open...", "");
IJ.run(imp, "Image Sequence...", "open=/Users/dylan/data/full_tiff_stacks/jun/temp16-raw sort use");
IJ.run(imp, "AVI... ", "compression=JPEG frame=10 save=/Users/dylan/data/full_tiff_stacks/jun/temp16-raw/temp16-raw.avi");

@d2fong
Copy link
Contributor Author

d2fong commented Jan 23, 2020

this works

imp = FolderOpener.open("/Users/dylan/data/full_tiff_stacks/jun/temp16-raw/", "virtual");
IJ.run(i, "AVI... ", "compression=JPEG frame=10 save=/Users/dylan/data/full_tiff_stacks/jun/temp16-raw.avi");

@d2fong
Copy link
Contributor Author

d2fong commented Jan 24, 2020

from ij import IJ, ImagePlus
from ij.plugin import FolderOpener

imp = FolderOpener.open("/Users/dylan/data/full_tiff_stacks/jun/temp16-raw/", "virtual");
IJ.run(imp, "AVI... ", "compression=None frame=10 save=/Users/dylan/data/full_tiff_stacks/jun/temp16-raw.avi");

@d2fong
Copy link
Contributor Author

d2fong commented Jan 24, 2020

add text to

from ij import IJ, ImagePlus
from ij.plugin import FolderOpener
from ij.gui import TextRoi

i = IJ.getImage()
ip = i.getProcessor()
ip.drawString("Stimulator On", 0, 200)

i.setProcessor(ip)
i.show()
from ij import IJ, ImagePlus;
from ij.gui import TextRoi
from java.awt import Font;
#import ij.gui.TextRoi;

i = IJ.getImage()
ip = i.getProcessor()

f = Font("Arial", 0, 20)
ip.setFont(f)
ip.setColor(1048575)  # white
ip.drawString("Stimulator On")

i.setProcessor(ip)
i.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant