Skip to content

Instantly share code, notes, and snippets.

View ackman678's full-sized avatar

James Ackman ackman678

View GitHub Profile
@ackman678
ackman678 / Rename_Labels_in_Results_Table.txt
Created April 25, 2014 20:35
A macro to rename roi labels (remove filename prefix) in an ImageJ results table. Script from [stackoverflow hint](http://stackoverflow.com/questions/20800207/imagej-how-to-put-label-names-into-results-table-generated-by-roi-manager)
macro "Rename Labels in Results Table" {
for (i=0; i<nResults; i++) {
oldLabel = getResultLabel(i);
delimiter = indexOf(oldLabel, ":");
newLabel = substring(oldLabel, delimiter+1);
setResult("Label", i, newLabel);
}
}
@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 / 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
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 / 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

@ackman678
ackman678 / 2016-07-12-Opencv3.1.0-dev-python-highgui-cmake.txt
Last active July 13, 2016 23:11
cmake config and output for successful compiling of opencv 3.1.0 on AWS ubuntu server 14.04 with anaconda python3.5 and GTK+2.x/highgui support
ubuntu@ip-172-31-25-123:~/opencv/release$ cmake -DWITH_1394=OFF -DWITH_QT=OFF -DWITH_VTK=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_TBB=ON -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_NEW_PYTHON_SUPPORT=ON -DCMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") -DPYTHON3_EXECUTABLE=$(which python3) -DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") -DPYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
-- The CXX compiler identification is GNU 4.8.4
-- The C compiler identification is GNU 4.8.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
@ackman678
ackman678 / main.css
Created July 26, 2016 09:51
custom css mashup from jekyll base sass v3.1.6 and bootstrap-sass v3.3.6 for ackmanlab jekyll site
table {
border-collapse: collapse;
border-spacing: 0; }
td,
th {
padding: 0; }
/**
* Reset some basic elements