EOGrady21 / VPR_viewer

A shiny app to visualize plankton data and images from the Video Plankton Recorder
MIT License
1 stars 0 forks source link

Image display - selecting directory #5

Open EOGrady21 opened 2 years ago

EOGrady21 commented 2 years ago

Currently image directory is automatically selected based on metadata inputs

            imgs_path <-  paste0(input$basepath, '/', input$cruise, "/rois/vpr", input$tow,"/d", input$day, "/h", input$hour, "/")

but the user should also be able to directly select the image directory by using the Choose ROI Directory button. This should override the automatic ROI directory code

But this feature does not seem to be working.

I think this is the relevant code chunk

 path <- reactive({
        home <- input$dir$root
        file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
    })

 observeEvent(input$dir, {
        values$upload_state <- 'uploaded'
    })
    # browser()
    imgs_path <- reactive({
      input$update # is this working?
        if (is.null(values$upload_state)) {

            imgs_path <-  paste0(input$basepath, '/', input$cruise, "/rois/vpr", input$tow,"/d", input$day, "/h", input$hour, "/")

        } else if (values$upload_state == 'uploaded') {
            imgs_path <- path()

        } 
    })

input$dir is the Choose ROI Directory button. Maybe because path() is only getting the root directory? I'll need to do some more troubleshooting here.

EOGrady21 commented 2 years ago

This investigation has been a rabbit hole but it now seems that the Directory Choose button is not overriding the auto directory because the code assumes that the directory matches the data supplied to plots.

My question, to @kevinsorochan Would there be a use case where a user wanted to JUST look at images without plotting the CTD data within the app? If so would it be useful to have the ability to 'isolate' the image gallery from the rest of the app? Example would be to have a little check box on the image gallery page that would allow you to select ANY image directory to display? Or does it make more sense to keep the images displayed unified with the CTD data to avoid potential errors/ confusion?

Sorry for a long winded comment.