Skip to content

Instantly share code, notes, and snippets.

View GenevieveBuckley's full-sized avatar

Genevieve Buckley GenevieveBuckley

  • Monash University
  • Melbourne
View GitHub Profile
@GenevieveBuckley
GenevieveBuckley / convert_ImagePlus_to_ImgPlus.py
Created January 9, 2018 04:52
ImageJ API scripting in Jython - how to convert to and from ImgPlus and ImagePlus. http://javadoc.scijava.org
"""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)
http://javadoc.scijava.org/ImgLib2/net/imglib2/img/display/imagej/ImageJFunctions.html
"""
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) #
@GenevieveBuckley
GenevieveBuckley / test_monkeypatch.py
Last active December 12, 2023 18:57
Monkeypatching user input with pytest
from io import StringIO
def double():
x = input("Enter an integer: ")
return int(x) * 2
def adding():
x = float(input('Enter the first number'))
@GenevieveBuckley
GenevieveBuckley / micro-sam-speed-tests.md
Last active September 10, 2023 23:54
micro-sam speed tests

micro-sam speed tests

8th September 2023. Results from Constantin's development/benchmarks.py script.

Summary: something about AMG is really killing the performance for MPS backends.

  • We'll need to do some line profiling on that part of the code to get more information.
  • I am suspicious that the fallback to CPU might somehow involve a lot of transferring large tensors back and forth between the cpu and mps, and perhaps that is a large part of why it is so much slower than the cpu only computation.
    Running benchmark_amg ...
    

[W MPSFallback.mm:11] Warning: The operator 'torchvision::nms' is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (function operator())

pre-commit-hooks.nix: updating /workspace/copier repo
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg
direnv: No virtual environment exists. Executing `poetry install` to create one.
Creating virtualenv copier-tqPO6HKK-py3.10 in /workspace/.pyenv_mirror/poetry/virtualenvs
Installing dependencies from lock file
Package operations: 70 installs, 1 update, 0 removals
• Installing six (1.16.0)
@GenevieveBuckley
GenevieveBuckley / bugreport_fastplotlib_flipping.ipynb
Created July 22, 2023 00:35
Bug report, unexpected behaviour in the fastplotlib library (flipping image orientations)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GenevieveBuckley
GenevieveBuckley / terminal-commands.txt
Created June 8, 2023 14:19
Common conda and terminal commands
Windows: open the miniforge terminal prompt
conda info --envs
# prints a list of the virtual environments you have
conda create --name myenv
# create a new virtual environment
conda activate myenv
# activate a virtual environment
@GenevieveBuckley
GenevieveBuckley / video-metadata.ipynb
Created April 20, 2023 08:35
Video metadata with ffmpeg and imageio_ffmpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GenevieveBuckley
GenevieveBuckley / red-flour-beetle.ipynb
Created April 19, 2023 08:56
Image analysis demos for Coiled benchmarking
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GenevieveBuckley
GenevieveBuckley / itk-dask-blogpost.ipynb
Last active March 3, 2023 12:43
ITK + Dask notebooks (August 2022)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.