miblab-plot 0.0.6__tar.gz → 0.0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {miblab_plot-0.0.6/src/miblab_plot.egg-info → miblab_plot-0.0.8}/PKG-INFO +1 -1
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/pyproject.toml +1 -1
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/pvplot.py +27 -11
- {miblab_plot-0.0.6 → miblab_plot-0.0.8/src/miblab_plot.egg-info}/PKG-INFO +1 -1
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/LICENSE +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/README.md +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/setup.cfg +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/__init__.py +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/gui.py +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/image_3d.py +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/movie.py +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot/mp4.py +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot.egg-info/SOURCES.txt +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot.egg-info/dependency_links.txt +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot.egg-info/requires.txt +0 -0
- {miblab_plot-0.0.6 → miblab_plot-0.0.8}/src/miblab_plot.egg-info/top_level.txt +0 -0
|
@@ -18,11 +18,7 @@ def setup_rendering_env():
|
|
|
18
18
|
|
|
19
19
|
current_os = platform.system().lower()
|
|
20
20
|
if current_os == "linux":
|
|
21
|
-
|
|
22
|
-
# 1. Prefer OSMesa for headless Linux (avoids the Xvfb requirement)
|
|
23
|
-
# This tells PyVista to use the software-based buffer provided by the Mesa module
|
|
24
|
-
if hasattr(pv, 'set_jupyter_backend'):
|
|
25
|
-
pv.set_jupyter_backend('static')
|
|
21
|
+
|
|
26
22
|
|
|
27
23
|
# 2. Environment variables to bypass X11 requirements
|
|
28
24
|
os.environ['QT_QPA_PLATFORM'] = 'offscreen'
|
|
@@ -139,10 +135,20 @@ def rotating_masks_grid(
|
|
|
139
135
|
plotter.subplot(row, col)
|
|
140
136
|
if labels is not None:
|
|
141
137
|
plotter.add_text(str(labels[col, row]), font_size=6, color='black')
|
|
142
|
-
|
|
143
|
-
plotter.add_mesh(surf, color='lightblue', smooth_shading=True)
|
|
144
|
-
plotter.camera_position = [pos, center, (0, 0, 1)] # Simple Up-vector
|
|
145
138
|
|
|
139
|
+
# Catch empty masks
|
|
140
|
+
if surf.n_points > 0:
|
|
141
|
+
# Only calculate camera and add mesh if points exist
|
|
142
|
+
distance = surf.length * 2.5
|
|
143
|
+
center = list(surf.center)
|
|
144
|
+
pos = center + distance * np.array(vec)
|
|
145
|
+
|
|
146
|
+
plotter.add_mesh(surf, color='lightblue', smooth_shading=True)
|
|
147
|
+
plotter.camera_position = [pos, center, (0, 0, 1)]
|
|
148
|
+
else:
|
|
149
|
+
# Optional: Add placeholder text so you know it was empty
|
|
150
|
+
plotter.add_text("Empty Mask", font_size=5, color='gray')
|
|
151
|
+
|
|
146
152
|
# 4. Save and Destroy
|
|
147
153
|
# This is where the RAM resets to zero for the next angle
|
|
148
154
|
file = os.path.join(dir_output, f"mosaic_{i:03d}.png")
|
|
@@ -232,10 +238,20 @@ def multiple_mosaic_masks_da(masks: list, directions: dict, labels, columns=None
|
|
|
232
238
|
plotter.subplot(row, col)
|
|
233
239
|
if labels is not None:
|
|
234
240
|
plotter.add_text(labels[i], font_size=6, color='black')
|
|
235
|
-
|
|
236
|
-
plotter.add_mesh(surf, color='lightblue', smooth_shading=True)
|
|
237
|
-
plotter.camera_position = [pos, center, up]
|
|
238
241
|
|
|
242
|
+
# Catch empty masks
|
|
243
|
+
if surf.n_points > 0:
|
|
244
|
+
# Only calculate camera and add mesh if points exist
|
|
245
|
+
distance = surf.length * 2.5
|
|
246
|
+
center = list(surf.center)
|
|
247
|
+
pos = center + distance * np.array(vec)
|
|
248
|
+
|
|
249
|
+
plotter.add_mesh(surf, color='lightblue', smooth_shading=True)
|
|
250
|
+
plotter.camera_position = [pos, center, up]
|
|
251
|
+
else:
|
|
252
|
+
# Optional: Add placeholder text so you know it was empty
|
|
253
|
+
plotter.add_text("Empty Mask", font_size=5, color='gray')
|
|
254
|
+
|
|
239
255
|
# 1. Initialize the window in the background
|
|
240
256
|
plotter.show(auto_close=False, interactive=False, interactive_update=True)
|
|
241
257
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|