README.md 7.08 KB
Newer Older
1
## Image Data Explorer
Kimberly Isobel Meechan's avatar
Kimberly Isobel Meechan committed
2

3 4
### Introduction
Most bioimaging projects derive data from images and regions of interest (ROIs, e.g. segmented objects) on those images. It is desirable, and sometimes necessary, to explore these image-derived data while visualizing the image(s) and ROIs associated with each data point. To address this need, we developed the Image Data Explorer (IDE). The IDE is implemented as a Shiny app (i.e. a web app written in R using the Shiny package).
Kimberly Isobel Meechan's avatar
Kimberly Isobel Meechan committed
5

6 7
### Data structure requirements 
#### Images
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
8
Each image file must contain an image of at most 3 dimensions with the third dimension representing either depth (z coordinate) or time. Images are expected to be organised under one common root directory. For example, if the images are organized like this:  
9 10 11 12 13 14 15
  ▽ screen\_images  
      ▽ plate1\_replicate1  
          ▽ well001  
              W001-P001-Z000-T0000-s1234-Cy3.tif  
              W001-P001-Z000-T0000-s1234-EGFP.tif  
          ▷ well002  
      ▷ plate1\_replicate2  
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
16 17
then the image root directory is screen\_images.  
The IDE can in principle read all image formats supported by BioFromats but has so far only been tested with TIFF, PNG and JPEG.
18
#### Data points
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
19
Image-derived data are expected to be in table format with data points in rows and stored in a tab- or comma-separated plain text file. The table must have column headers with unique column names. To link data points to images, the table should include one column with the path to image files relative to the image root directory and each cell of this column must reference only one file. Using the example above, the image root directory is 'screen\_images' and therefore the table column for data points associated with image W001-P001-Z000-T0000-s1234-Cy3.tif should contain the relative path 'plate1_replicate1/well001/W001-P001-Z000-T0000-s1234-Cy3.tif'. There can be multiple columns with links to images but only two can be used simultaneously in the IDE.  
20 21 22 23 24 25
The IDE references ROIs by the coordinates of the ROI centre therefore there should be a column for each of the relevant coordinates: x, y and either z or t. Coordinates (x,y) must be in pixels relative to the top left corner of the image (which is pretty much the standard for image analysis software).

### Using the IDE
#### Requirements
The IDE needs a computer with an [R environment version >=3.5.0](https://www.r-project.org/). The IDE requires some R packages and will try to install them if it can't detect them on the system. In case of problems, it may be better to install the required packages manually.  
The IDE requires the following packages from CRAN:
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
26
DT, shiny, shinyFiles, shinycssloaders, shinydashboard, ggplot2, plotly, RANN.  
27 28 29 30
From within an R console, install with:
```
> install.packages("DT", "shiny", "shinyFiles", "shinycssloaders", "shinydashboard", "ggplot2", "plotly", "RANN")
```
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
31
and from Bioconductor: RBioFormats  
32 33 34
From within an R console, install with:  
```
> install.packages("BiocManager")
35
> BiocManager::install("aoles/RBioFormats")
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
```
The IDE also needs a patched version of EBImage. From within R, install with:  
```
> library(devtools)
> install_github("jkh1/EBImage")
```
Note that this may overwrite a preexisting EBImage installation.

#### Installation
Download the code from the project's repository and run it from a terminal:
```
> git clone git@git.embl.de:meechan/image-data-explorer.git
> Rscript image-data-explorer/image_data_explorer.R
```
The app is then accessible from a web browser at http://127.0.0.1:5476  
Alternatively, open the file image_data_explorer.R with [RStudio](https://www.rstudio.com/products/rstudio/download/) and click the 'Run App' button.

#### Data input
The IDE opens with the 'Input data' section comprising 4 boxes:
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
55
* **Input data file**  
56
This is where the tabular data is selected and uploaded to the app server. Before uploading a file, make sure that the correct column separator and quote type are selected.  
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
57
* **Plot variables**  
58
This allows to select two columns whose values will be shown in a scatterplot.  
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
59
* **Images**  
60
If images are associated with the data file, select the image root directory then one or two columns containing the paths to the images relative to the selected root directory. If a column name contains the pattern 'image.*path', this column will be preselected in the image 1field.  
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
61
* **ROIs**  
62 63 64 65 66
If the data table rows correspond to ROIs of associated images, select here the columns containing the coordinates of the ROIs centres.
If the rows correspond to time points only (i.e. with no ROI definition), select only a column for frame coordinates and leave X and Y coordinates empty. If a column name contains the pattern 'coordinate_X|Y|Z|time', it will be preselected in the matching ROI coordinate field (e.g. a column named cell_coordinate_x will be preselected as column for coordinate X).
#### Data exploration
Once the data input section has been completed, data exploration is reached by clicking 'Explore' in the sidebar.
This section is formed of three parts:
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
67
* **A plot** area on the top left of the screen. This shows a scatterplot of the variables selected in the data input section.
68
Clicking on a data point in the graph selects it in the data table below and opens the corresponding image(s). If the point is associated with x,y coordinates then a red dot is added to the image(s) at the position given by these coordinates.
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
69
* **An image viewer** area next to the plot area. This is where images selected under image 1 in the data input section will appear.
70
Clicking on the image selects the corresponding row in the data table and highlights the corresponding point in the plot. If rows correspond to ROIs then the click position is indicated by a red dot and the data point corresponding to the closest ROI in the image is selected in both the data table and the plot.
Jean-Karim Heriche's avatar
Jean-Karim Heriche committed
71
* **A data table** area at the bottom of the screen. The data table shows the content of the uploaded data file. A tab allows switching to a second image viewer where images selected under image 2 in the data input section will appear. This second image viewer behaves like the one described above. The data table viewer uses pagination to show the data with a default of 10 rows per page which can be changed using the 'Show xx rows' button in the top left corner above the table. Clicking on a table row selects it and highlights the corresponding point in the plot. Multiple selection is possible which is why no image is shown when selecting table rows. The table is searchable globally using the 'Search' box in the top right corner above the table or by column using the boxes atop each column. Searches filter the rows to be displayed in the table. To select all the rows and highlight them in the plot, click the button labeled 'Show filtered rows in plot' above the table. To deselect all selected rows, click the 'Clear selection' button.