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

OME-TIFFs fail to load with no error message #65

Open
keller-mark opened this issue May 25, 2022 · 8 comments · Fixed by #63
Open

OME-TIFFs fail to load with no error message #65

keller-mark opened this issue May 25, 2022 · 8 comments · Fixed by #63
Labels
bug Something isn't working

Comments

@keller-mark
Copy link
Member

Describe the bug

The ome_tiff_remote.Rmd vignette fails to load its OME-TIFF and the loading indicator in the Spatial view just keeps spinning.

To Reproduce
Steps to reproduce the behavior:

Run the ome_tiff_remote.Rmd vignette.

Expected behavior
Expected an error in the console or a successfully loaded image.

It seems to be fixed by:

  • updating Vitessce to v1.1.21
  • changing the environment from production to development in webpack.config.js
  • not minifying the bundle in webpack.config.js
@dkeitley
Copy link

dkeitley commented Jan 6, 2023

Is there a version of vitessceR I can downgrade to in order to get OME-TIF images loading correctly? Currently, I get a spinning icon as mentioned above and a warning in the developer console:

Cannot read properties of undefined (reading 'data') [index.js:1344]

The spatial component of my shiny app can be found here.

@keller-mark
Copy link
Member Author

I just merged a pull request that upgrades the JavaScript package version used in the R package. Would you be able to check if the current implementation on the main branch fixes it?

@dkeitley
Copy link

Thanks Mark. I downloaded from the main branch but I get the following error in the R console when I start the shiny app:

Warning: Error in value[[3L]]: Couldn't normalize path in `addResourcePath`, with arguments: `prefix` = 'vitessceR-0.99.1'; `directoryPath` = ''
  [No stack trace available]

@keller-mark keller-mark reopened this Jan 11, 2023
@keller-mark
Copy link
Member Author

Are you intending to use the current directory by supplying an empty string for directoryPath = ""? If so, can you try directoryPath = "."?

@dkeitley
Copy link

I'm not sure where the addResourcePath function is called. I get this error when I run shiny::runApp(). Also, I'm not sure what's changed but I'm now getting the same error with directoryPath = 'C:/Users/Daniel Keitley/Documents/R/win-library/4.1/vitessceR/htmlwidgets/lib' if that's informative. I've tried updating packages and using R v4.2.2 but to no avail.

@dkeitley
Copy link

Hi Mark,

I just managed to overcome the Couldn't normalize path in 'addResourcePath' error by installing vitessceR from source. I now get the following warnings:

index.min.umd.js:46 -  [DEPRECATED] Please use `subscribeWithSelector` middleware[DEPRECATED] Please use `subscribeWithSelector` middleware
index.min.umd.js:7216 - Could not initialize coordinationValues.spatialImageLayer in RasterJsonAsObsSegmentationsLoader. This may be an indicator that the image could not be loaded.

i.e. https://github.com/vitessce/vitessce/blob/main/packages/file-types/json/src/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.js#L24

index.min.umd.js:7216 - Could not initialize coordinationValues.spatialImageLayer in RasterJsonAsImageLoader. This may be an indicator that the image could not be loaded.

i.e. https://github.com/vitessce/vitessce/blob/main/packages/file-types/json/src/raster-json-loaders/RasterJsonAsImageLoader.js#L24

The images still don't display and just appear as black/white boxes. Any ideas on what could be causing this?

@keller-mark
Copy link
Member Author

It seems like it could be an issue with the OME-TIFF organization or metadata (or with Vitessce being limited in the OME-TIFF files that can be loaded). Can you check that the file you are trying to use loads in avivator (should be able to drag and drop the file)? Are you able to share the OME-XML metadata (can be done by running the tiffcomment command line tool from bftools)? I also recently made a tutorial for converting TIFF to OME-TIFF, it is in python but maybe it can help https://github.com/vitessce/vitessce-python-tutorial/blob/main/tutorials/imaging/02_convert_data_manual.ipynb

@dkeitley
Copy link

Thanks for looking into this Mark. After a lot of debugging, I've finally worked out that the issue was because the renderLayers and image names didn't match in the file options.

i.e.

dataset$add_file(
      data_type = DataType$RASTER,
      file_type = FileType$RASTER_JSON,
      options = list(renderLayers = list("Something"),
                     schemaVersion = "0.0.2",
                     images = list(vitessceR::obj_list(name = "Something different",
                                                       url = image_url,
                                                       type = "ome-tiff",
                                                       metadata = list(omeTiffOffsetsUrl = offset_url)
                     ))
      ))

The images are now being displayed correctly. Sorry for any inconvenience caused!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants