Skip to contents
library(HSItools)
#> Warning: replacing previous import 'DT::dataTableOutput' by
#> 'shiny::dataTableOutput' when loading 'HSItools'
#> Warning: replacing previous import 'DT::renderDataTable' by
#> 'shiny::renderDataTable' when loading 'HSItools'

Initial setup

Hyperspectral data gets quite large. It is a good practice to process data stored on an SSD drive separate from the Operating System (OS). While data is stored on a separate drive, it is beneficial to instruct terra to store temporary data on a separate drive. Adjust this according to your OS. Here, we are using a non-system drive on Windows 11.

# Set tempdir
terra::terraOptions(tempdir = "D:/")
#> Warning: [options] you cannot set the tempdir to a path that does not exist

# Check it
terra::terraOptions()
#> memfrac   : 0.6
#> tolerance : 0.1
#> verbose   : FALSE
#> todisk    : FALSE
#> tempdir   : /tmp/RtmpYccphd
#> datatype  : FLT4S
#> memmin    : 1
#> progress  : 3

Run graphical interface

Due to the spatial nature of hyperspectral imaging, some choices, such as selecting the regions of interest (ROI), need to be made using the graphical user interface.

Let’s call the Shiny app and store the output as a core object in the environment.

core <- run_core()

Normalize or use REFLECTANCE

With Specim (Specim Spectral Imaging LTD.) and different generations of the available software, you can run the normalization procedure on your own or use the on-the-fly reflectance file produced by the newer software iterations. Shiny app provides this choice. The main difference is the first selection in the Shiny app.

Remember that if your data comprises dark and white references and captured data, you can use this workflow for other data types.

Normalization path

REFLECTANCE path