Skip to content

Instantly share code, notes, and snippets.

@Feyn-Man
Feyn-Man / convex-hull.ipynb
Last active January 6, 2021 13:15
Convex hull application to single-channel binary numpy array using the OpenCV library.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Feyn-Man
Feyn-Man / _dice.py
Last active December 14, 2020 14:55 — forked from brunodoamaral/_dice.py
Dice coefficient between two boolean NumPy arrays or array-like data. This is commonly used as a set similarity measurement (though note it is not a true metric; it does not satisfy the triangle inequality). The dimensionality of the input is completely arbitrary, but `im1.shape` and `im2.shape` much be equal. This Gist is licensed under the mod…
def dice(im1, im2):
"""
Computes the Dice coefficient, a measure of set similarity.
Parameters
----------
im1 : array-like, bool
Any array of arbitrary size. If not boolean, will be converted.
im2 : array-like, bool
Any other array of identical size. If not boolean, will be converted.
Returns
@Feyn-Man
Feyn-Man / overlay-rgb-images.ipynb
Last active December 12, 2020 20:27
Overlay RGB images.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Feyn-Man
Feyn-Man / biggest_area_selector.ipynb
Created December 11, 2020 11:00
biggest_area_selector.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Feyn-Man
Feyn-Man / contour_extraction_numpy_mask_array.ipynb
Created October 29, 2020 20:24
Contour_extraction_numpy_mask_array.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Feyn-Man
Feyn-Man / sliding-window.ipynb
Last active December 12, 2019 15:27
Python code for a sliding window on numpy arrays (images)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Feyn-Man
Feyn-Man / load_inbreast_roi.py
Last active July 19, 2022 12:49 — forked from jendelel/load_inbreast_roi.py
Load INBREAST ROIs
from skimage.draw import polygon
import numpy as np
import plistlib
def load_inbreast_mask(mask_path, imshape=(4084, 3328)):
"""
This function loads a osirix xml region as a binary numpy array for INBREAST
dataset
@mask_path : Path to the xml file