diff --git a/docs/Spectral_data.md b/docs/Spectral_data.md index ac99f45bc..84aebfb0b 100644 --- a/docs/Spectral_data.md +++ b/docs/Spectral_data.md @@ -38,6 +38,10 @@ Attributes are accessed as spectral_data_instance.*attribute*. **filename**: The filename where the data originated from +**geo_transform**: The affine transformation matrix used to convert from an xy coordinate system to a georeferenced coordinate system. Default is the input list used by the affine package to create an identity matrix. + +**geo_crs**: The original coordinate system of a georeferenced image. Default is "None". + ### Example PlantCV functions from the hyperspectral sub-package use `Spectral_data` implicitly. diff --git a/plantcv/plantcv/classes.py b/plantcv/plantcv/classes.py index 76782610c..c955da368 100644 --- a/plantcv/plantcv/classes.py +++ b/plantcv/plantcv/classes.py @@ -298,7 +298,8 @@ class Spectral_data: """PlantCV Hyperspectral data class""" def __init__(self, array_data, max_wavelength, min_wavelength, max_value, min_value, d_type, wavelength_dict, - samples, lines, interleave, wavelength_units, array_type, pseudo_rgb, filename, default_bands): + samples, lines, interleave, wavelength_units, array_type, pseudo_rgb, filename, default_bands, + geo_transform=None, geo_crs=None): # The actual array/datacube self.array_data = array_data # Min/max available wavelengths (for spectral datacube) @@ -325,6 +326,13 @@ def __init__(self, array_data, max_wavelength, min_wavelength, max_value, min_va self.filename = filename # The default band indices needed to make an pseudo_rgb image, if not available then store None self.default_bands = default_bands + # The transformation matrix that converts xy coordinates to georeferenced coordinates + # Default is the input list for affine.Affine to make an identity matrix + self.geo_transform = geo_transform + if not geo_transform: + self.geo_transform = (1.0, 0.0, 0.0, 0.0, 1.0, 0.0) + # The coordinate system of a georeferenced image + self.geo_crs = geo_crs class PSII_data: