Skip to content

Instantly share code, notes, and snippets.

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
Block or report user

Report or block GenevieveBuckley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
GenevieveBuckley /
Last active Jan 9, 2018
ImageJ Jython script testing for the existence of an output file before writing to that file location. Graceful exit if user chooses to cancel the operation.
# @File (label = "Output directory", style = "directory") output_directory
import os
import csv
from ij.gui import YesNoCancelDialog
from java.awt import Frame
def main():
"""ImageJ Jython script testing for the existence of an output file before
writing to that file location.
GenevieveBuckley /
Last active Jan 9, 2018
Watershed methods using Jython scripting and the ImageJ/ImgLib2/MorphoLibJ APIs.
"""Calculating the gradient image that needs to go into Watershed."""
from ij import IJ
# operates on ImagePlus object: imp, "Gradient (3D)", "use")
# modifies imp, returns None.
# This method also automatically displays the modified gradient image (unless you suppress it).
# Output image name is always "Rebinned" - change it to something better afterwards.
GenevieveBuckley /
Created Jan 9, 2018
ImageJ API scripting in Jython - how to convert to and from ImgPlus and ImagePlus.
"""Converting from ImagePlus to ImgPlus.
When an ImagePlus is made available by ImageJ 1.x,
you can pass it to ImgLib2 as an Img via ImageJFunctions.wrap(imp)
from ij import IJ
from net.imglib2.img import ImagePlusAdapter
image = IJ.openImage() # opens a file picker, or you can add the filename string as an argument.
output = ImagePlusAdapter.wrapImgPlus(image) #
Parameter declarations begin with #@ or //@. Each such line contains a single parameter declaration and nothing else.
//@type variableName // will declare an input of the indicated type, assigned to the specified name.
//@output type outputName // will declare the variable of the specified name as an output parameter with the given type.
GenevieveBuckley /
Created Jun 19, 2018
Find files matching a specific file extension, via recursive search through input directory.
def find_filenames(input_directory, file_extension):
"""Return list of filenames matching file extension."""
filelist = []
for root, _, files in os.walk(input_directory):
for file in files:
if file.endswith(file_extension):
filename = os.path.join(root, file)
return filelist
GenevieveBuckley /
Created Jun 19, 2018
Edge enhancement - sum of the absolute image gradient for all orientations.
def gradient_of_image(image):
"""Direction agnostic."""
grad = np.gradient(image) # gradients for individual directions
grad = np.stack(grad, axis=-1) # from list of arrays to single numpy array
gradient_image = np.sum(abs(grad), axis=-1)
return gradient_image
from bokeh.plotting import figure, ColumnDataSource
from bokeh.models import HoverTool
def scatter_with_hover(df, x, y,
fig=None, cols=None, name=None, marker='x',
fig_width=500, fig_height=500, **kwargs):
Plots an interactive scatter plot of `x` vs `y` using bokeh, with automatic
tooltips showing columns from `df`.
GenevieveBuckley /
Created Aug 8, 2018 — forked from Chaser324/
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

GenevieveBuckley /
Last active Aug 8, 2018 — forked from diyan/
Desktop GUI automation in Python


UI Automation. Desktop. Python

GUI toolkit agnostic

autopy - simple, cross-platform GUI automation toolkit. MIT -

  • GUI toolkit agnostic
  • allows you to move mouse, take screenshots, show alerts, search for bitmaps on-screen
GenevieveBuckley / imread
Created Aug 8, 2018 — forked from charlesreid1/imread
Results from using different imread() functions
View imread
In [1]: from import imread as skimage_imread
In [2]: from matplotlib.pyplot import imread as plt_imread
In [3]: from scipy.ndimage import imread as scipy_imread
In [4]: skimage_imread('bulk_water_000.png')
array([[[146, 125, 54, 255],
[146, 125, 54, 255],
You can’t perform that action at this time.