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

sketch of spam-ldic with slicePadded but not yet working fine

parent 3713ab91
Pipeline #49872 failed with stages
in 12 minutes and 32 seconds
...@@ -76,13 +76,16 @@ class testAll(unittest.TestCase): ...@@ -76,13 +76,16 @@ class testAll(unittest.TestCase):
rm(testFolder+"zoom.tsv") rm(testFolder+"zoom.tsv")
rm(testFolder+"snow-ref-bin.tif") rm(testFolder+"snow-ref-bin.tif")
rm(testFolder+"snow-ref-watershed.tif") rm(testFolder+"snow-ref-watershed.tif")
rm(testFolder+"extreme-im1.tif")
rm(testFolder+"extreme-im1lab.tif")
rm(testFolder+"extreme-im2.tif")
pass pass
except OSError: except OSError:
pass pass
pass pass
def _test_ldic_and_regularStrain(self): def test_ldic_and_regularStrain(self):
# Make test directory # Make test directory
if not os.path.isdir(testFolder): if not os.path.isdir(testFolder):
os.mkdir(testFolder) os.mkdir(testFolder)
...@@ -113,7 +116,7 @@ class testAll(unittest.TestCase): ...@@ -113,7 +116,7 @@ class testAll(unittest.TestCase):
# Check output results with TSV output, bin1 registration + TIFFs # Check output results with TSV output, bin1 registration + TIFFs
# Decreasing node spacing in order to have more points for Geers strain calculation # 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", "-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", "-regbb", "1", "-hws", "10", '-ns', '15', testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + "", "-tsv", "-tif", '-vtk']) exitCode = subprocess.call(["spam-ldic", "-ps", "off", "-reg", "-regbb", "2", "-regbe", "1", "-hws", "10", '-ns', '15', testFolder + "snow-ref.tif", testFolder + "snow-def.tif", "-od", testFolder + "", "-tsv", "-tif", '-vtk', '-gpmc', '1.0'])
self.assertEqual(exitCode, 0) self.assertEqual(exitCode, 0)
# Check registration # Check registration
...@@ -141,7 +144,7 @@ class testAll(unittest.TestCase): ...@@ -141,7 +144,7 @@ class testAll(unittest.TestCase):
# There's Z-rotation so translations need to be decomposed properly... just check Z # There's Z-rotation so translations need to be decomposed properly... just check Z
self.assertAlmostEqual(refTranslation[0], numpy.mean(Phis[converged,0,-1]), places=1) self.assertAlmostEqual(refTranslation[0], numpy.mean(Phis[converged,0,-1]), places=1)
for i in range(3): for i in range(3):
#self.assertAlmostEqual(refTranslation[i], numpy.mean(Phis[converged,i,-1]), places=1) self.assertAlmostEqual(refTranslation[i], numpy.mean(Phis[converged,i,-1]), places=1)
self.assertAlmostEqual(refRotation[i], numpy.mean(decomposedPhisConverged['r'][converged, i]), places=1) self.assertAlmostEqual(refRotation[i], numpy.mean(decomposedPhisConverged['r'][converged, i]), places=1)
...@@ -190,7 +193,7 @@ class testAll(unittest.TestCase): ...@@ -190,7 +193,7 @@ class testAll(unittest.TestCase):
for component in ["U", "e", "vol", "volss", "dev", "devss"]: for component in ["U", "e", "vol", "volss", "dev", "devss"]:
self.assertAlmostEqual(numpy.nanmean(strain[component]), numpy.nanmean(VTK[component]), places=3) self.assertAlmostEqual(numpy.nanmean(strain[component]), numpy.nanmean(VTK[component]), places=3)
def _test_ITKwatershed(self): def test_ITKwatershed(self):
# make sure it runs the help without error # make sure it runs the help without error
exitCode = subprocess.call(["spam-ITKwatershed", "--help"], exitCode = subprocess.call(["spam-ITKwatershed", "--help"],
stdout=FNULL, stderr=FNULL) stdout=FNULL, stderr=FNULL)
...@@ -212,12 +215,12 @@ class testAll(unittest.TestCase): ...@@ -212,12 +215,12 @@ class testAll(unittest.TestCase):
lab = tifffile.imread(testFolder + "snow-ref-watershed.tif") lab = tifffile.imread(testFolder + "snow-ref-watershed.tif")
self.assertEqual(lab.max()>10, True) self.assertEqual(lab.max()>10, True)
def _test_gdic(self): def test_gdic(self):
# make sure it runs the help without error # make sure it runs the help without error
exitCode = subprocess.call(["spam-gdic", "--help"], stdout=FNULL, stderr=FNULL) exitCode = subprocess.call(["spam-gdic", "--help"], stdout=FNULL, stderr=FNULL)
self.assertEqual(exitCode, 0) self.assertEqual(exitCode, 0)
def _test_deformImage(self): def test_deformImage(self):
# make sure it runs the help without error # make sure it runs the help without error
exitCode = subprocess.call(["spam-deformImageFromField", "--help"], stdout=FNULL, stderr=FNULL) exitCode = subprocess.call(["spam-deformImageFromField", "--help"], stdout=FNULL, stderr=FNULL)
self.assertEqual(exitCode, 0) self.assertEqual(exitCode, 0)
...@@ -690,7 +693,7 @@ class testAll(unittest.TestCase): ...@@ -690,7 +693,7 @@ class testAll(unittest.TestCase):
for label in [1,2]: for label in [1,2]:
self.assertAlmostEqual(numpy.abs(TSVextreme['PhiField'][label, axis, -1] - 4.0), 0.0, places=1) self.assertAlmostEqual(numpy.abs(TSVextreme['PhiField'][label, axis, -1] - 4.0), 0.0, places=1)
def _test_discreteStrain(self): def test_discreteStrain(self):
# make sure it runs the help without error # make sure it runs the help without error
exitCode = subprocess.call(["spam-discreteStrain", "--help"], exitCode = subprocess.call(["spam-discreteStrain", "--help"],
stdout=FNULL, stdout=FNULL,
......
...@@ -460,7 +460,7 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi ...@@ -460,7 +460,7 @@ def registerOnGrid(im1, im2, nodePositions, halfWindowSize, PhiField=None, margi
if im1mask is not None: if im1mask is not None:
# AND masks together, the one coming from the im1mask -- i.e., allowed correlation zones # AND masks together, the one coming from the im1mask -- i.e., allowed correlation zones
# and the imagette1sliceMask indicating whether we've gone outside the volume # and the imagette1sliceMask indicating whether we've gone outside the volume
imagette1mask = numpy.logical_and(imagette1mask, spam.helpers.startStopIm1(im1mask, startStopIm1)) imagette1mask = numpy.logical_and(imagette1mask, spam.helpers.slicePadded(im1mask, startStopIm1))
maskVolCondition = imagette1mask.sum() > minMaskVolume maskVolCondition = imagette1mask.sum() > minMaskVolume
# Make sure imagette is not 0-dimensional in any dimension # Make sure imagette is not 0-dimensional in any dimension
......
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