File: C:/xampp/htdocs/FograCT1/appi1MxNoUi.R
# Import Libraries ----
library(shiny)
library(colorSpec)
file_path <- "output.txt"
data <- scan("data.txt", what = character(), sep = " ")
dataSp <- unlist(strsplit(data, "\t"))
numeric_data <- as.numeric(dataSp)
D50data <- scan("D50data.txt", what = character(), sep = " ")
D50dataSp <- unlist(strsplit(D50data, "\t"))
D50numeric_data <- as.numeric(D50dataSp)
# Reactive expression to get the custom wavelengths
getCustomWl <- function(){
seq(380,
730,
10)
}
# Reactive expression to get the current wavelengths that should be used
getCurrentWl <- function(){
getCustomWl()
}
# Reactive expression to get the SSI for test/ref spectra
getSSI <- function(){
computeSSI(
getTestSpecX2(),
getRefSpecX2()
)
}
getTestSpecX2 <-function(){
colorSpec(numeric_data,
wavelength = getCurrentWl(),
organization = 'matrix')
}
getRefSpecX2 <- function(){
colorSpec(D50numeric_data,
wavelength = getCurrentWl(),
organization = 'matrix')
}
outputSSIText <- function(){
ssi <- getSSI()
write(ssi[[1]], file = file_path)
}
outputSSIText()