stripeExtraction#
Example Usage#
Full Contents:#
- stripeExtraction.anteriorMoveSegmentation(bw, placement, minsz, maxsz, msg)#
- ANTERIORMOVESEGMENTATION(bw, placement, minsz, maxsz)
Select a region of the BW segmented image that is anterior or posterior
to current selection (indexed by ‘placement’) to find stripe 7 segmentation.
- Parameters
bw (
NxM binary array) – pre-size-filtered binary maskplacement (
int) – the rank AP position of the segmented region (stripe7, for ex) that is true in the maskminsz (
float or int) – the min allowed size of a true region in the mask, in pixelsmaxsz (
float or int) – the max allowed size of a true region in the mask, in pixels
- Returns
bw (NxM binary array) – pre-size-filtered binary mask
bw2 (NxM binary array) – size-filtered binary mask
placement (int) – the rank AP position of the segmented region (stripe7, for ex) that is true in the mask
button (waitforbuttonpress() output) – what the current
NPMitchell 2020
- stripeExtraction.autoStripe7()#
default stripe7 finding protocol
NPMitchell 2020
- stripeExtraction.cutCurveIntoLeadingTrailingSegments()#
Cut curve into left and right segments (leading and trailing segments) Assume clockwise motion of the curve
- Parameters
stripe (
N x 2 float array) – the (AP, DV) coordinates of a stripe (both leading and trailing edges) as (x,y) coordinates- Returns
segs (length 2 cell array of xy positions) – leading edge and trailing edge curves as separate coorinate positions
NPMitchell 2020
- stripeExtraction.extractStripeEdges(dat, maskfn, thres, minmaxsz, embryoID)#
Determine the eges of a stripe in an image
- Parameters
dat (
NxM float array) – the image as a grid of intensity valuesmaskfn (
str) – the filename where the mask to determine the stripe segmentation is to be saved on diskthres (
float) – minimum value to use when binarizing in the segmentationminmaxsz (
length 2 float/int array) – the minimum and maximum size of the segmentated region allowedembryoID (
str) – ID tag for the embryo whose stripe is being segmented
- Returns
curv
NPMitchell 2020
- stripeExtraction.morphologicalOpLoop(bw, dcrop_orig, placement, thres, minmaxsz, msg)#
- MORPHOLOGICALOPLOOP(bw, dcrop_orig, placement, thres, minmaxsz)
Loop to extract mask segmentation by iterative dilation & erosion
- Parameters
bw (
NxM binary array) – pre-size-filtered binary maskdcrop_orig (
original intensity data) – original intensity data before thresholding to create maskplacement (
int) – the rank AP position of the segmented region (stripe7, for ex) that is true in the maskthres (
numeric threshold) – threshold for binarizing the dcrop_orig dataminmaxsz (
[minsz maxsz]) – the min and max allowed size of a true region in the mask, in pixels
- Returns
bw (NxM binary array) – pre-size-filtered binary mask
bw2 (NxM binary array) – size-filtered binary mask
good_enough (bool) – segmentation is good enough to save, should be true when returned
move_on (bool) – whether we are ready to continue with the pipeline
placement (int) – the rank AP position of the segmented region (stripe7, for ex) that is true in the mask
NPMitchell 2020
- stripeExtraction.ssrCurves(curv, refcurv, take_mean, symmetrize)#
Find sum of squared residual
- Parameters
curv (
N x 2 float array) – the curv to match refcurvrefcurv (
M x 2 float array) – the second curv, referencetake_mean (
bool (default=false)) – use mean distance between the two (discrete) curves instead of sumsymmetrize (
bool (default=false)) – return sqrt(ssr_12)* sqrt(ssr_21) so that curve ordering is irrelevant, or sum them together if take_mean==false.
- Returns
ssr (float)
NPMitchell 2020