Skip to content

Commit 3b4a6ff

Browse files
committed
bump to version 1.0.1 (new parameter max_images for dashboard)
1 parent c472a6c commit 3b4a6ff

6 files changed

Lines changed: 46 additions & 10 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: imagefluency
22
Type: Package
33
Title: Image Statistics Based on Processing Fluency
4-
Version: 1.0.0
4+
Version: 1.0.1
55
Authors@R: person(given = "Stefan", family = "Mayer", email = "stefan@mayer-de.com",
66
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0034-7090"))
77
Description: Get image statistics based on processing fluency theory. The

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# imagefluency
22

3+
# imagefluency 1.0.1
4+
5+
* `run_imagefluency()` gains a `max_images` parameter to control the maximum number of images that can be uploaded in the Shiny app (default: 100).
6+
37
# imagefluency 1.0.0
48

59
* redesigned the Shiny dashboard with multi-image upload, integrated

R/imagefluencyApp.R

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
#' @include utils.R
22
NULL
33

4-
#' Run imagefluency app
4+
#' Interactive dashboard for \code{imagefluency}
55
#'
6-
#' Launches a Shiny app that shows a demo of what can be done with
7-
#' the \code{imagefluency} package.
6+
#' Launches a dashboard to interactively use the functions of the
7+
#' \code{imagefluency} package. The dashboard is built using the \code{shiny}
8+
#' package and provides a user-friendly interface for uploading images,
9+
#' analyzing them, and exporting the results. The dashboard supports
10+
#' multi-image uploads and side-by-side comparisons of image fluency scores.
11+
#'
12+
#' @param max_images Integer. Maximum number of images that can be uploaded.
13+
#' Defaults to 100.
814
#'
915
#' @export
1016
#'
@@ -13,14 +19,23 @@ NULL
1319
#' ## Only run this example in interactive R sessions
1420
#' if (interactive()) {
1521
#' run_imagefluency()
22+
#'
23+
#' # increase the maximum number of uploadable images to 150
24+
#' run_imagefluency(max_images = 150)
1625
#' }
17-
run_imagefluency <- function() {
26+
run_imagefluency <- function(max_images = 100) {
1827
appDir <- system.file("imagefluencyApp", package = "imagefluency")
1928
if (appDir == "") {
2029
stop("Could not find shiny app directory. Try re-installing `imagefluency`.", call. = FALSE)
2130
}
2231

32+
if (!is.numeric(max_images) || max_images < 1) {
33+
stop("`max_images` must be a positive number.", call. = FALSE)
34+
}
35+
2336
if (requireNamespace("shiny", quietly = TRUE)) {
37+
options(imagefluency.max_images = as.integer(max_images))
38+
on.exit(options(imagefluency.max_images = NULL), add = TRUE)
2439
shiny::runApp(appDir, display.mode = "normal")
2540
} else {
2641
stop("Package 'shiny' is required but not installed on your system.", call. = FALSE)

inst/imagefluencyApp/app.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
NULL
33

44
# Configuration
5-
MAX_IMAGES <- 100
5+
MAX_IMAGES <- getOption("imagefluency.max_images", default = 100L)
66

77
# Default (demo) image
88
defaultimage <- system.file("imagefluencyApp", "www", "rails.jpg", package = "imagefluency")

man/run_imagefluency.Rd

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_imagefluencyApp.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ test_that("run_imagefluency launches shiny app when available", {
1717

1818
expect_identical(run_imagefluency(), "launched")
1919
})
20+
21+
test_that("run_imagefluency errors on invalid max_images", {
22+
expect_error(run_imagefluency(max_images = 0),
23+
"`max_images` must be a positive number\\.")
24+
expect_error(run_imagefluency(max_images = "ten"),
25+
"`max_images` must be a positive number\\.")
26+
})

0 commit comments

Comments
 (0)