Skip to content

Instantly share code, notes, and snippets.

View ackman678's full-sized avatar

James Ackman ackman678

View GitHub Profile
@ackman678
ackman678 / pyPrairieTiffXMLparams.py
Created May 13, 2013 16:25
A script to obtain acquisition parameters from [OME XML](http://www.openmicroscopy.org/site/support/ome-model/) files created by Prairie View. Prairie View is a microscope acquisition software for multiphoton microscopes by [Prairie Technologies](http://www.prairie-technologies.com/products/photon/Ultima.html).
#! /usr/bin/env python
#pyPrairieTiffXMLparams.py
#Created by James B. Ackman 4/1/2011
'''
A tool to obtain relevant experimental parameters from a Prairie View (microscope acquisition program from Prairie Technologies)
formatted XML file contained with folders of Prairie View acquired TIFFs. Output is to stdout as well as a log file in the users python home directory.
'''
import os, sys, wx
from xml.dom import minidom
@ackman678
ackman678 / BatchStackreg.txt
Last active December 18, 2015 16:49
An ImageJ macro that performs image registration using the [StackReg](http://bigwww.epfl.ch/thevenaz/stackreg/) plugin on all the TIFF movies in a folder.
// "BatchStackreg" by James Ackman June 7, 2007
//
// This macro batch processes all the files in a folder and any
// subfolders in that folder. In this example, it runs the Stackreg plugin for automatic
// image registration of multipageTIFF files. Stackreg plugin must be installed.
// For other kinds of processing, edit the processFile() function at the end of this macro.
// Based on the BatchProcessFolders.txt macro on the ImageJ website.
requires("1.33s");
dir = getDirectory("Choose a Directory ");
@ackman678
ackman678 / pyMencoder.py
Last active December 18, 2015 16:49
A python script to utilizing imagemagick and mencoder to convert subfolders of tiff sequences into avi movies. Requires that Imagemagick and mencoder are installed, and in the Windows system search path
#! /usr/bin/env python
#pyMencoder
#a script to utilizing imagemagick and mencoder to convert subfolders of tiff sequences into avi movies. Requires that Imagemagick and mencoder are installed, and in the Windows system search path
#James Ackman March 3, 2010
import os, sys, glob, re, subprocess
#edit the following line for the location of the ImageMagick convert program. This is mainly for Windows where a identically named system tool for converting FAT32 to NTFS is located at c:\Windows\system32\convert.exe and can cause issues, even if ImageMagick directory is located first in your system path.
IMconvert = 'C:\Program Files\ImageMagick-6.6.0-Q16\convert.exe'
#use following several lines with a loop through dirlist for recursive renaming of files
@ackman678
ackman678 / pyMakeMarkdownTable.py
Last active November 8, 2018 19:23
Convert a space delimited table on the system clipboard into markdown table, such as when copying tabular results from matlab or a spreadsheet or R command line. Written to use macos shell cmd pbpaste. But should be reworked to use xclip or similar as an option for linux. This script is most enjoyable when combined with a os wide shortcut, such …
#! /usr/bin/env python
#pyMakeMarkdownTable.py
#Created by James B. Ackman 4/9/2013
'''
A script to format a space or tab delimited table on the clipboard into a markdown formatted table onto the clipboard
'''
#import os, sys, re
#import urllib2
import os, subprocess, re
@ackman678
ackman678 / Scale bar maker.scpt
Last active December 18, 2015 17:18
This applescript can be used to automatically draw on microscopic images in Adobe Photoshop as a new layer. This hasn't been tested in several years, but it depended on tiffutil to read the voxel-width from the tiff header in Leica confocal microscope files. TODO: Update and combine with the loci_tools.jar from OME project to make this more flex…
--Wednesday, May 4, 2005 6:27 PM
--Select and open the image in the frontmost Finder window in Photoshop from which the Voxel-Width data can be obtained before proceeding performing the scale bar calculation. Must use Photoshop CS or Photoshop 7.0. Must change instances of "Photoshop CS" to "Photoshop 7.0" in this script and vice versa depending on which version you are using.
tell application "Finder"
set this_file to ((the selection) as alias)
set newPath to quoted form of POSIX path of this_file
end tell
tell application "Adobe Photoshop CS6"
try
open this_file showing dialogs never
@ackman678
ackman678 / SingleCitationMatcher.scpt
Last active December 18, 2015 17:18
A simple applescript to fetch a bibliographic citation (using author, journal title, year) from pubmed.
display dialog "PubMed single citation matcher" & return & return & ¬
"Authors last name:" default answer "Kaas"
set author to the text returned of the result
display dialog "Journal Title: (Type a \" + \" in place of any spaces)" default answer "trends+neurosci"
set journal to the text returned of the result
display dialog "Publication date:" default answer "1995"
set yeartext to the text returned of the result
@ackman678
ackman678 / dFoverFmovie.txt
Last active June 14, 2023 18:34
An ImageJ macro to make a dF/F movie from a calcium imaging recording.Works best if file extension is changed to '.ijm' and saved in your ImageJ folder at plugins/Macros/dFoverFmovie.ijm
//dF/F image stack, James B. Ackman 2012-02-14, update 2014-02-21 09:44:13
// this macro will (1) reduce an open image stack in half
// (2) create an average image in the z-dimension
// (3) calc dF/F image stack
// Uncomment the lines 21 run("Size..." ...) as well as the filenames at line 14,32 if you want to downsample the movie size
// To run without the autosave option, comment out the lines 62
// Comment out lines 41-58 if you don't want to auto adjust the contrast
name1=getTitle;
//selectWindow(name1)
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@ackman678
ackman678 / unix_tricks.md
Last active January 25, 2018 01:30
Brief command shell tutorial. Contains a few unix tips and tricks for working with and examining data files for science. A couple of the examples assume that the working environment is Mac OS X (e.g. pbcopy).
@ackman678
ackman678 / Markdown2Word.md
Last active April 6, 2016 18:14
Instructions on converting a multimarkdown manuscript with mmd bibtex cite-keys and graphics into a Microsoft Word document with BibDesk cite-keys and graphics.

Convert multimarkdown manuscript to Microsoft Word document

Here are directions for converting a markdown/multimarkdown formatted text manuscript into a Microsoft Word document (unfortunately still a preferred format for submission to many journals). These directions will focus on turning bibtex citekeys (if you are using BibDesk or similar for references and bibliography management) from the [#citekey] format in multimarkdown to the \cite{citekey} format for use with BibDesk.app and BibDeskToWord.app to

This will use the Multimarkdown command line tool (mmd2odf) to create a flat open office document .fodt text file. Multimarkdown must be installed on your system. Alternatively pandoc can be used for this, but pandoc doesn't handle the nice multimarkdown table format as well and graphics can be messed up in resulting open office document .odt file.

Note on use of fodt files in OpenOffice:

>LibreOffice can open these Flat OpenDocument files by defaul