Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image viewer not shown when running in shiny while not in interactive mode #32

Open
hcraT opened this issue Aug 3, 2018 · 2 comments
Open

Comments

@hcraT
Copy link

hcraT commented Aug 3, 2018

Hi,
if I run the example from a shiny app run in non-interactive mode the image viewer is not shown.

After struggling a bit I was able to workaround the problem by adding the method parameter to the display call like:

img <- readImage(image_path)
display(img, method = 'browser')

I see that the code in the example is guarded to run only in interactive mode but I think that this behaviour is a bit confusing (other are struggling with this). Wouldn't be nice to add at least a warning message that highlight the behavior?

Thank you very much.

P.S. EBImage is a very nice library thanks for developing it.

@aoles
Copy link
Owner

aoles commented Aug 3, 2018

Hi,
thanks for reaching out! Have you tried the Shiny bindings for display?

?`display-shiny`

Cheers,
Andrzej

@hcraT
Copy link
Author

hcraT commented Aug 6, 2018

Hi,
I actually run the package using the shiny bindings.

In the server.R I have:

function(input, output, session) {  
....

  output$image1 <- renderDisplay({
    iii <- load_image(image_path)
    display(iii, method = 'browser')
  })
....
}

While in the ui.R

dashboardBody(
...,
  fluidRow(
    column(width = 4,
      box(
        displayOutput('image1')
      )
    ),
...
)

I cut the code to show you just the relevant parts. If I remove the method = "browser" from the call to the display function the image viewer is not shown. I would have expected that the display method would have been able to detect the context of the call (renderDisplay) and use the correct rendering method.

Thanks,
Cheers,
Tarcisio.

P.S. Of course this works if I run the example from an interactive session while it doesn't in all the other cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants