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 7e5f0da1 authored by Emmanuel Roubin's avatar Emmanuel Roubin
Browse files

update marching cube

parent 045c962a
Pipeline #62895 canceled with stages
in 7 minutes and 20 seconds
......@@ -984,7 +984,7 @@ def trueSphericity(lab, boundingBoxes=None, centresOfMass=None, gaussianFilterSi
# Gaussian smooth
grainCubeFiltered = scipy.ndimage.filters.gaussian_filter(GL['subvol'].astype('<f4'), sigma=gaussianFilterSigma)
# mesh edge
verts, faces, _, _ = skimage.measure.marching_cubes_lewiner(grainCubeFiltered, level=0.5)
verts, faces, _, _ = skimage.measure.marching_cubes(grainCubeFiltered, level=0.5)
# compute surface
surfaceArea = skimage.measure.mesh_surface_area(verts, faces)
# compute psi
......@@ -1308,7 +1308,7 @@ def meanOrientation(orientations):
#def _fixUndersegmentation(imLab, imGrey, listLabels, a, c, numVect=100, vect=None, boundingBoxes=None, centresOfMass=None, numberOfThreads=1, verbose=False):
#"""
#This function fix undersegmented particles using directional erosion over the particle
#to get the seed for a new localized watershed.
#to get the seed for a new localized watershed.
#Parameters
#-----------
......@@ -1350,7 +1350,7 @@ def meanOrientation(orientations):
#Note
#-----
#Review spam.filters.morphologicalOperations.directionalErosion in order to
#Review spam.filters.morphologicalOperations.directionalErosion in order to
#select properly the shape and size of the structuring element for the
#directional erosion
......@@ -1408,8 +1408,8 @@ def meanOrientation(orientations):
#bwIm = labelData['subvol']
#while Continue == False:
#Directional Erosion
#imEroded = spam.filters.morphologicalOperations.directionalErosion(bwIm, vect,
#a, c, numberOfThreads = numberOfThreads,
#imEroded = spam.filters.morphologicalOperations.directionalErosion(bwIm, vect,
#a, c, numberOfThreads = numberOfThreads,
#verbose = verbose)
#Label the markers
#markers, num_seeds = scipy.ndimage.label(imEroded)
......@@ -1444,8 +1444,8 @@ def meanOrientation(orientations):
#Create a disposable dummy sample to allocate the grains
#labelDummyUnit = numpy.zeros(labelDummy.shape)
#Alocate the grains
#labelDummyUnit[boundingBoxes[label_i][0] : boundingBoxes[label_i][1]+1,
#boundingBoxes[label_i][2] : boundingBoxes[label_i][3]+1,
#labelDummyUnit[boundingBoxes[label_i][0] : boundingBoxes[label_i][1]+1,
#boundingBoxes[label_i][2] : boundingBoxes[label_i][3]+1,
#boundingBoxes[label_i][4] : boundingBoxes[label_i][5]+1] = fillNewSeg
#Add the grains
#labelDummy = labelDummy + labelDummyUnit
......@@ -1460,13 +1460,13 @@ def meanOrientation(orientations):
#We can modify the treshold
#itCounter += 1
#Grab the subset of the grain
#labelData = spam.label.getLabel(imLab, label_i,
#boundingBoxes = boundingBoxes,
#labelData = spam.label.getLabel(imLab, label_i,
#boundingBoxes = boundingBoxes,
#centresOfMass = centresOfMass)
#bwImOr = labelData['subvol']
#Get the same subset from the grey scale image
#greyIm_i = imGrey[boundingBoxes[label_i,0] : boundingBoxes[label_i,1]+1,
#boundingBoxes[label_i,2] : boundingBoxes[label_i,3]+1,
#greyIm_i = imGrey[boundingBoxes[label_i,0] : boundingBoxes[label_i,1]+1,
#boundingBoxes[label_i,2] : boundingBoxes[label_i,3]+1,
#boundingBoxes[label_i,4] : boundingBoxes[label_i,5]+1]
#Mask out the grey-level subset
#greyIm_i = greyIm_i * bwImOr
......@@ -1483,13 +1483,13 @@ def meanOrientation(orientations):
#We can modify the treshold
#itCounter += 1
#Grab the subset of the grain
#labelData = spam.label.getLabel(imLab, label_i,
#boundingBoxes = boundingBoxes,
#labelData = spam.label.getLabel(imLab, label_i,
#boundingBoxes = boundingBoxes,
#centresOfMass = centresOfMass)
#bwImOr = labelData['subvol']
#Get the same subset from the grey scale image
#greyIm_i = imGrey[boundingBoxes[label_i,0] : boundingBoxes[label_i,1]+1,
#boundingBoxes[label_i,2] : boundingBoxes[label_i,3]+1,
#greyIm_i = imGrey[boundingBoxes[label_i,0] : boundingBoxes[label_i,1]+1,
#boundingBoxes[label_i,2] : boundingBoxes[label_i,3]+1,
#boundingBoxes[label_i,4] : boundingBoxes[label_i,5]+1]
#Mask out the grey-level subset
#greyIm_i = greyIm_i * bwImOr
......@@ -1512,8 +1512,8 @@ def meanOrientation(orientations):
def convexVolume(lab, boundingBoxes=None, centresOfMass=None, volumes=None, numberOfThreads=1, verbose=True):
"""
This function compute the convex hull of each label of the labelled image and return a
list with the convex volume of each particle.
This function compute the convex hull of each label of the labelled image and return a
list with the convex volume of each particle.
Parameters
----------
......@@ -1663,7 +1663,7 @@ def moveLabels(lab, PhiField, returnStatus = None, boundingBoxes=None, centresOf
threshold : float, optional
Threshold to keep interpolated voxels in the binary image.
Default = 0.5
labelDilate : int, optional
Number of times label should be dilated/eroded before returning it.
If ``labelDilate > 0`` a dilated label is returned, while ``labelDilate < 0`` returns an eroded label.
......@@ -1676,7 +1676,7 @@ def moveLabels(lab, PhiField, returnStatus = None, boundingBoxes=None, centresOf
Returns
--------
labOut : 3D numpy array
New labelled image with the labels moved by the deformations established by the PhiField.
New labelled image with the labels moved by the deformations established by the PhiField.
"""
......@@ -1853,14 +1853,14 @@ def erodeLabels(lab, erosion=1, boundingBoxes=None, centresOfMass=None, numberOf
for i in range(0, numberOfLabels+1, 1):
PhiField[i] = numpy.eye(4)
# Use moveLabels
erodeImage = spam.label.moveLabels(lab,
PhiField,
boundingBoxes=boundingBoxes,
centresOfMass=centresOfMass,
margin=1,
PhiCOM=True,
threshold=0.5,
labelDilate=-erosion,
erodeImage = spam.label.moveLabels(lab,
PhiField,
boundingBoxes=boundingBoxes,
centresOfMass=centresOfMass,
margin=1,
PhiCOM=True,
threshold=0.5,
labelDilate=-erosion,
numberOfThreads=numberOfThreads)
return erodeImage
......
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