Skip to content

Commit

Permalink
fixes to file_io and mesh browser
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Jun 20, 2023
1 parent 2d245b3 commit dba6d01
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 61 deletions.
43 changes: 0 additions & 43 deletions docs/changes.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,11 @@
## Main changes

- Rename module `io.py` to `file_io.py` to avoid override stlib io.
- Complete revision of cutter widgets funcionatlity
- Integration in napari thanks to @jo-mueller


### Breaking changes
- method `plotter.add()` no more accepts keyword `render=True/False`. Please use `plotter.add().render()` explicitly. Same thing for `plotter.remove()`.

### Other fixes and improvements
- added gpu acceleration for CLI volumetric visualization in #832 by @zhang-qiang-github
- fixes for `k3d` jupyter backend
- added `plotter.fov(value)` (field of view, the so called "fish-eye" effect)
- fix `ploter.get_meshes()`
- fix for `plotter.remove(unpack_assemblies=False)` method
- fix for `io.import_window()` method
- added `cut_with_cookiecutter()` to cut 2D contours.
- fix `shapes.NormalLines()` class
- added `vedo.interactor_modes` module
- added `vedo.interactor_modes.BlenderStyle` class
- added `base.pointdata.clear()` to remove all associated data
- added `volume.hide_voxels()` for visualization
- added `Event.timerid` attribute
- fix to `Volume.operation` by @DanKrsi
- fix links in `pyplot` examples by @androbaza
- fix `screenshot_scale` and remove it from settings.
- allow initializing `ScalarBar` with a tuple range `(min, max)`
- Update API Documentation for Changing Backend by @bhacha
- Add `application.Browser().play()` to autoplay a slider
- Add `pad()` to padding a Volume with zeros voxels (useful to `dilate()`)
- Add `ProgressBarWidget()` to show a progress bar in the rendering window
- Fix Scalarbar3D logscale and change separator symbol by @XushanLu
- Fix `vedo/interactor_modes.mouse_left_move()` by @MiticoDan
- Added `applications.AnimationPlayer` class by @mikaeltulldahl
- fix convex hull in 2D by @ManuGraiph


-------------------------
## New/Revised Examples
```
examples/basic/sliders_range.py
examples/basic/interaction_modes.py
examples/advanced/timer_callback3.py
examples/advanced/warp6.py
examples/pyplot/histo_1d_e.py
examples/other/tensor_grid2.py
examples/simulations/airplane1.py
examples/simulations/lorenz.py
examples/simulations/gas.py
examples/simulations/aspring2_player.py
```

### Broken Examples
Expand Down
14 changes: 7 additions & 7 deletions examples/notebooks/align1.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/notebooks/slider2d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "716726825db64bcaa5bafc8cc7e1724b",
"model_id": "e9c49f3446564b878da7b61202e6ecaf",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -23,7 +23,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1f0d759367104490968f688f3fba6fe2",
"model_id": "cae768630c2547f68a5ed31f5717b44c",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -37,7 +37,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "05ec1be35400418582e8e22aff3ba330",
"model_id": "ea344652cf2247369609f6b6ad98de33",
"version_major": 2,
"version_minor": 0
},
Expand Down
3 changes: 3 additions & 0 deletions vedo/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ def __init__(
"""
Plotter.__init__(self, axes=axes, **kwargs)

if isinstance(objects, str):
objects = vedo.file_io.load(objects)

self += objects

self.slider = None
Expand Down
4 changes: 4 additions & 0 deletions vedo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2042,6 +2042,10 @@ def color(self, col, alpha=None, vmin=None, vmax=None):
force the max of the scalar range to be this value
"""
# supersedes method in Points, Mesh

if col is None:
return self

if vmin is None:
vmin, _ = self._data.GetScalarRange()
if vmax is None:
Expand Down
8 changes: 4 additions & 4 deletions vedo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_parser():
pr.add_argument("-bg2", "--background-grad", help="use background color gradient", default='', metavar='')
pr.add_argument("-z", "--zoom", type=float, help="zooming factor", default=1, metavar='')
pr.add_argument("-n", "--multirenderer-mode", help="multi renderer mode: files go to separate renderers", action="store_true")
pr.add_argument("-s", "--scrolling-mode", help="scrolling Mode: use slider to scroll files", action="store_true")
pr.add_argument("-s", "--sequence-mode", help="sequence mode: use slider to browse files", action="store_true")
pr.add_argument("-g", "--ray-cast-mode", help="GPU Ray-casting Mode for 3D image files", action="store_true")
pr.add_argument("-gx", "--x-spacing", type=float, help="volume x-spacing factor [1]", default=1, metavar='')
pr.add_argument("-gy", "--y-spacing", type=float, help="volume y-spacing factor [1]", default=1, metavar='')
Expand Down Expand Up @@ -683,7 +683,7 @@ def draw_scene(args):
applications.Browser(frames).show(bg=args.background, bg2=args.background_grad)
return ##########################################################

if args.scrolling_mode:
if args.sequence_mode:
args.multirenderer_mode = False
settings.default_font = args.font

Expand Down Expand Up @@ -832,7 +832,7 @@ def draw_scene(args):

########################################################################
# NORMAL mode for single or multiple files, or multiren mode, or numpy scene
elif nfiles == 1 or (not args.scrolling_mode):
elif nfiles == 1 or (not args.sequence_mode):
# print('DEBUG NORMAL mode for single or multiple files, or multiren mode')

interactor_mode = 0
Expand Down Expand Up @@ -918,7 +918,7 @@ def draw_scene(args):
return

########################################################################
# scrolling mode -s
# sequence mode -s
else:
# print("DEBUG simple browser mode -s")
if plt.axes == 4:
Expand Down
3 changes: 2 additions & 1 deletion vedo/file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def load(inputobj, unpack=True, force=False):
elif isinstance(inputobj, str) and inputobj.startswith("https://"):
flist = [inputobj]
else:
flist = sorted(glob.glob(inputobj))
# flist = sorted(glob.glob(inputobj))
flist = utils.humansort(glob.glob(inputobj))

for fod in flist:

Expand Down
3 changes: 2 additions & 1 deletion vedo/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3894,7 +3894,8 @@ def _keypress(self, iren, event):
except:
pass
self.axes_instances[clickedr] = None
addons.add_global_axes(axtype=asso[key], c=None)
bounds = renderer.ComputeVisiblePropBounds()
addons.add_global_axes(axtype=asso[key], c=None, bounds=bounds)
self.interactor.Render()

if key == "O":
Expand Down
2 changes: 1 addition & 1 deletion vedo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
_version = '2023.4.5'
_version = '2023.4.5+dev1'
2 changes: 1 addition & 1 deletion vedo/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def pad(self, voxels=10, value=0):
Example:
```python
from vedo import Volume, dataurl
from vedo import Volume, dataurl, show
iso = Volume(dataurl+'embryo.tif').isosurface()
vol = iso.binarize(spacing=(100, 100, 100)).pad(10)
vol.dilate([15,15,15])
Expand Down

0 comments on commit dba6d01

Please sign in to comment.