Serial#

openalea.plantscan3d.serial.complete_lines(mtg)[source]#

Propagate ‘_line’ property values upward to parent nodes that lack them.

Parameters:

mtg (openalea.mtg.MTG) – MTG object with a ‘_line’ property.

openalea.plantscan3d.serial.convertStdMTGWithNode(g, useHeuristic=True, invertCoord=False, propagate_parent=False)[source]#

Convert a standard MTG (with XX, YY, ZZ properties) to an MTG with a Vector3 ‘position’ property, handling interpolation and heuristics.

Parameters:
  • g (openalea.mtg.MTG) – Standard MTG object with XX, YY, ZZ scalar properties and ‘_line’.

  • useHeuristic (bool) – If True, use a heuristic to estimate positions for nodes that could not be otherwise positioned.

  • invertCoord (bool) – If True, negate the Z coordinate.

  • propagate_parent (bool) – If True, propagate parent positions when a node’s complex root has coordinates but the node itself does not.

Return type:

None. The MTG is modified in-place with a ‘position’ property.

openalea.plantscan3d.serial.convertToMyMTG(mtg)[source]#

Convert an MTG with XX, YY, ZZ properties back to a Vector3 ‘position’ property.

Parameters:

mtg (openalea.mtg.MTG) – MTG object with XX, YY, ZZ scalar properties.

Returns:

The same MTG with a ‘position’ property added and scalar properties removed.

Return type:

openalea.mtg.MTG

openalea.plantscan3d.serial.convertToStdMTG(g)[source]#

Convert an MTG with a ‘position’ property to separate XX, YY, ZZ properties.

Parameters:

g (openalea.mtg.MTG) – MTG object with a Vector3 ‘position’ property.

Returns:

New MTG with XX, YY, ZZ scalar properties instead of ‘position’.

Return type:

openalea.mtg.MTG

openalea.plantscan3d.serial.getpointset(fn)[source]#

Read a point set from a PlantGL scene file.

Parameters:

fn (str) – Path to the scene file.

Returns:

(pointList, translation) from the first shape in the scene.

Return type:

tuple

openalea.plantscan3d.serial.max_heigth(g, scale=None)[source]#

Compute the maximum height (depth) of the MTG.

Parameters:
  • g (openalea.mtg.MTG) – MTG object.

  • scale (int or None) – Scale to consider. If None, the maximum scale is used.

Returns:

Maximum number of successive nodes from root to leaf.

Return type:

int

openalea.plantscan3d.serial.max_order(g, scale=None)[source]#

Compute the maximum branching order of the MTG.

Parameters:
  • g (openalea.mtg.MTG) – MTG object.

  • scale (int or None) – Scale to consider. If None, the maximum scale is used.

Returns:

Maximum number of successive lateral branches (edge_type ‘+’) from root to leaf.

Return type:

int

openalea.plantscan3d.serial.quantisefunc(fn=None, qfunc=None)[source]#

Create a QuantisedFunction from a scene file or a function.

Parameters:
  • fn (str or None) – Path to a scene file.

  • qfunc (object or None) – A function object to quantise.

Returns:

Quantised version of the curve geometry.

Return type:

openalea.plantgl.codec.QuantisedFunction

openalea.plantscan3d.serial.readfile(fn, mode='rb')[source]#

Load a pickled object from a file.

Parameters:
  • fn (str) – Path to the file.

  • mode (str) – File open mode (default ‘rb’).

Returns:

Unpickled object.

Return type:

object

openalea.plantscan3d.serial.writeAscPoints(fn, points)[source]#

Write points to an ASCII PlantGL scene file.

Parameters:
  • fn (str) – Path to the output file.

  • points (list of Vector3) – Points to write.

openalea.plantscan3d.serial.writeMTGfile(fn, g, properties=[('XX', 'REAL'), ('YY', 'REAL'), ('ZZ', 'REAL'), ('radius', 'REAL')])[source]#

Write an MTG to an MTG file format.

Parameters:
  • fn (str) – Path to the output file.

  • g (openalea.mtg.MTG) – MTG object to write.

  • properties (list of tuple) – List of (property_name, type) pairs to include. Defaults to position and radius properties.

openalea.plantscan3d.serial.writeXYZ(fn, points)[source]#

Write points to a XYZ text file.

Parameters:
  • fn (str) – Path to the output file.

  • points (list of Vector3) – Points to write, one per line as “x y z”.

openalea.plantscan3d.serial.writefile(fn, obj)[source]#

Pickle an object to a file.

Parameters:
  • fn (str) – Path to the output file.

  • obj (object) – Object to pickle.