1.3.82
 
Loading...
Searching...
No Matches
LeafOptics Class Reference

Public Member Functions

 LeafOptics (helios::Context *a_context)
 Constructor.
 
void run (const std::vector< uint > &UUIDs, const LeafOpticsProperties &leafproperties, const std::string &label)
 Run the LeafOptics model to generate reflectivity and transmissivity spectra, create associated global data, and assign to specified primitives.
 
void run (const LeafOpticsProperties &leafproperties, const std::string &label)
 Run the LeafOptics model to generate reflectivity and transmissivity spectra and create associated global data.
 
void PROSPECT (float numberlayers, float Chlorophyllcontent, float carotenoidcontent, float anthocyancontent, float brownpigments, float watermass, float drymass, float protein, float carbonconstituents, std::vector< float > &reflectivities_fit, std::vector< float > &transmissivities_fit)
 LeafOptics model kernel.
 
void getLeafSpectra (const LeafOpticsProperties &leafproperties, std::vector< helios::vec2 > &reflectivities_fit, std::vector< helios::vec2 > &transmissivities_fit)
 Get the leaf spectra.
 
void setProperties (const std::vector< uint > &UUIDs, const LeafOpticsProperties &leafproperties)
 Set leaf optical properties for a set of primitives.
 
void getPropertiesFromSpectrum (const std::vector< uint > &UUIDs)
 Get PROSPECT parameters from reflectivity spectrum for a set of primitives.
 
void getPropertiesFromSpectrum (uint UUID)
 Get PROSPECT parameters from reflectivity spectrum for a single primitive.
 
void getPropertiesFromLibrary (const std::string &species, LeafOpticsProperties &leafproperties)
 Get leaf optical properties from the built-in species library.
 
void disableMessages ()
 Disable command-line output messages from this plug-in.
 
void enableMessages ()
 Enable command-line output messages from this plug-in.
 
void optionalOutputPrimitiveData (const char *label)
 Add optional primitive data output.
 
void run (const std::vector< uint > &UUIDs, const LeafOpticsProperties_Nauto &params)
 Run nitrogen-based leaf optics for the specified primitives.
 
void updateNitrogenBasedSpectra ()
 Update nitrogen-based spectra for currently tracked primitives.
 

Static Public Member Functions

static int selfTest (int argc=0, char **argv=nullptr)
 Self-test.
 

Detailed Description

Definition at line 123 of file LeafOptics.h.

Constructor & Destructor Documentation

◆ LeafOptics()

LeafOptics::LeafOptics ( helios::Context a_context)

Constructor.

Definition at line 20 of file LeafOptics.cpp.

Member Function Documentation

◆ disableMessages()

void LeafOptics::disableMessages ( )

Disable command-line output messages from this plug-in.

Definition at line 766 of file LeafOptics.cpp.

◆ enableMessages()

void LeafOptics::enableMessages ( )

Enable command-line output messages from this plug-in.

Definition at line 770 of file LeafOptics.cpp.

◆ getLeafSpectra()

void LeafOptics::getLeafSpectra ( const LeafOpticsProperties leafproperties,
std::vector< helios::vec2 > &  reflectivities_fit,
std::vector< helios::vec2 > &  transmissivities_fit 
)

Get the leaf spectra.

Parameters
[in]leafpropertiesLeafOptics properties.
[out]reflectivities_fitreflectivities of the leaf. Any existing contents are overwritten.
[out]transmissivities_fittransmissivities of the leaf. Any existing contents are overwritten.
Note
Throws a runtime error if numberlayers is less than 1 or if any constituent content is negative.

Definition at line 512 of file LeafOptics.cpp.

◆ getPropertiesFromLibrary()

void LeafOptics::getPropertiesFromLibrary ( const std::string &  species,
LeafOpticsProperties leafproperties 
)

Get leaf optical properties from the built-in species library.

Parameters
[in]speciesName of the species to retrieve properties for (e.g., "default"). Species names are case-insensitive.
[out]leafpropertiesLeafOpticsProperties struct to be populated with the species-specific properties. If the species is not found in the library, default properties are used and a warning is issued.

Definition at line 744 of file LeafOptics.cpp.

◆ getPropertiesFromSpectrum() [1/2]

void LeafOptics::getPropertiesFromSpectrum ( const std::vector< uint > &  UUIDs)

Get PROSPECT parameters from reflectivity spectrum for a set of primitives.

Parameters
[in]UUIDsUUIDs for primitives to query. For each primitive, this method retrieves the "reflectivity_spectrum" primitive data and checks if it matches a spectrum generated by this LeafOptics instance. If a match is found, the corresponding PROSPECT model parameters are assigned as primitive data using the same labels as setProperties() ("chlorophyll", "carotenoid", "anthocyanin", "brown", "water", "drymass", "protein", "cellulose"). Primitives without matching spectra are silently skipped.

Definition at line 687 of file LeafOptics.cpp.

◆ getPropertiesFromSpectrum() [2/2]

void LeafOptics::getPropertiesFromSpectrum ( uint  UUID)

Get PROSPECT parameters from reflectivity spectrum for a single primitive.

Parameters
[in]UUIDUUID for primitive to query. This method retrieves the "reflectivity_spectrum" primitive data and checks if it matches a spectrum generated by this LeafOptics instance. If a match is found, the corresponding PROSPECT model parameters are assigned as primitive data using the same labels as setProperties() ("chlorophyll", "carotenoid", "anthocyanin", "brown", "water", "drymass", "protein", "cellulose"). If no matching spectrum is found, the primitive is silently skipped.

Definition at line 740 of file LeafOptics.cpp.

◆ optionalOutputPrimitiveData()

void LeafOptics::optionalOutputPrimitiveData ( const char *  label)

Add optional primitive data output.

Parameters
[in]labelLabel of the primitive data to output. Available labels: "chlorophyll", "carotenoid", "anthocyanin", "brown", "water", "drymass", "protein", "cellulose".

Definition at line 774 of file LeafOptics.cpp.

◆ PROSPECT()

void LeafOptics::PROSPECT ( float  numberlayers,
float  Chlorophyllcontent,
float  carotenoidcontent,
float  anthocyancontent,
float  brownpigments,
float  watermass,
float  drymass,
float  protein,
float  carbonconstituents,
std::vector< float > &  reflectivities_fit,
std::vector< float > &  transmissivities_fit 
)

LeafOptics model kernel.

Parameters
[in]numberlayersnumber of layers in the leaf
[in]Chlorophyllcontentchlorophyll content in the leaf
[in]carotenoidcontentcarotenoid content in the leaf
[in]anthocyancontentanthocyan content in the leaf
[in]brownpigmentsbrown pigment content in the leaf
[in]watermasswater mass in the leaf
[in]drymassdry mass in the leaf
[in]proteinprotein content in the leaf
[in]carbonconstituentscarbon constituents in the leaf
[out]reflectivities_fitreflectivities of the leaf at each of the 2101 wavelengths. Any existing contents are overwritten.
[out]transmissivities_fittransmissivities of the leaf at each of the 2101 wavelengths. Any existing contents are overwritten.

Definition at line 389 of file LeafOptics.cpp.

◆ run() [1/3]

void LeafOptics::run ( const LeafOpticsProperties leafproperties,
const std::string &  label 
)

Run the LeafOptics model to generate reflectivity and transmissivity spectra and create associated global data.

Parameters
[in]leafpropertiesLeafOptics properties.
[in]labellabel of spectra that will be created. This label will be appended to "leaf_reflectivity_" and "leaf_transmissivity_" (e.g., "leaf_reflectivity_bean" if the label is "bean").

Definition at line 362 of file LeafOptics.cpp.

◆ run() [2/3]

void LeafOptics::run ( const std::vector< uint > &  UUIDs,
const LeafOpticsProperties leafproperties,
const std::string &  label 
)

Run the LeafOptics model to generate reflectivity and transmissivity spectra, create associated global data, and assign to specified primitives.

Parameters
[in]UUIDsUUIDs for primitives that will be assigned the generated reflectivity and transmissivity spectra.
[in]leafpropertiesLeafOptics properties.
[in]labellabel of spectra that will be created. This label will be appended to "leaf_reflectivity_" and "leaf_transmissivity_" (e.g., "leaf_reflectivity_bean" if the label is "bean").

Definition at line 320 of file LeafOptics.cpp.

◆ run() [3/3]

void LeafOptics::run ( const std::vector< uint > &  UUIDs,
const LeafOpticsProperties_Nauto params 
)

Run nitrogen-based leaf optics for the specified primitives.

Computes leaf optical properties based on nitrogen content. Groups primitives by parent object, reads "leaf_nitrogen_gN_m2" from each object, and assigns spectra accordingly.

Behavior depends on call sequence:

  • First call: Creates adaptive spectrum bins based on nitrogen distribution, generates PROSPECT spectra for each bin, assigns primitives to bins.
  • Subsequent calls: New primitives assigned to nearest existing bin, removed primitives untracked, existing primitives checked for nitrogen changes and reassigned if threshold exceeded.

All primitives belonging to the same parent object receive the same spectrum.

Parameters
[in]UUIDsPrimitive UUIDs of leaf surfaces
[in]paramsNitrogen-auto parameters specifying conversion coefficients, fixed PROSPECT values, and binning configuration
Note
Requires "leaf_nitrogen_gN_m2" object data to be set on each leaf object (typically by PlantArchitecture::NitrogenModel)

Definition at line 998 of file LeafOptics.cpp.

◆ selfTest()

int LeafOptics::selfTest ( int  argc = 0,
char **  argv = nullptr 
)
static

Self-test.

Returns
0 if test was successful, 1 if test failed

Definition at line 1929 of file selfTest.cpp.

◆ setProperties()

void LeafOptics::setProperties ( const std::vector< uint > &  UUIDs,
const LeafOpticsProperties leafproperties 
)

Set leaf optical properties for a set of primitives.

Parameters
[in]UUIDsUUIDs for primitives for which optical properties should be set.
[in]leafpropertiesLeafOptics properties.

Definition at line 665 of file LeafOptics.cpp.

◆ updateNitrogenBasedSpectra()

void LeafOptics::updateNitrogenBasedSpectra ( )

Update nitrogen-based spectra for currently tracked primitives.

Efficient update method for when nitrogen values have changed but the primitive set is unchanged. Re-reads nitrogen from parent objects and reassigns primitives if the change exceeds configured thresholds.

This is equivalent to calling run() with the same UUIDs but faster since it skips primitive grouping and add/remove processing.

Note
Nitrogen mode must be active (run() called with LeafOpticsProperties_Nauto)

Definition at line 1161 of file LeafOptics.cpp.


The documentation for this class was generated from the following files: