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

update resuirements and remove pygmsh

parent d247837c
Pipeline #62614 failed with stages
in 2 minutes and 9 seconds
coverage
sphinx>=2.0
sphinx-gallery>=0.1.13
sphinx_rtd_theme>=0.3.0
twine
pytest
# Pillow for osx version 5.0.1 is bugged
# it is used by sphinx
# Pillow==5.0.0
# last python2 supported version needed for pypi
rpy2==2.8.0
PyQt5==5.12.1
PyQt5-sip==4.19.15
qimage2ndarray==1.8
numpy==1.18.5
scipy==1.4.1
SimpleITK==1.2.4
# numpy==1.20.1 # Python >=3.7
numpy==1.19.5 # Python >=3.6
# This is now fully optional, removing from build system
# mpi4py==3.0.3
# scipy==1.6.1 # Python >=3.7
scipy==1.5.4 # Python >=3.6
# scikit-image==0.18.1 # Python >=3.7
scikit-image==0.17.2 # Python >=3.6
# tifffile==2021.3.16 # Python >=3.7
tifffile==2020.8.25 # Python >=3.6
matplotlib==3.3.4 # Python >=3.6
SimpleITK==2.0.2
pybind11==2.5.0
progressbar==2.5
pygmsh==5.0.2
meshio==2.3.10
gmsh==4.8.0 # not needed if you can install it with apt install python3-gmsh
meshio==4.3.11 # Python >=3.6
pybind11==2.6.2 # Python !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, >=2.7
# multigrid solver for random walker segmentation
pyamg==4.0.0
#numba==0.44.1
# This is for Jupyter:
# ipykernel
# ipython==5.8.0
############
# Optional #
############
# mpi
# mpi4py==3.0.3
# Last version for python3.5
tifffile==2019.7.26.2
matplotlib==3.0.3
scikit-image==0.15.0
# Jupyter
ipykernel==5.5.0 # Python >=3.5
# ipython==7.21.0 # Python >=3.7
ipython==7.16.1 # Python >=3.6
# R (correlated random field)
rpy2==3.4.2
#############
# Graphical #
#############
PyQt5==5.15.4 # Python >=3.6
PyQt5-sip==12.8.1 # Python >=3.5
qimage2ndarray==1.8.3
##############
# Developers #
##############
coverage==5.5 # Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4
sphinx==3.5.2 # Python >=3.5
sphinx-gallery==0.8.2 # Python >=3.5
sphinx_rtd_theme==0.5.1
twine==3.4.1 # Python >=3.6
pytest==3.6 # Python >=3.6
# Pillow for osx version 5.0.1 is bugged
# it is used by sphinx
# Pillow==5.0.0
......@@ -353,7 +353,6 @@ def writeUnstructuredVTK(points,
elementType='tetra',
pointData={},
cellData={},
fileFormat='vtk-binary',
fileName='spam.vtk'):
"""
Writes a binary VTK using ``meshio`` selecting only the tetrahedra.
......@@ -388,10 +387,6 @@ def writeUnstructuredVTK(points,
pointData = { 'field1name':field1,'field2name':field2 ...}
fileFormat : string
``meshio`` file_format option. Use ``vtk-ascii`` for clear text and ``vtk-binary`` for binary files.
Default=``vtk-binary``
fileName : string
Name of the output file.
Default='spam.vtk'
......@@ -427,9 +422,8 @@ def writeUnstructuredVTK(points,
meshio.write_points_cells(fileName,
points[:, ::-1],
{elementType: connectivity},
point_data=pointData,
cell_data={elementType: cellData},
file_format=fileFormat)
point_data=pointData if len(pointData) else None,
cell_data={k: [v] for k, v in cellData.items()} if len(cellData) else None)
def readUnstructuredVTK(fileName):
......@@ -471,12 +465,13 @@ def readUnstructuredVTK(fileName):
pointData = dict({})
# Make sure that any non-scalar fields are flipped so that z is in the right place in numpy
for key, value in six.iteritems(mesh.cell_data['tetra']):
# Inspect first item and make sure it's nut just a number
if isinstance(value[0], (list, tuple, numpy.ndarray)):
cellData[key] = value[:, ::-1]
else:
cellData[key] = value
for key, values in mesh.cell_data.items():
for value in values:
# Inspect first item and make sure it's nut just a number
if isinstance(value[0], (list, tuple, numpy.ndarray)):
cellData[key] = value[:, ::-1]
else:
cellData[key] = value
# Make sure that any non-scalar fields are flipped so that z is in the right place in numpy
for key, value in six.iteritems(mesh.point_data):
......@@ -486,7 +481,7 @@ def readUnstructuredVTK(fileName):
else:
pointData[key] = value
connectivity = mesh.cells['tetra']
connectivity = mesh.cells_dict['tetra']
# change node numbering in connectivity matrix
tmp = connectivity.copy()
connectivity[:, 1] = tmp[:, 3]
......@@ -531,13 +526,13 @@ def TIFFtoVTK(fileName, voxelSize=1.0):
# create VTK
f = os.path.splitext(fileName[0])[0]
if len(fileName) == 1:
meshio.write_points_cells(f + ".vtk", points, {"hexahedron": cells}, cell_data={"hexahedron": {"grey": im.T.ravel()}})
meshio.write_points_cells(f"{f}.vtk", points, {"hexahedron": cells}, cell_data={"grey": [im.T.ravel()]})
else:
writer = meshio.XdmfTimeSeriesWriter(f + ".xmf")
writer = meshio.XdmfTimeSeriesWriter(f"{f}.xmf")
writer.write_points_cells(points, {"hexahedron": cells})
for i, name in enumerate(fileName):
im = tifffile.imread(name)
writer.write_data(i, cell_data={"hexahedron": {"grey": im.T.ravel().astype("<f4")}})
writer.write_data(i, cell_data={"grey": [im.T.ravel()]})
#@jit(nopython=True)
......
......@@ -225,13 +225,13 @@ def surfaceArea(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0)):
level: float, default=0.0
The level set.
See ``skimage.measure.marching_cubes_lewiner``.
See ``skimage.measure.marching_cubes``.
Contour value to search for isosurfaces in volume.
If not given or None, the average of the min and max of vol is used.
aspectRatio: length 3 tuple of floats, default=(1.0, 1.0, 1.0)
Length between two nodes in every direction e.g. size of a cell.
It corresponds to ``spacing`` in ``skimage.measure.marching_cubes_lewiner``.
It corresponds to ``spacing`` in ``skimage.measure.marching_cubes``.
Returns
--------
......@@ -245,8 +245,8 @@ def surfaceArea(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0)):
margedField[:, :, :] = field.min()
margedField[3:-3, 3:-3, 3:-3] = field
# http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes_lewiner
verts, faces, _, _ = skimage.measure.marching_cubes_lewiner(margedField, level=level, spacing=aspectRatio)
# http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes
verts, faces, _, _ = skimage.measure.marching_cubes(margedField, level=level, spacing=aspectRatio)
return skimage.measure.mesh_surface_area(verts, faces)
......@@ -262,12 +262,12 @@ def surfaceArea(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0)):
# Array where some level sets represent the interface between phases.
# level: float, default=0.0
# The level set.
# See ``skimage.measure.marching_cubes_lewiner``.
# See ``skimage.measure.marching_cubes``.
# Contour value to search for isosurfaces in volume.
# If not given or None, the average of the min and max of vol is used.
# aspectRatio: length 3 tuple of floats, default=(1.0, 1.0, 1.0)
# Length between two nodes in every direction e.g. size of a cell.
# It corresponds to ``spacing`` in ``skimage.measure.marching_cubes_lewiner``.
# It corresponds to ``spacing`` in ``skimage.measure.marching_cubes``.
#
# Returns
# --------
......@@ -300,8 +300,8 @@ def surfaceArea(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0)):
# margedField[:, :, :] = field.min()
# margedField[3:-3, 3:-3, 3:-3] = field
#
# # http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes_lewiner
# verts, faces, _, _ = skimage.measure.marching_cubes_lewiner(margedField, level=level, spacing=aspectRatio)
# # http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes
# verts, faces, _, _ = skimage.measure.marching_cubes(margedField, level=level, spacing=aspectRatio)
#
# # compute curvature
#
......@@ -435,14 +435,14 @@ def totalCurvature(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0), stepSize=None,
level: float
The level set
See ``skimage.measure.marching_cubes_lewiner``.
See ``skimage.measure.marching_cubes``.
Contour value to search for isosurfaces in volume.
If None is given, the average of the min and max of vol is used
Default = 0.0
aspectRatio: length 3 tuple of floats
Length between two nodes in every direction `e.g.`, size of a cell.
It corresponds to ``spacing`` in ``skimage.measure.marching_cubes_lewiner``
It corresponds to ``spacing`` in ``skimage.measure.marching_cubes``
Default = (1.0, 1.0, 1.0)
step_size: int
......@@ -477,11 +477,11 @@ def totalCurvature(field, level=0.0, aspectRatio=(1.0, 1.0, 1.0), stepSize=None,
margedField[:, :, :] = field.min()
margedField[3:-3, 3:-3, 3:-3] = field
# http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes_lewiner
# http://scikit-image.org/docs/dev/api/skimage.measure.html?highlight=mesh_surface_area#skimage.measure.marching_cubes
if stepSize is not None:
verts, faces, _, _ = skimage.measure.marching_cubes_lewiner(margedField, level=level, spacing=aspectRatio, step_size=stepSize)
verts, faces, _, _ = skimage.measure.marching_cubes(margedField, level=level, spacing=aspectRatio, step_size=stepSize)
else:
verts, faces, _, _ = skimage.measure.marching_cubes_lewiner(margedField, level=level, spacing=aspectRatio)
verts, faces, _, _ = skimage.measure.marching_cubes(margedField, level=level, spacing=aspectRatio)
# call CPP function return gaussian curvature, mean curvature and areas
meanGaussArea = mtk.computeCurvatures(faces.astype('<u8').tolist(), verts.astype('<f8').tolist())
......@@ -604,7 +604,7 @@ def generic(segmented, n, phase=1, level=0.0, aspectRatio=(1.0, 1.0, 1.0), speci
level: float, default=0.0
The level set.
See ``skimage.measure.marching_cubes_lewiner``.
See ``skimage.measure.marching_cubes``.
Contour value to search for isosurfaces in volume.
If not given or None, the average of the min and max of vol is used.
......
......@@ -450,7 +450,7 @@ def projectField(mesh, fields, thresholds=[0.0], nSkip=1, writeConnectivity=None
import meshio
tmp = meshio.read(mesh)
points = tmp.points
cells = tmp.cells.get("tetra")
cells = tmp.cells_dict.get("tetra")
else:
points = mesh['points']
......
This diff is collapsed.
......@@ -92,8 +92,7 @@ class testAll(unittest.TestCase):
mesh = spam.datasets.loadUnstructuredMesh()
spam.helpers.writeUnstructuredVTK(mesh['points'], mesh['connectivity'],
pointData=mesh['pointData'],
cellData=mesh['cellData'],
fileFormat='vtk-binary')
cellData=mesh['cellData'])
readPoints, readConnectivity, readPointData, readCellData = spam.helpers.readUnstructuredVTK('./spam.vtk')
# check points
self.assertAlmostEqual(numpy.sum(readPoints - mesh['points']), 0, places=5)
......@@ -101,7 +100,6 @@ class testAll(unittest.TestCase):
self.assertAlmostEqual(numpy.sum(readConnectivity - mesh['connectivity']), 0, places=5)
# check point data
for a in mesh['pointData']:
print(a)
self.assertAlmostEqual(numpy.sum(readPointData[a] - mesh['pointData'][a]), 0, places=5)
# check cell data
for a in mesh['cellData']:
......@@ -136,8 +134,8 @@ class testAll(unittest.TestCase):
import tifffile
tifffile.imsave("./tmpsnow.tif", im)
spam.helpers.TIFFtoVTK("./tmpsnow.tif")
#VTK = spam.helpers.readStructuredVTK("tmpsnow.vtk")
#spam.helpers.TIFFtoVTK(["tmpsnow.tif", "tmpsnow.tif"])
# VTK = spam.helpers.readStructuredVTK("tmpsnow.vtk") # can't read binary
# spam.helpers.TIFFtoVTK(["tmpsnow.tif", "tmpsnow.tif"])
......
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