0

I have built a Shiny App that works well locally and is able to automatically open a separate app (ImageJ Fiji), run a macro code to analyze an image, and then feed the results back to the Shiny App using the following:

Path0 <- "C:/Users/Username/Fiji.app/ImageJ-win64.exe --ij2 --run C:/Users/Username/Fiji.app/macros/TestingShiny.ijm"
system(Path0)

I'm now trying to use shinyapps.io to run the app so that other users will not have to download R in order to run the full analysis (I'm thinking Fiji will still need to be downloaded on every user's computer).

I made a very abbreviated version of my app to test out, and there is (understandably) a disconnect when trying to run this file path and system call once deployed on shinyapps.io.

## Load Packages
pacman::p_load(pacman, rmarkdown, shiny, shinydashboard, shinyWidgets, fresh, here, tinytex, htmlwidgets)

# Create the theme
Theme <- create_theme(
  adminlte_color(
    red = "#FF4719"
  ),
  adminlte_sidebar(
    dark_bg = "#293745",
    dark_hover_bg = "#3CAAFF",
  )
)

## Assign File Paths
Path0 <- "C:/Users/Username/Fiji.app/ImageJ-win64.exe --ij2 --run C:/Users/Username/Fiji.app/macros/TestingShiny.ijm"

ui <- dashboardPage(skin = "red",
                      
                      dashboardHeader(
                        title = h4(HTML("Test"))),
                      
                      dashboardSidebar(
                        sidebarMenu(id = "sidebarid",       
                                    menuItem("Test Run", tabName = "info"))),
                                    
                      
                      dashboardBody(
                        use_theme(Theme),
                        tabItems(
                          tabItem(tabName = "info",  
                                  fluidRow(
                                    column( width = 4,
                                            fluidRow(
                                    actionBttn(inputId = "go", label = "Go!"),
                                    tableOutput(outputId = "text"))
                      )
  )))))
  

  server <- function(input, output, session) {
    ## Sets observeEvent with eventReactive for Go button click  
    observeEvent(input$go, {
      
      ## Runs Fiji and accompanying macro
      system(Path0) 
      
      ## Pulls Result file from Output folder
      Result <- eventReactive(input$go, {read.delim(Path1)})
      Filepath1 <- here("Output", "Log.txt")
      write.csv(Result(), Filepath1 , row.names = FALSE)
      ## Displays the result
      output$text <- renderTable(align = 'c', {Result()})
      
      })}
  
  
  shinyApp(ui, server)

Is there a way to pass the file path of the Fiji app and macro file on the client's side so that it can open and run on their computer then feed the results back to the Shiny App? Would shinyFiles or shiny::fileInput() work here?

1 Answer 1

2

No, it is not possible for a deployed app on to open and run another app (Fiji) on the client side.

is a platform for hosting and deploying Shiny apps, which are web-based applications that run on the server-side. When a user accesses a Shiny app, the app runs on the server, and the user interacts with it through a web browser.

Fiji, on the other hand, is a desktop application that needs to be installed and run on the client-side (i.e., the user's local machine).

Due to security restrictions and the architecture of web applications, a Shiny app running on cannot:

  • Install software on the client-side
  • Execute arbitrary code on the client-side
  • Open or run desktop applications on the client-side

However, there are alternative solutions to achieve similar functionality, such as:

  • Using JavaScript or other client-side technologies to interact with Fiji or other desktop applications
  • Creating a separate web application that communicates with Fiji through APIs or other means
  • Using containerization or virtualization technologies to run Fiji in a controlled environment
Sign up to request clarification or add additional context in comments.

1 Comment

Hi ayesha, thank you for your help! Would it be possible to instead simply upload files (or a folder of files) to the deployed Shiny App for temporary use? Or is this also restricted? The data within the uploaded files would only need to be used in the app to further process the data and make a report. After that, the files are no longer needed. Each time the app is run, the client would need to upload a new dataset and its accompanying image files from their computer. Is something like this possible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.