This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Build PTESC from scratch (for Mac OS)" | |
| echo "-----" | |
| echo "note:" | |
| echo " require customized HDF5 (run '>> ./install_HDF5.sh ')" | |
| echo " require open-mpi from hombrew(run '>> brew install openmpi')" | |
| echo " require cmake from hombrew(run '>> brew install cmake ')" | |
| echo " use system python (2.7) for the configure step" | |
| echo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Build HDF5 from scratch (for Mac OS)" | |
| echo "-----" | |
| echo "note:" | |
| echo " require open-mpi from hombrew(run '>> brew install openmpi')" | |
| echo | |
| PREFIX=$HOME/opt | |
| VERSION=1.10.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import net.imglib2.img.display.imagej.*; | |
| import org.janelia.saalfeldlab.n5.*; | |
| import org.janelia.saalfeldlab.n5.hdf5.*; | |
| import org.janelia.saalfeldlab.n5.imglib2.*; | |
| n5 = new N5HDF5Reader("/Users/chenzhang/tmp/tomoproc_test/ss304.h5"); | |
| img = N5Utils.open(n5, "/exchange/data"); | |
| ImageJFunctions.show(img); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ipywidgets as widgets | |
| # dynamic view of proj | |
| @widgets.interact(n=(0, proj.shape[0]-1), cmap=['gray', 'jet'], vmin=(0,65535), vmax=(0,65535)) | |
| def peekimg(n, cmap, vmin=0, vmax=20000, showcnr=True): | |
| fig, axes = plt.subplots(figsize=(10,10)) | |
| img = proj[n,:,:] | |
| axes.imshow(img, cmap=cmap, vmin=vmin, vmax=vmax) | |
| if showcnr: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #perform histogram equalization with numpy, without explicitly computing the histogram | |
| #im is a numpy array, of any dimension | |
| im2 = numpy.sort(im.ravel()).searchsorted(im) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # use class attributes to link all instance as one | |
| class Borg: | |
| __shared_states = {} | |
| def __init__(self): | |
| self.__dict__ = self.__shared_states | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| def myfunc(x): | |
| return x**2 | |
| t1 = threading.Thread(traget=myfunc, args=range(10)) | |
| t1.start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _const: | |
| class ConstError(TypeError): | |
| pass | |
| class ConstCaseError(ConstError): | |
| pass | |
| def __setattr__(self, name, value): | |
| if self.__dict__.has_key(name): | |
| raise self.ConstError, "can't change constant" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # FROM the mighty stackoverflow | |
| # remove any existing files from the repo, skipping over ones not in repo | |
| find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch | |
| # specify a global exclusion list | |
| git config --global core.excludesfile ~/.gitignore | |
| # adding .DS_Store to that list | |
| echo .DS_Store >> ~/.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Parallelized k-means module. | |
| By David Warde-Farley, February 2012. Licensed under the 3-clause BSD. | |
| """ | |
| cimport cython | |
| from cython.parallel import prange | |
| import numpy as np | |
| cimport numpy as np | |
| from numpy.random import normal |