Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ttk
spam
Commits
1233f230
Commit
1233f230
authored
Mar 23, 2021
by
Emmanuel Roubin
Browse files
Fix time series writer (tiff->vtk)
parent
44f3a2bc
Pipeline
#63159
canceled with stages
in 13 minutes and 40 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
install.bash
View file @
1233f230
...
...
@@ -20,7 +20,8 @@ fi
if
[
"
$1
"
==
"coverage"
]
then
python setup.py
install
coverage run setup.py
test
coverage run
-m
pytest
coverage combine
&&
coverage report
coverage html
fi
...
...
requirements-3.6.txt
deleted
100644 → 0
View file @
44f3a2bc
# If you're changing this, consider relaunching:
# https://gricad-gitlab.univ-grenoble-alpes.fr/ttk/docker-ttk/-/pipelines
numpy==1.19.5 # Python >=3.6
scipy==1.5.4 # Python >=3.6
scikit-image==0.17.2 # Python >=3.6
tifffile==2020.8.25 # Python >=3.6
matplotlib==3.3.4 # Python >=3.6
SimpleITK==2.0.2
progressbar==2.5
gmsh==4.8.0
meshio==4.3.11 # Python >=3.6
# Anything later than this causes an abort at the end of sphinx 3.5.2 build
pybind11==2.5.0 # Python !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, >=2.7
# multigrid solver for random walker segmentation
pyamg==4.0.0
############
# Optional #
############
# mpi
# mpi4py==3.0.3
# Jupyter
#ipykernel==5.5.0 # Python >=3.5
ipython==7.16.1 # Python >=3.6
# R (correlated random field)
rpy2==3.2.2
#############
# Graphical #
#############
#PyQt5==5.15.4 # Python >=3.6
#PyQt5-sip==12.8.1 # Python >=3.5
#qimage2ndarray==1.8.3
requirements-3.7.txt
View file @
1233f230
...
...
@@ -17,6 +17,7 @@ progressbar==2.5
gmsh==4.8.0
meshio==4.3.11 # Python >=3.6
h5py==3.2.1 # Python >=3.7
# Anything later than this causes an abort at the end of sphinx 3.5.2 build
pybind11==2.5.0 # Python !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, >=2.7
...
...
requirements.txt
View file @
1233f230
...
...
@@ -17,6 +17,7 @@ progressbar==2.5
gmsh
==4.8.0
meshio
==4.3.11 # Python >=3.6
h5py
==3.1.0 # Python >=3.6
# Anything later than this causes an abort at the end of sphinx 3.5.2 build
pybind11
==2.5.0 # Python !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, >=2.7
...
...
tools/helpers/vtkio.py
View file @
1233f230
...
...
@@ -528,8 +528,8 @@ def TIFFtoVTK(fileName, voxelSize=1.0):
if
len
(
fileName
)
==
1
:
meshio
.
write_points_cells
(
f
"
{
f
}
.vtk"
,
points
,
{
"hexahedron"
:
cells
},
cell_data
=
{
"grey"
:
[
im
.
T
.
ravel
()]})
else
:
w
r
it
er
=
meshio
.
X
dmfTimeSeriesWriter
(
f
"
{
f
}
.xmf"
)
writer
.
write_points_cells
(
points
,
{
"hexahedron"
:
cells
}
)
wit
h
meshio
.
x
dmf
.
TimeSeriesWriter
(
f
"
{
f
}
.xmf"
)
as
writer
:
writer
.
write_points_cells
(
points
,
[(
"hexahedron"
,
cells
)]
)
for
i
,
name
in
enumerate
(
fileName
):
im
=
tifffile
.
imread
(
name
)
writer
.
write_data
(
i
,
cell_data
=
{
"grey"
:
[
im
.
T
.
ravel
()]})
...
...
tools/tests/test_vtkio.py
View file @
1233f230
# -*- coding: utf-8 -*-
from
__future__
import
print_function
import
unittest
import
numpy
import
os
...
...
@@ -15,11 +13,12 @@ class testAll(unittest.TestCase):
try
:
# pass
os
.
remove
(
"./spam.vtk"
)
os
.
remove
(
"./tmpsnow.tif"
)
os
.
remove
(
"./tmpsnow.vtk"
)
#os.remove("tools/data/snow/snow.vtk")
#os.remove("tools/data/snow/snow.h5")
#os.remove("tools/data/snow/snow.xmf")
os
.
remove
(
"./snow-1.tif"
)
os
.
remove
(
"./snow-2.tif"
)
os
.
remove
(
"./snow-3.tif"
)
os
.
remove
(
"./snow-1.vtk"
)
os
.
remove
(
"./snow-1.h5"
)
os
.
remove
(
"./snow-1.xmf"
)
except
OSError
:
pass
...
...
@@ -64,6 +63,10 @@ class testAll(unittest.TestCase):
tensor
=
numpy
.
random
.
rand
(
4
,
5
,
6
,
3
,
3
)
spam
.
helpers
.
writeStructuredVTK
(
pointData
=
{
'c'
:
tensor
})
# write field with wrong format
dummy
=
numpy
.
random
.
rand
(
4
,
5
,
6
,
3
,
2
)
spam
.
helpers
.
writeStructuredVTK
(
pointData
=
{
'd'
:
dummy
})
# write 2 point and 2 cell
cellScalars
=
numpy
.
random
.
rand
(
4
,
5
,
6
)
cellVectors
=
numpy
.
random
.
rand
(
4
,
5
,
6
,
3
)
...
...
@@ -129,13 +132,19 @@ class testAll(unittest.TestCase):
spam
.
helpers
.
writeGlyphsVTK
(
coordinates
,
pointData
)
def
test_TIFFtoVTK
(
self
):
im
=
spam
.
datasets
.
loadSnow
()[
0
:
20
,
0
:
20
,
0
:
20
]
# Make it smaller because this takes a long time
im1
=
spam
.
datasets
.
loadSnow
()[
0
:
20
,
0
:
20
,
0
:
20
]
im2
=
spam
.
datasets
.
loadSnow
()[
0
:
20
,
0
:
20
,
2
:
22
]
im3
=
spam
.
datasets
.
loadSnow
()[
0
:
20
,
0
:
20
,
4
:
24
]
import
tifffile
tifffile
.
imsave
(
"./tmpsnow.tif"
,
im
)
spam
.
helpers
.
TIFFtoVTK
(
"./tmpsnow.tif"
)
tifffile
.
imsave
(
"./snow-1.tif"
,
im1
)
tifffile
.
imsave
(
"./snow-2.tif"
,
im2
)
tifffile
.
imsave
(
"./snow-3.tif"
,
im3
)
spam
.
helpers
.
TIFFtoVTK
(
"./snow-1.tif"
)
# VTK = spam.helpers.readStructuredVTK("tmpsnow.vtk") # can't read binary
#
spam.helpers.TIFFtoVTK(["
tmp
snow.tif", "
tmp
snow.tif"])
spam
.
helpers
.
TIFFtoVTK
([
"snow
-1
.tif"
,
"
snow-2.tif"
,
"
snow
-3
.tif"
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment