Commit dca3b07b authored by Gustavo Pinzon's avatar Gustavo Pinzon
Browse files

Merge branch 'master' of https://gricad-gitlab.univ-grenoble-alpes.fr/ttk/spam into ddicTools

parents e41bd0f9 a39bbe4e
......@@ -66,6 +66,8 @@ Changelog
+----------------+------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Version | Date | Notes |
+================+============+======================================================================================================================================+
| Version 0.5.3.1| 2020-10-23 | spam-ereg-discrete make safer with slicePadded and moveGrains now renamed to moveLabels and proposed as function with erodeLabels |
+----------------+------------+--------------------------------------------------------------------------------------------------------------------------------------+
| Version 0.5.3 | 2020-10-07 | Improvements in edge cases in spam-ldic and spam-ddic, thanks to a helper function called spam.helpers.slicePadded(). |
| | | New debug mode for spam-ddic as well as a graphical tool to manually align labels called spam-ereg-discrete |
+----------------+------------+--------------------------------------------------------------------------------------------------------------------------------------+
......
......@@ -108,22 +108,24 @@ class MainWindow(QWidget):
Phi[0:3,-1] -= displacementInt
print("\t\tSubtracted this displacement:", displacementInt)
#REFsubvol = REFgrey[REFlabBB[nonConvergedGrain,0]-args.margin : REFlabBB[nonConvergedGrain,1]+1+args.margin,
#REFlabBB[nonConvergedGrain,2]-args.margin : REFlabBB[nonConvergedGrain,3]+1+args.margin,
#REFlabBB[nonConvergedGrain,4]-args.margin : REFlabBB[nonConvergedGrain,5]+1+args.margin]
REFgl = spam.label.getLabel(REFlab, nonConvergedGrain,
boundingBoxes=REFlabBB, centresOfMass=REFlabCOM,
labelDilate=args.LABEL_DILATE, margin=args.margin,
maskOtherLabels=args.MASK)
REFsubvol = REFgrey[REFgl['slice']]
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
REFsubvol = spam.helpers.slicePadded(REFgrey, REFgl['boundingBox']+numpy.array([0,1,0,1,0,1]))
if args.MASK:
# If mask asked, also flatten greylevels
REFsubvol[REFgl['subvol'] == 0] = 0
DEFsubvol = DEFgrey[REFlabBB[nonConvergedGrain,0]+displacementInt[0]-args.margin : REFlabBB[nonConvergedGrain,1]+1+displacementInt[0]+args.margin,
REFlabBB[nonConvergedGrain,2]+displacementInt[1]-args.margin : REFlabBB[nonConvergedGrain,3]+1+displacementInt[1]+args.margin,
REFlabBB[nonConvergedGrain,4]+displacementInt[2]-args.margin : REFlabBB[nonConvergedGrain,5]+1+displacementInt[2]+args.margin]
# 2020-10-23: EA on Issue #186: using spam.helpers.slicePadded
REFsubvol = spam.helpers.slicePadded(REFgrey, REFgl['boundingBox']+numpy.array([0,1,0,1,0,1]))
DEFsubvol = spam.helpers.slicePadded(DEFgrey, REFgl['boundingBox']+
numpy.array([0,1,0,1,0,1])+
numpy.array([displacementInt[0], displacementInt[0],
displacementInt[1], displacementInt[1],
displacementInt[2], displacementInt[2]]))
self.eregWidget = visual.ereg( [REFsubvol, DEFsubvol],
Phi, 1,
......
......@@ -99,7 +99,7 @@ name = 'spam'
description = 'Software for the Practical Analysis of Materials'
long_description = readReadMe('README.rst')
long_description_content_type = 'text/x-rst'
version = '0.5.3'
version = '0.5.3.1'
author = 'SPAM authors'
author_email = 'edward.ando@3sr-grenoble.fr'
copyright = 'SPAM authors 2020'
......
......@@ -761,11 +761,11 @@ def labelTetrahedra(dims, points, connectivity):
----------
dims: tuple representing z,y,x dimensions of the desired labelled output
points: 3 x number of points array of floats
points: number of points x 3 array of floats
List of points that define the vertices of the tetrahedra in Z,Y,X format.
These points are referred to by line number in the connectivity array
connectivity: 4 x number of tetrahedra array of integers
connectivity: number of tetrahedra x 4 array of integers
Connectivity matrix between points that define tetrahedra.
Each line defines a tetrahedron whose number is the line number + 1.
Each line contains 4 integers that indicate the 4 points in the nodePos array.
......@@ -775,6 +775,10 @@ def labelTetrahedra(dims, points, connectivity):
3D array of ints, shape = dims
Labelled 3D volume where voxels are numbered according to the tetrahedron number they fall inside of
"""
assert(len(dims) == 3), "spam.label.labelTetrahedra(): dim is not length 3"
assert(points.shape[1] == 3), "spam.label.labelTetrahedra(): points doesn't have 3 colums"
assert(connectivity.shape[1] == 4), "spam.label.labelTetrahedra(): connectivity doesn't have 4 colums"
assert(points.shape[0] >= connectivity.max()), "spam.label.labelTetrahedra(): connectivity should not refer to points numbers biggest than the number of rows in points"
dims = numpy.array(dims).astype('<u2')
lab = numpy.ones(tuple(dims), dtype=labelType)*connectivity.shape[0]+1
......
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