diff --git a/R-package/R/outer_procedure.r b/R-package/R/outer_procedure.r index da34f9eac64d62b8a2f843e49dee19417af731b7..8e789d53e342b451634743522a03faabd3134f5f 100644 --- a/R-package/R/outer_procedure.r +++ b/R-package/R/outer_procedure.r @@ -154,7 +154,6 @@ multi_Class_Sampling <- function(in.raster, new.acc <- list() decision = "0" ########################################################################## - while (decision == "0") { for (rs in 1:multiTest) { ######################## @@ -233,21 +232,50 @@ multi_Class_Sampling <- function(in.raster, new.names[[rs]] <- index new.acc[[rs]] <- acc if (rs == multiTest) { + if (plot_on_browser == TRUE) { + if (.Platform$OS.type == "unix") { + grDevices::x11() + } else { + grDevices::windows() + } + attach(mtcars) + if (multiTest < 4) { + par(mfrow = c(multiTest, 1)) + } else { + par(mfrow = c(round(multiTest/4), multiTest %% 4)) + } + } par(mar = c(2, 2, 2, 3), mfrow = n2mfrow(multiTest)) for (rr in 1:length(test)) { + if (plot_on_browser == FALSE) { + png(file = paste(outPath, 'multi_', rr, '.png', sep = ""), width = 600, height = 500, res = 72) + } plot( test[[rr]], col = col(200), main = "", legend.shrink = 1) mtext(side = 3, - paste(rr, classNames[new.names[[rr]]], sep = " "), + paste('Test ', rr, '- class ', classNames[new.names[[rr]]], sep = " "), font = 2) + if (plot_on_browser == FALSE) { + dev.off() + IRdisplay::display_png(file = paste(outPath, 'multi_', rr, '.png', sep = "")) + } } } } decision <- readline("Which distribution is acceptable or sample again (0) [.. or 0]: ") + if (plot_on_browser == FALSE) { + for (rr in 1:length(test)) { + fn <- paste(outPath, 'multi_', rr, '.png', sep = "") + if (file.exists(fn)) { + #Delete file if it exists + file.remove(fn) + } + } + } } maFo_rf <- maFo[[as.numeric(decision)]] index <- new.names[[as.numeric(decision)]]