Skip to content

Instantly share code, notes, and snippets.

View dwaithe's full-sized avatar

Dominic Waithe dwaithe

View GitHub Profile
//ImageJ macro written by Dominic Waithe. (c) 2017.
//To be used on three channels of an image file.
//Output:
//prints to log for each cell something like this: Cell Number: 270 Foci Count CH1: 7 Foci Count CH2: 4 particles within distance 5
//outputs image
//Parameters for the code
//DAPI channel. Used to find the areas.
@dwaithe
dwaithe / hough_circle.ijm
Created January 13, 2022 11:20
Hough Circular Transform analysis script to count the number of cells present in bright-field image.
//ImageJ macro written by Dominic Waithe for Caroline Scott. 2017.
//This macro uses the Hough circlular transform to count the number of cells present.
//Works very well, but artefacts on sample will lower accuracy.
///Parameters
//Radii to focus the hough-transform on
r_start = 6; //radii minimum size
r_stop = 8; //radii maximum size.
edge_mag = 70; //Threshold for edge magnitude, the lower this value the more of the edges will be captured.
@dwaithe
dwaithe / 2D_GaussFit.ijm
Created May 21, 2020 09:00
This script includes a rough feature detection and then fine 2D Gaussian algorithm to fit Gaussians within patches regions. For more details and example inputs please refer to: https://github.com/dwaithe/generalMacros
// 2D Gaussian fitting example with rough feature identification.
//////////////////////////////////////////////
// Written by Dominic Waithe. University of Oxford. Follow on Twitter at @dwaithe. Or https://github.com/dwaithe
// Copyright (c) 2016 Dominic Waithe. See license at bottom of file.
//// Details:
// Fiji/ImageJ. Just make sure its up-to-date. Tested on v 1.49.
// This script includes a rough feature detection and then fine 2D Gaussian algorithm to fit Gaussians within patches regions.
// This macro is special because the ImageJ/Fiji curve fitting API only supports 1-D curve. I get around this by...
@dwaithe
dwaithe / file_converter.ijm
Created May 21, 2020 08:58
Simple example script which shows how to convert .lsm files from one folder into another folder and save as ome.tiff
//File converter code. Converts lsm files to ome.tiff from and input folder to and output folder.
//Written by Dominic Waithe for Heinrich Klose (2017).
//You need to change these values to your folders of choice.
input_dir = "set/path/to/input/folder";
output_dir = "set/path/to/output/folder";
//Processing code begins:
@dwaithe
dwaithe / WHM_along_line_v1.ijm
Last active May 18, 2020 08:45
A bulk FWHM measuring algorithm was designed and written using ImageJ macro language. For full details and example file please see here: https://github.com/dwaithe/generalMacros
/Macro written by Dominic Waithe for Victoria Zilles, Erdinc Sezgin and Falk Schneider.
//Measure FWHM at multiple points along a user-defined line
//Fits intensity profile using Gaussian Fitting
//Outputs data from STED and CONFOCAL in log.
//Dominic Waithe 2016, University of Oxford.
//Find the coordinates of the selection.
getSelectionCoordinates(xr, yr);
//Add the coordinates to the roi manager.
roiManager("Add");
@dwaithe
dwaithe / rigid_transform_3d.py
Last active April 14, 2017 10:28
Function which allows you to perform a rigid transformation (translation and rotation) on 3-D volumetric intensity data.
from scipy.ndimage import map_coordinates
import numpy as np
def rigid_transform_3d(input_im, alpha,beta,gamma,xt,yt,zt,order=2):
"""
Function which performs a rigid-body transformation on volumetric intensity data:
-- example usuage --
%pylab inline #in jupyter or ipython include this for the visualisation.
inw = np.zeros((30,35,50))