This file contains 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% \embedvideo{<poster or text>}{<video file (MP4+H264)>} | |
% \embedvideo*{...}{...} % auto-play | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\usepackage[bigfiles]{pdfbase} | |
\ExplSyntaxOn | |
\NewDocumentCommand\embedvideo{smm}{ | |
\group_begin: | |
\leavevmode |
This file contains 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 napari | |
import numpy as np | |
import matplotlib.pyplot as pl | |
import h5py | |
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.figure import Figure | |
#from qtpy.QtWidgets import QApplication, QMainWindow, QPushButton, QMenu, QVBoxLayout, QSizePolicy, QMessageBox, QWidget, QPushButton | |
import pyqtgraph as pg | |
from pyqtgraph.Qt import QtGui, QtCore | |
import sys |
This file contains 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 cv2 | |
import numpy as np | |
def minMaxFilter(img, filterSize, minContrast): | |
""" | |
After R.Adrian, J.Westerweel, "Particle image velocimetry", Cambridge | |
university press, 2011. See ch.6.1.2, p.248-250. | |
Parameters: img (cv2.imread) - image to be filtered | |
filterSize (nd.array) - a 1x2 numpy array of the filter height | |
and width correspondingly |
This file contains 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
def customDeen(frame0, | |
frame1, | |
algorithmType = 'basic', | |
cliplimit = 2.0, | |
tileGridSize = (4, 4) | |
): | |
""" | |
This is the custom implementation of the image processing alogrithm for PIV | |
after Deen, Willems, Annaland, Kuipers, Lammertink, Kemperman, Wessling, | |
Meer, "On image preprocessing for PIV of single and two phase flows over |
This file contains 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
## Follow this link for further updates to Github Desktop for Ubuntu https://github.com/shiftkey/desktop/releases/latest | |
# UPDATE (2021-10-18): Thanks to Amin Yahyaabadi's message, the updated code is as follows | |
sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.9.3-linux3/GitHubDesktop-linux-2.9.3-linux3.deb | |
### Uncomment below line if you have not installed gdebi-core before | |
# sudo apt-get install gdebi-core | |
sudo gdebi GitHubDesktop-linux-2.9.3-linux3.deb | |
# UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81 |
This file contains 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
def align_vectorised(a: np.ndarray, b: np.ndarray): | |
""" | |
Find array of rotation matrices r such that r @ a = b when a and b are arrays of normalised vectors | |
implementation designed to avoid trig calls | |
based on https://iquilezles.org/www/articles/noacos/noacos.htm | |
:param a: normalised vector(s) of length 3 | |
:param b: normalised vector(s) of length 3 | |
:return: rotation matrix | |
""" | |
# setup |
This file contains 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
def random_uniform_rotation(size=1): | |
""" | |
Return uniform rotation vectors sampled on a sphere | |
Args: | |
size : int | |
The number of vectors | |
Returns: | |
vector: np.ndarray | |
The rotation vectors | |
""" |
This file contains 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 time import sleep | |
import napari | |
import numpy as np | |
from napari.qt.threading import thread_worker | |
viewer = napari.Viewer() | |
bbox_layer = viewer.add_points( | |
[[-1, -1], [-1, 1], [1, -1], [1, 1]], face_color='green') | |
points_layer = viewer.add_points([0, 0], face_color='magenta') |
This file contains 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 time import sleep | |
from enum import Enum | |
import napari | |
import numpy as np | |
import psygnal | |
from napari.qt.threading import thread_worker | |
BOARD_SIZE = 14 | |
INITIAL_SNAKE_LENGTH = 4 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder