Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion PYME/experimental/_octree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cimport numpy as np
import numpy as np
cimport cython

from PYME.IO.MetaDataHandler import DictMDHandler

#size to initialize the storage to
INITIAL_NODES = 1000
NODE_DTYPE = [('depth', 'i4'), ('n_children', 'i4'), ('children', '8i4'),('parent', 'i4'), ('nPoints', 'i4'), ('centre', '3f4'), ('centroid', '3f4'),('point_idx', 'i4')]
Expand Down Expand Up @@ -101,6 +103,7 @@ cdef class Octree:
cdef node_d * _cnodes
cdef object _octant_offsets
cdef object _octant_sign
cdef public object mdh

cdef np.float32_t[50] _scale

Expand Down Expand Up @@ -132,11 +135,14 @@ cdef class Octree:

self._octant_sign = np.array([[2*(n&1) - 1, (n&2) -1, (n&4)/2 -1] for n in range(8)])

self.mdh = DictMDHandler()
self.mdh['Octree.BoundingBox'] = self._bounds
self.mdh['Octree.MaxDepth'] = self._maxdepth
self.mdh['Octree.SamplesPerNode'] = self._samples_per_node

#precalculate scaling factors for locating the centre of the next box down.
for n in range(50):
self._scale[n] = 1.0/(2.0**(n + 1))


def truncate_at_n_points(self, n_points=5):
out = Octree(self._bounds, self._maxdepth, samples_per_node=n_points)
Expand Down
2 changes: 2 additions & 0 deletions PYME/experimental/_triangle_mesh.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ cdef class TriangleMesh(TrianglesBase):
cdef object _K
cdef public object smooth_curvature

cdef public object mdh

cdef _set_chalfedges(self, np.ndarray)#halfedge_t[:])
cdef _set_cfaces(self, np.ndarray)#face_d[:])
cdef _set_cvertices(self, np.ndarray)#vertex_d[:])
Expand Down
7 changes: 7 additions & 0 deletions PYME/experimental/_triangle_mesh.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
import copy

from PYME.experimental import triangle_mesh_utils
from PYME.IO.MetaDataHandler import DictMDHandler

DEF MAX_VERTEX_COUNT = 2**31

Expand Down Expand Up @@ -255,6 +256,12 @@ cdef class TriangleMesh(TrianglesBase):

self._components_valid = 0

# Set up metadata
self.mdh = DictMDHandler()
self.mdh['TriangleMesh.Manifold'] = self.manifold
self.mdh['TriangleMesh.BoundingBox'] = self.bbox
self.mdh['TriangleMesh.SmoothCurvature'] = self.smooth_curvature

# Set fix_boundary, etc.
for key, value in kwargs.items():
setattr(self, key, value)
Expand Down
2 changes: 2 additions & 0 deletions PYME/recipes/pointcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def execute(self, namespace):

ot = gen_octree_from_points(inp, min_pixel_size=self.minimum_pixel_size, max_depth=self.max_depth, samples_per_node=self.samples_per_node)

ot.mdh['Octree.MinimumPixelSize'] = self.minimum_pixel_size

namespace[self.output_octree] = ot


Expand Down
6 changes: 6 additions & 0 deletions PYME/recipes/surface_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def execute(self, namespace):
if self.cull_inner_surfaces:
surf.remove_inner_surfaces()

surf.mdh['DualMarchingCubes.ThresholdDensity'] = self.threshold_density
surf.mdh['DualMarchingCubes.NPointsMin'] = self.n_points_min
surf.mdh['DualMarchingCubes.Repair'] = self.repair
surf.mdh['DualMarchingCubes.Remesh'] = self.remesh
surf.mdh['DualMarchingCubes.CullInnerSurfaces'] = self.cull_inner_surfaces

namespace[self.output] = surf

@register_module('Isosurface')
Expand Down