Commit 56144098 authored by Edward Andò's avatar Edward Andò
Browse files

implementing slicePadded in spam-ddic, should solve all cases of RS=-5

parent c0269bb0
......@@ -364,8 +364,7 @@ if mpiRank == boss or not mpi:
else:
maskette1 = None
maskette1vol = numpy.inf # must pass "if" below
slicette1 = getLabel['slice']
imagette1 = im1[slicette1].copy()
imagette1 = im1[getLabel['slice']].copy()
if maskette1vol > args.VOLUME_THRESHOLD:
if args.PS == 'on' or (not registrationSuccessful and args.PS == 'auto'):
......@@ -460,14 +459,18 @@ if mpiRank == boss or not mpi:
if args.LABEL_CORRELATE:
labelDisplacementInt = numpy.round(PhiField[label][0:3, -1])
slicette2 = (slice(max(int(boundingBoxes[label][0] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[0] ), 0 ),
min(int(boundingBoxes[label][1] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[0] + 1), im1.shape[0])),
slice(max(int(boundingBoxes[label][2] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[1] ), 0 ),
min(int(boundingBoxes[label][3] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[1] + 1), im1.shape[1])),
slice(max(int(boundingBoxes[label][4] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[2] ), 0 ),
min(int(boundingBoxes[label][5] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[2] + 1), im1.shape[2])))
# 2020-09-25 OS and EA: Prepare startStop array for imagette 2 to be extracted with new
# slicePadded, this should solved "Boss: failed imDiff" and RS=-5 forever
startStopIm2 = [int(boundingBoxes[label][0] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[0] ),
int(boundingBoxes[label][1] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[0] + 1),
int(boundingBoxes[label][2] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[1] ),
int(boundingBoxes[label][3] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[1] + 1),
int(boundingBoxes[label][4] - args.LABEL_CORRELATE_MARGIN - max(labelDilateCurrent, 0) + labelDisplacementInt[2] ),
int(boundingBoxes[label][5] + args.LABEL_CORRELATE_MARGIN + max(labelDilateCurrent, 0) + labelDisplacementInt[2] + 1)]
imagette2imagette1sizeDiff = numpy.array(im2[slicette2].shape) - numpy.array(imagette1.shape)
imagette2 = spam.helpers.slicePadded(im2, startStopIm2)
imagette2imagette1sizeDiff = numpy.array(imagette2.shape) - numpy.array(imagette1.shape)
# Catch register DimProblem
if not (imagette2imagette1sizeDiff < 0).any():
......@@ -481,7 +484,7 @@ if mpiRank == boss or not mpi:
if not mpi:
returns = spam.DIC.correlate.registerMultiscale(imagette1,
im2[slicette2],
imagette2,
args.LABEL_CORRELATE_MULTISCALE_BINNING,
im1mask=maskette1,
margin=1,
......@@ -499,7 +502,7 @@ if mpiRank == boss or not mpi:
# build message for lukasKanade worker
m = {'label': label,
'im1': imagette1,
'im2': im2[slicette2],
'im2': imagette2,
'binStart': args.LABEL_CORRELATE_MULTISCALE_BINNING,
'im1mask': maskette1,
'PhiInit': PhiTemp,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment