Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

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

Resolves #181 : multiscale implemented for initial registration in spam-ldic...

Resolves #181 : multiscale implemented for initial registration in spam-ldic and spam-ddic (-regb -> -regbb to -regbe) as well as multiscale for the labels in spam-ddic (-lcmsb)
parent a3935ec9
Pipeline #49429 passed with stages
in 22 minutes and 59 seconds
......@@ -157,22 +157,15 @@ if mpiRank == boss or not mpi:
registrationSuccessful = False
if args.REG:
print("spam-ddic: Starting registration")
if args.REG_BIN == 1:
im1Reg = im1
im2Reg = im2
else:
im1Reg = spam.DIC.binning(im1, args.REG_BIN)
im2Reg = spam.DIC.binning(im2, args.REG_BIN)
regReturns = spam.DIC.correlate.register( im1Reg, im2Reg,
margin=int(args.REG_MARGIN * min(im1Reg.shape)),
interpolationOrder=1,
maxIterations=500,
deltaPhiMin=0.0001,
updateGradient=args.REG_UPDATE,
interpolator='C',
verbose=True,
imShowProgress=None)
regReturns = spam.DIC.correlate.registerMultiscale(im1, im2,
args.REG_BIN_BEGIN, binStop=args.REG_BIN_END,
margin=int(args.REG_MARGIN * min(im1.shape)),
interpolationOrder=1,
maxIterations=500,
deltaPhiMin=0.0001,
updateGradient=args.REG_UPDATE,
interpolator='C',
verbose=True)
if regReturns['returnStatus'] != 2:
print("spam-ddic: Registration did not converge, try increasing the registration margin?")
......@@ -186,23 +179,20 @@ if mpiRank == boss or not mpi:
print("\t\t", spam.deformation.decomposePhi(regReturns['Phi'])['r'])
regPhi = regReturns['Phi']
regCentre = (numpy.array(im1Reg.shape) - 1) / 2.0
regCentre = (numpy.array(im1.shape)/args.REG_BIN_END - 1) / 2.0
# Not right in 100% of cases, but disactivate pixelSearch if the registration has converged
# args.PS = False
# Also disactive loading further guesses.
args.PHIFILE = None
# if args.TSV:
spam.helpers.tsvio.writeRegistrationTSV(args.OUT_DIR + "/" + args.PREFIX + "-bin{:d}".format(args.REG_BIN) + "-registration.tsv", regCentre, regReturns)
# HACK: overwrite variables regPhi, regCentre with binning 1 versions
if args.REG_BIN != 1:
regPhi[0:3, 3] *= float(args.REG_BIN)
regCentre *= float(args.REG_BIN)
# Make a copy and downscale displacements to final binning level
regReturnsOutput = regReturns.copy()
regReturnsOutput['Phi'][0:3,-1] /= float(args.REG_BIN_END)
# tidy up after registration:
del im1Reg, im2Reg
# if args.TSV:
spam.helpers.tsvio.writeRegistrationTSV(args.OUT_DIR + "/" + args.PREFIX + "-bin{:d}".format(args.REG_BIN_END) + "-registration.tsv", regCentre, regReturnsOutput)
del regReturnsOutput
# Option 2 - load previous DVC
#################################
......@@ -483,18 +473,19 @@ if mpiRank == boss or not mpi:
if args.DEBUG: print("\nStarting lk iterations with int(disp):\n", labelDisplacementInt)
if not mpi:
returns = spam.DIC.correlate.register(imagette1,
im2[slicette2],
im1mask=maskette1,
margin=1,
PhiInit=PhiTemp,
PhiRigid=args.LABEL_CORRELATE_RIGID,
updateGradient=args.LABEL_CORRELATE_UPDATE_GRADIENT,
maxIterations=args.LABEL_CORRELATE_MAX_ITERATIONS,
deltaPhiMin=args.LABEL_CORRELATE_MIN_PHI_CHANGE,
interpolationOrder=args.LABEL_CORRELATE_INTERPOLATION_ORDER,
verbose=args.DEBUG,
imShowProgress=args.DEBUG)
returns = spam.DIC.correlate.registerMultiscale(imagette1,
im2[slicette2],
args.LABEL_CORRELATE_MULTISCALE_BINNING,
im1mask=maskette1,
margin=1,
PhiInit=PhiTemp,
PhiRigid=args.LABEL_CORRELATE_RIGID,
updateGradient=args.LABEL_CORRELATE_UPDATE_GRADIENT,
maxIterations=args.LABEL_CORRELATE_MAX_ITERATIONS,
deltaPhiMin=args.LABEL_CORRELATE_MIN_PHI_CHANGE,
interpolationOrder=args.LABEL_CORRELATE_INTERPOLATION_ORDER,
verbose=args.DEBUG,
imShowProgress=args.DEBUG)
writeReturns = True
elif mpi:
......@@ -502,6 +493,7 @@ if mpiRank == boss or not mpi:
m = {'label': label,
'im1': imagette1,
'im2': im2[slicette2],
'binStart': args.LABEL_CORRELATE_MULTISCALE_BINNING,
'im1mask': maskette1,
'PhiInit': PhiTemp,
'PhiRigid': args.LABEL_CORRELATE_RIGID,
......@@ -668,16 +660,17 @@ elif mpi: # We are not the mpi boss, so we are a lukasKanade worker
tag = mpiStatus.Get_tag()
# We've recieved a label to process
if tag == 1:
returns = spam.DIC.correlate.register(m['im1'],
m['im2'],
im1mask=m['im1mask'],
PhiInit=m['PhiInit'],
PhiRigid=m['PhiRigid'],
updateGradient=m['updateGradient'],
margin=m['margin'],
maxIterations=m['maxIterations'],
deltaPhiMin=m['deltaPhiMin'],
interpolationOrder=m['interpolationOrder']
returns = spam.DIC.correlate.registerMultiscale(m['im1'],
m['im2'],
m['binStart'],
im1mask=m['im1mask'],
PhiInit=m['PhiInit'],
PhiRigid=m['PhiRigid'],
updateGradient=m['updateGradient'],
margin=m['margin'],
maxIterations=m['maxIterations'],
deltaPhiMin=m['deltaPhiMin'],
interpolationOrder=m['interpolationOrder']
)
# print("\t\t\tI am worker {} Sending result for label {}".format( mpiRank, m['label'] ))
mpiComm.send([mpiRank, m['label'], returns, m['labelDisplacementInt'], m['labelDilate']], dest=boss, tag=2)
......
......@@ -155,56 +155,49 @@ if mpiRank == boss or not mpi:
registrationSuccessful = False
if args.REG:
print("\tldic: Starting registration")
# Check whether we should downscale the images for initial registration
if args.REG_BIN == 1:
im1Reg = im1
im2Reg = im2
else:
im1Reg = spam.DIC.binning(im1, args.REG_BIN)
im2Reg = spam.DIC.binning(im2, args.REG_BIN)
if twoD:
regMargin = int(args.REG_MARGIN*min(im1Reg.shape[1:3]))
else:
regMargin = int(args.REG_MARGIN*min(im1Reg.shape))
# Run registration
regReturns = spam.DIC.correlate.register( im1Reg, im2Reg,
#im1mask = im1mask ?,
margin=regMargin,
interpolationOrder=1,
maxIterations=500,
deltaPhiMin=0.0001,
updateGradient=args.REG_UPDATE,
interpolator='C',
verbose=True,
imShowProgress=None)
if regReturns['returnStatus'] != 2:
print("\tldic: Registration did not converge, try increasing the registration margin?")
regMargin = int(args.REG_MARGIN*min(im1.shape[1:3]))
else:
print("\tldic: Registration converged beautifully...")
registrationSuccessful = True
regMargin = int(args.REG_MARGIN*min(im1.shape))
print("\tTranslations (px)")
print("\t\t", spam.deformation.decomposePhi(regReturns['Phi'])['t'])
print("\tRotations (deg)")
print("\t\t", spam.deformation.decomposePhi(regReturns['Phi'])['r'])
regPhi = regReturns['Phi']
regCentre = (numpy.array(im1Reg.shape)-1)/2.0
# Not right in 100% of cases, but disactivate pixelSearch if the registration has converged
#args.PS = False
# Also disactive loading further guesses.
args.PHIFILE = None
if args.TSV:
spam.helpers.tsvio.writeRegistrationTSV(args.OUT_DIR+"/"+args.PREFIX+"-bin{:d}".format(args.REG_BIN)+"-registration.tsv", regCentre, regReturns)
# HACK: overwrite variables regPhi, regCentre with binning 1 versions
if args.REG_BIN != 1:
regPhi[0:3, 3] *= float(args.REG_BIN)
regCentre *= float(args.REG_BIN)
# Run registration
regReturns = spam.DIC.correlate.registerMultiscale(im1, im2,
args.REG_BIN_BEGIN, binStop=args.REG_BIN_END,
margin=int(args.REG_MARGIN * min(im1.shape)),
im1mask=im1mask,
interpolationOrder=1,
maxIterations=500,
deltaPhiMin=0.0001,
updateGradient=args.REG_UPDATE,
interpolator='C',
verbose=True)
if regReturns['returnStatus'] != 2:
print("spam-ddic: Registration did not converge, try increasing the registration margin?")
else:
print("spam-ddic: Registration converged beautifully...")
registrationSuccessful = True
print("\tTranslations (px)")
print("\t\t", spam.deformation.decomposePhi(regReturns['Phi'])['t'])
print("\tRotations (deg)")
print("\t\t", spam.deformation.decomposePhi(regReturns['Phi'])['r'])
regPhi = regReturns['Phi']
regCentre = (numpy.array(im1.shape)/args.REG_BIN_END - 1) / 2.0
# Not right in 100% of cases, but disactivate pixelSearch if the registration has converged
# args.PS = False
# Also disactive loading further guesses.
args.PHIFILE = None
# Make a copy and downscale displacements to final binning level
regReturnsOutput = regReturns.copy()
regReturnsOutput['Phi'][0:3,-1] /= float(args.REG_BIN_END)
# if args.TSV:
spam.helpers.tsvio.writeRegistrationTSV(args.OUT_DIR + "/" + args.PREFIX + "-bin{:d}".format(args.REG_BIN_END) + "-registration.tsv", regCentre, regReturnsOutput)
del regReturnsOutput
# Option 2 - load previous DVC
#################################
......
......@@ -761,7 +761,7 @@ class testAll(unittest.TestCase):
"-glt", "0.5",
"-hws", "10",
"-ns", "10",
"-reg", "-regb", "2",
"-reg", "-regbb", "2", "-regbe", "2",
"-tsv",
"-gpi", "5",
"Step0.tif", "Step1.tif",
......
......@@ -106,14 +106,14 @@ class testAll(unittest.TestCase):
self.assertEqual(exitCode, 0)
# Just run a simple DVC with no outputs
# exitCode = subprocess.call(["spam-ldic", "-reg", "-regb", "2", "-hws", "10", testFolder+"snow-ref.tif", testFolder+"snow-def.tif", "-od", testFolder+""], stdout=FNULL, stderr=FNULL)
exitCode = subprocess.call(["spam-ldic", "-reg", "-regb", "2", "-hws", "10", testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + ""])
# exitCode = subprocess.call(["spam-ldic", "-reg", "-regbb", "2", "-hws", "10", testFolder+"snow-ref.tif", testFolder+"snow-def.tif", "-od", testFolder+""], stdout=FNULL, stderr=FNULL)
exitCode = subprocess.call(["spam-ldic", "-reg", "-regbb", "2", "-hws", "10", testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + ""])
self.assertEqual(exitCode, 0)
# Check output results with TSV output, bin1 registration + TIFFs
# Decreasing node spacing in order to have more points for Geers strain calculation
# exitCode = subprocess.call(["spam-ldic", "-Ffile", testFolder+"snow-ref-snow-def-bin2-registration.tsv", "-Ffb", "2", "-hws", "15", testFolder+"snow-ref.tif", testFolder+"snow-def.tif", "-od", testFolder+"", "-tsv"])
exitCode = subprocess.call(["spam-ldic", "-reg", "-regb", "1", "-hws", "10", '-ns', '15', testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + "", "-tsv", "-tif", '-vtk'])
exitCode = subprocess.call(["spam-ldic", "-reg", "-regbb", "1", "-hws", "10", '-ns', '15', testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + "", "-tsv", "-tif", '-vtk'])
self.assertEqual(exitCode, 0)
# Check registration
......@@ -426,7 +426,7 @@ class testAll(unittest.TestCase):
#######################################################
# Just run a simple DVC with no outputs
exitCode = subprocess.call(["spam-ddic",
"-reg", "-regb", "2",
"-reg", "-regbb", "2",
testFolder + "Step0.tif",
testFolder + "Lab0.tif",
testFolder + "Step1.tif",
......@@ -508,7 +508,6 @@ class testAll(unittest.TestCase):
self.assertGreaterEqual(convergedGrains1, convergedGrains0)
#######################################################
# Now check with label mover -- easier if there are no rotations
#######################################################
......@@ -530,6 +529,45 @@ class testAll(unittest.TestCase):
#######################################################
### 2. Run ddic -- Step0 -> Step1 with multiscale
#######################################################
# Just run a simple DVC with no outputs
exitCode = subprocess.call(["spam-ddic",
"-reg", "-regbb", "2",
"-lcmsb", "2",
testFolder + "Step0.tif",
testFolder + "Lab0.tif",
testFolder + "Step1.tif",
"-od", testFolder + ""])
self.assertEqual(exitCode, 0)
# Check TSV for local results
TSV = spam.helpers.readCorrelationTSV(testFolder + "Step0-Step1-discreteDVC.tsv")
Phis = TSV['PhiField'][TSV['returnStatus'] == 2]
translations = []
rotations = []
for Phi in Phis:
t = spam.deformation.decomposePhi(Phi)
translations.append(t['t'])
rotations.append(t['r'])
translations = numpy.array(translations)
rotations = numpy.array(rotations)
averageRot = numpy.median(rotations, axis=0)
averageTra = numpy.median(translations, axis=0)
# Generous error tollerance
self.assertAlmostEqual(translationStep1[0], averageTra[0], places=0)
self.assertAlmostEqual(translationStep1[1], averageTra[1], places=0)
self.assertAlmostEqual(translationStep1[2], averageTra[2], places=0)
self.assertAlmostEqual(rotationStep1[0], averageRot[0], places=0)
self.assertAlmostEqual(rotationStep1[1], averageRot[1], places=0)
self.assertAlmostEqual(rotationStep1[2], averageRot[2], places=0)
#######################################################
### 2. Run ddic -- Step0 -> Step2 with pixel search
#######################################################
......
......@@ -342,7 +342,6 @@ def register(im1, im2, im1mask=None, PhiInit=None, PhiRigid=False, PhiInitBinRat
# pbar = progressbar.ProgressBar(widgets=widgets, maxval=numberOfNodes)
pbar.start()
# --- Start Iterations ---
while iterations < maxIterations and deltaPhiNorm > deltaPhiMin:
errorPrev = error
......@@ -475,31 +474,40 @@ def register(im1, im2, im1mask=None, PhiInit=None, PhiRigid=False, PhiInitBinRat
#if imShowProgress == "Z" or imShowProgress == "z":
if imShowProgressNewFig: plt.figure()
else: plt.clf()
plt.suptitle('Iteration Number = {}'.format(iterations), fontsize=10)
plt.subplot(3,3,1)
plt.title('im1 Z-slice')
plt.imshow(im1crop[im1crop.shape[0]//2, :, :], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,2)
plt.title('im2def Z-slice')
plt.imshow(im2def[crop2][im1crop.shape[0]//2, :, :], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,3)
plt.title('im1-im2def Z-slice')
plt.imshow(numpy.subtract(im1crop, im2def[crop2])[im1crop.shape[0]//2, :, :], cmap='coolwarm', vmin=vmin, vmax=vmax)
#if imShowProgress == "Y" or imShowProgress == "y":
#if imShowProgressNewFig: plt.figure()
#else: plt.clf()
plt.subplot(3,3,4)
plt.title('im1 Y-slice')
plt.imshow(im1crop[:, im1crop.shape[1]//2, :], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,5)
plt.title('im2def Y-slice')
plt.imshow(im2def[crop2][:, im1crop.shape[1]//2, :], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,6)
plt.title('im1-im2def Y-slice')
plt.imshow(numpy.subtract(im1crop, im2def[crop2])[:, im1crop.shape[1]//2, :], cmap='coolwarm', vmin=vmin, vmax=vmax)
#if imShowProgress == "X" or imShowProgress == "x":
#if imShowProgressNewFig: plt.figure()
#else: plt.clf()
plt.subplot(3,3,7)
plt.title('im1 X-slice')
plt.imshow(im1crop[:, :, im1crop.shape[2]//2], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,8)
plt.title('im2def X-slice')
plt.imshow(im2def[crop2][:, :, im1crop.shape[2]//2], cmap='Greys_r', vmin=0, vmax=vmax)
plt.subplot(3,3,9)
plt.title('im1-im2def X-slice')
plt.imshow(numpy.subtract(im1crop, im2def[crop2])[:, :, im1crop.shape[2]//2], cmap='coolwarm', vmin=vmin, vmax=vmax)
plt.title('Iteration Number = {}'.format(iterations))
plt.pause(0.1)
iterations += 1
......@@ -541,7 +549,7 @@ def register(im1, im2, im1mask=None, PhiInit=None, PhiRigid=False, PhiInitBinRat
def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinRatio=1.0, margin=None, maxIterations=100, deltaPhiMin=0.0001, updateGradient=False, interpolationOrder=1, interpolator='C', verbose=False, imShowProgress=False, forceChangeScale=False):
def registerMultiscale(im1, im2, binStart, binStop=1, im1mask=None, PhiInit=None, PhiRigid=False, PhiInitBinRatio=1.0, margin=None, maxIterations=100, deltaPhiMin=0.0001, updateGradient=False, interpolationOrder=1, interpolator='C', verbose=False, imShowProgress=False, forceChangeScale=False):
"""
Perform multiscale subpixel image correlation between im1 and im2.
......@@ -560,9 +568,14 @@ def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinR
im2 : 3D numpy array
The greyscale image that will be deformed -- must not contain NaNs
binMax : int
binStart : int
Maximum amount of binning to apply, please input a number which is 2^int
binStop : int, optional
Which binning level to stop upscaling at.
The value of 1 (full image resolution) is almost always recommended (unless memory/time problems).
Default = 1
im1mask : 3D boolean numpy array, optional
A mask for the zone to correlate in im1 with `False` in the zone to not correlate.
Default = None, `i.e.`, correlate all of im1 minus the margin.
......@@ -572,6 +585,10 @@ def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinR
Initial deformation to apply to im1, by default at bin1 scale
Default = numpy.eye(4), `i.e.`, no transformation
PhiRigid : bool, optional
Run a rigid correlation? Only the rigid part of your PhiInit will be kept.
Default = False
PhiInitBinRatio : float, optional
Change translations in PhiInit, if it's been calculated on a differently-binned image. Default = 1
......@@ -637,27 +654,35 @@ def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinR
"""
import math
l = math.log(binMax, 2)
l = math.log(binStart, 2)
if not l.is_integer():
print("spam.DIC.correlate.registerMultiscale(): You asked for an initial binning of", binStart, ",rounding it to ", end='')
binStart = 2**numpy.round(l)
print(binStart)
l = math.log(binStop, 2)
if not l.is_integer():
print("spam.DIC.correlate.registerMultiscale(): You asked for a binning of",binMax,",rounding it to ", end='')
binMax = 2**numpy.round(l)
print(binMax)
print("spam.DIC.correlate.registerMultiscale(): You asked for a final binning of", binStop, ",rounding it to ", end='')
binStop = 2**numpy.round(l)
print(binStop)
# If there is no initial Phi, initalise it and im1defCrop to zero.
if PhiInit is None:
PhiInit = numpy.eye(4)
else:
# Apply binning on displacement -- the /2 is to be able to *2 it in the LK call
PhiInit[0:3, -1] *= PhiInitBinRatio/2.0/float(binMax)
PhiInit[0:3, -1] *= PhiInitBinRatio/2.0/float(binStart)
reg = {'Phi': PhiInit}
if im1mask is not None:
# Multiply up to 100 so we can apply a threshold below on binning in %
im1mask = im1mask.astype('<u1')*100
binLevel = int(binMax)
while binLevel > 0.5:
print("spam.DIC.correlate.registerMultiscale(): working on binning: ", binLevel)
# Sorry... This generates a list of binning levels, if binStart=8 and binStop=2 this will be [8, 4 ,2]
binLevels = 2**numpy.arange(math.log(binStart, 2), math.log(binStop, 2)-1, -1).astype(int)
for binLevel in binLevels:
if verbose:
print("spam.DIC.correlate.registerMultiscale(): working on binning: ", binLevel)
if binLevel > 1:
im1b = spam.DIC.binning(im1, binLevel)
im2b = spam.DIC.binning(im2, binLevel)
......@@ -691,7 +716,7 @@ def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinR
reg = spam.DIC.register(im1b, im2b,
im1mask = im1maskb,
PhiInit=reg['Phi'], PhiInitBinRatio=2.0,
PhiInit=reg['Phi'], PhiRigid=PhiRigid, PhiInitBinRatio=2.0,
margin=marginB,
maxIterations=maxIterations, deltaPhiMin=deltaPhiMin,
updateGradient=updateGradient,
......@@ -701,9 +726,16 @@ def registerMultiscale(im1, im2, binMax, im1mask=None, PhiInit=None, PhiInitBinR
if reg['returnStatus'] != 2 and not forceChangeScale:
print("spam.DIC.registerMultiscale(): binning {} did not converge (return Status = {}), not continuing".format(binLevel, reg['returnStatus']))
return
# Multiply up displacement and return bad result
print('Phi before:', reg['Phi'])
reg['Phi'][0:3,-1] *= float(binLevel)
print('Phi after:', reg['Phi'])
return reg
binLevel = int(binLevel/2)
# Return displacments at bin1 scale
reg['Phi'][0:3,-1] *= float(binStop)
return reg
......
......@@ -435,11 +435,10 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi
if numpy.isfinite(PhiField[nodeNumber]).sum() == 16:
nodeDisplacement = numpy.round(PhiField[nodeNumber][0:3, -1])
# prepare slice for imagette 1 -- this is fixed + 1 for the margin which is always 1
# prepare slice for imagette 1 -- this is fixed +1 for the margin which is always 1
subVolSlice1 = (slice(int(nodePositions[nodeNumber, 0] - halfWindowSize[0] - 1), int(nodePositions[nodeNumber, 0] + halfWindowSize[0] + 1 + 1)),
slice(int(nodePositions[nodeNumber, 1] - halfWindowSize[1] - 1), int(nodePositions[nodeNumber, 1] + halfWindowSize[1] + 1 + 1)),
slice(int(nodePositions[nodeNumber, 2] - halfWindowSize[2] - 1), int(nodePositions[nodeNumber, 2] + halfWindowSize[2] + 1 + 1)))
imagette1 = im1[subVolSlice1].copy()
# If there is a mask defined for im1, compute the coverage of this correlation window
......@@ -461,7 +460,6 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi
subVolSlice2 = (slice(int(nodePositions[nodeNumber, 0] - halfWindowSize[0] + nodeDisplacement[0] - margin[0] - 1), int(nodePositions[nodeNumber, 0] + halfWindowSize[0] + nodeDisplacement[0] + margin[0] + 1 + 1)),
slice(int(nodePositions[nodeNumber, 1] - halfWindowSize[1] + nodeDisplacement[1] - margin[1] - 1), int(nodePositions[nodeNumber, 1] + halfWindowSize[1] + nodeDisplacement[1] + margin[1] + 1 + 1)),
slice(int(nodePositions[nodeNumber, 2] - halfWindowSize[2] + nodeDisplacement[2] - margin[2] - 1), int(nodePositions[nodeNumber, 2] + halfWindowSize[2] + nodeDisplacement[2] + margin[2] + 1 + 1)))
# Extract it
imagette2 = im2[subVolSlice2].copy()
......@@ -597,7 +595,7 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi
deltaPhiMin=deltaPhiMin,
interpolationOrder=interpolationOrder,
verbose=False,
imShowProgress=None)
imShowProgress=False)
nodeDisplacement = imagetteReturns['nodeDisplacement']
writeReturns = True
......
......@@ -93,12 +93,19 @@ def ldicParser(parser):
dest='REG',
help='Perform an initial registration? Default = False')
parser.add_argument('-regb',
'--registration-binning',
parser.add_argument('-regbb',
'--registration-binning-begin',
type=int,
default=4,
dest='REG_BIN_BEGIN',
help='Initial binning to apply to input images for initial registration. Default = 4')
parser.add_argument('-regbe',
'--registration-binning-end',
type=int,
default=1,
dest='REG_BIN',
help='Binning to apply to input images for registration. Default = 1')
dest='REG_BIN_END',
help='Binning level to stop at for initial registration. Default = 1')
parser.add_argument('-regm',
'--registration-margin',
......@@ -501,12 +508,19 @@ def ddicParser(parser):
dest='REG',
help='Perform an initial registration? Default = False')
parser.add_argument('-regb',
'--registration-binning',
parser.add_argument('-regbb',
'--registration-binning-begin',
type=int,
default=4,
dest='REG_BIN_BEGIN',
help='Initial binning to apply to input images for initial registration. Default = 4')
parser.add_argument('-regbe',
'--registration-binning-end',
type=int,
default=1,
dest='REG_BIN',
help='Binning to apply to input images for registration. Default = 1')
dest='REG_BIN_END',
help='Binning level to stop at for initial registration. Default = 1')
parser.add_argument('-regm',
'--registration-margin',
......@@ -607,6 +621,19 @@ def ddicParser(parser):
dest='LABEL_CORRELATE_UPDATE_GRADIENT',
help='Update gradient in label registration? More computation time but more robust and possibly fewer iterations.')
#parser.add_argument('-lcms',
#'--label-correlate-multiscale',
#action="store_true",
#dest='LABEL_CORRELATE_MULTISCALE',
#help='Activate multiscale correlation for the label? If you set this, please indicate -lcmsb')
parser.add_argument('-lcmsb',
'--label-correlate-multiscale-binning',
type=numpy.uint,
default=1,
dest='LABEL_CORRELATE_MULTISCALE_BINNING',
help="Binning level for multiscale label correlation. Default = 1")
parser.add_argument('-lcmo',
'--label-correlate-mask-others',
action="store_false",
......
Markdown is supported
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