image-ethics-and-data-integrity.md 10.2 KB
Newer Older
1
# Image data integrity
Christian Tischer's avatar
Christian Tischer committed
2

3
#### Prerequisites
Christian Tischer's avatar
Christian Tischer committed
4 5 6 7 8

- A computer with an image analysis software (e.g. [Fiji](www.fiji.sc)) already installed.
- Basic knowledge of how to use above software, e.g. 
    - open and save images
    - change image display settings
9
    - subtract a value from every pixel in an image
10
- Please download the training [material](https://git.embl.de/grp-bio-it/image-analysis-training-resources/-/archive/master/image-analysis-training-resources-master.zip) 
11
- Please make sure you can access to this [document](https://git.embl.de/grp-bio-it/image-analysis-training-resources/blob/master/workshops/image-ethics-and-data-integrity.md#image-ethics-and-data-integrity).
Christian Tischer's avatar
Christian Tischer committed
12 13

#### Duration
14 15 16

1.5 hours

Christian Tischer's avatar
Christian Tischer committed
17
#### Learn more about image data integrity
18 19 20 21

- http://www.imagedataintegrity.com/about.html
- http://jcb.rupress.org/content/166/1/11.full

22
## Image data integrity
23 24 25 26 27 28 29 30 31 32 33 34 35

<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
    image_data_integrity -> image_content [label="  preserving"];
    image_content -> pixel_values;
    image_content -> pixel_coordinates;
    pixel_coordinates -> array_indices;
    pixel_coordinates -> physical_coordinates; 
 }
'/>


36 37
## Image data saving

38 39 40 41 42 43 44
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
    saving_images -> image_content [label="  can change"];
  }
'/>

45 46
### Motivation

47
Sometimes it can be necessary to save your images in a different formats. 
Christian Tischer's avatar
Christian Tischer committed
48 49 50 51
It needs some training to know how to do this properly.

What could be good reasons to resave your data in a different format (multiple answers)?

52 53 54 55 56 57 58
1. I want to share my scientific findings on twitter, thus I need to convert an image to a twitter compatible format.
2. I want to import images in PowerPoint, only some formats will work.
3. I need to save disk space, thus I need to find a format that makes the images smaller.
4. I want to use a special software that only accepts certain image data formats.
5. The journal I want to publish in, only accepts certain image formats.
6. I want to have everything in Tiff format, because this is the standard.
7. My boss says that (s)he cannot open .lif (Leica) or .czi (Zeiss) images, thus I should save them in a different format.
Christian Tischer's avatar
Christian Tischer committed
59

60

61 62
### Activity: Save an image

63
- Open image: `calibrated_16bit__cells_eres_noisy.tif`
64 65
- Note down the value and coordinate of the pixel at [218, 332]
- Save the image in **jpg** format
66
- Reopen the image
67
- Compare the value and coordinate of the pixel at [218, 332] to your notes, did it change?
68

Christian Tischer's avatar
Christian Tischer committed
69
Repeat above workflow, but 
70

71 72 73
- adjust the image display before saving 
- save as **png**
- open `xy_float__nuclei_probability.tif` and save as **png**
74

75
### Formative assessment
76

77 78
What can I do to preserve image integrity during image saving (multiple answers)?

79 80 81 82
1. I always save in Tiff format, this is safe.
2. I always check pixel values and coordinates before and after saving.
3. I ask my colleagues in the lab and do what they recommend..
4. I keep a copy of the raw data.
83

Christian Tischer's avatar
Christian Tischer committed
84 85

## Image display adjustment
86

Christian Tischer's avatar
Christian Tischer committed
87 88
### Motivation

89
Images are a collection of numbers. To visualise those numbers one needs to decide how to map them onto a color and a brightness. There is no default way of doing this. Thus one has be educated and thoughful about this topic. In fact, it is one of the great responsibilties of a microscopist to ajust the image display settings proplery.
90

91
### Image display concept map
92

Christian Tischer's avatar
Christian Tischer committed
93 94 95 96
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
    image_content -> numbers [label="  contains"];
97
    numbers -> image_display [label="  lookup table (LUT)"];
Christian Tischer's avatar
Christian Tischer committed
98 99 100
  }
'/>

101 102 103
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
104 105
    lookup_table_settings -> scientific_message [label="  affects"];;
    lookup_table_settings -> no_default;
106 107 108
  }
'/>

109
### Activity: Quantitative image display
110

111
- Open image: `xy_calibrated_16bit__nuclear_protein_control.tif`
112
    - This image shows a nuclear protein in control cells.   
113
- Open image: `xy_calibrated_16bit__nuclear_protein_treated.tif`
114 115 116
    - The cells in this image have been subjected to a drug.
- Inspect the images:
    - Did the drug affect the amount of the nuclear protein?
117
- Adjust the lookup-tables (LUTs) of both images to be the same
Christian Tischer's avatar
Christian Tischer committed
118
- Add a LUT calibration to both images 
119

120
### Formative Assessment
Christian Tischer's avatar
Christian Tischer committed
121

122
What helps to scientifically convey image intensity information (multiple answers)?
123

124 125 126 127
1. Adjust the LUT to the image's full bit-depth.
2. Add a LUT calibration bar.
3. Use the same LUT for images acquired with same settings..
4. Never change the LUT of images! Always keep as in raw data.
Christian Tischer's avatar
Christian Tischer committed
128 129 130

## High dynamic range image display

131 132 133
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
134 135 136
    biological_images -> high_dynamic_range [label="  "];
    paper_reflectance -> low_dynamic_range [label="  "];
    computer_monitors -> low_dynamic_range [label="  "];
137 138 139
  }
'/>

140 141 142 143 144 145
### Motivation

The number range in images of biological samples can cover large ranges.
For example, a GFP tagged protein could occur in the same cell at different locations either 1 or 10000 times. This means that the dynamic range can be 10^4 or more. Due to limitations of image display and image preception such large dynamics ranges are difficult to display.


Christian Tischer's avatar
Christian Tischer committed
146 147 148
### Activity: High dynamic range image display

- Open image: `xy_16bit__nuclei_high_dynamic_range.tif`
149
- Try to adjust the grayscale LUT such that everything can be seen...
Christian Tischer's avatar
Christian Tischer committed
150
- Try finding other LUTs that help showing all data
151
- Add LUT calibration to image
Christian Tischer's avatar
Christian Tischer committed
152 153 154 155 156

### Formative Assessment

What can you do to show images with a high dynamic range (multiple answers)?

157 158
1. Adjust the LUT such that only the scientifically relevant information can be seen.
2. Adjust the LUT such that only the scientifically relevant information can be seen 
159 160
	* and state that the LUT has been adjusted in the figure legend
	* and show the same image with other LUT settings in the supplemental material.
161 162 163 164
3. Try to find a LUT that shows all data.
4. Never use multi color LUTs, they are confusing.
5. Already on the  microscope change the settings such that only relevant structures are visible, e.g. lower the gain such that dark irrelevant objects have zero pixel values.
6. Adjust LUT settings such that background noise is not visible, because this is distracting.
165
G. Add a LUT calibration to the image, such that readers can see that not all information might be visible.
Christian Tischer's avatar
Christian Tischer committed
166 167 168 169


## Image math

170 171 172 173 174 175 176 177 178
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
    image_math -> pixel_values [label="  changes"];
    image_math -> pixel_data_type [label="  does not change"];
    image_math -> wrong_pixel_values [label = "  can yield"] 
  }
'/>

Christian Tischer's avatar
Christian Tischer committed
179 180
### Motivation

181 182
It sometimes is necessary to change numberic content of images. It is important to understand how to do this properly in order to avoid uncontrolled artifacts.

Christian Tischer's avatar
Christian Tischer committed
183 184
What are good reasons to change the pixel values in an image?

185 186 187 188 189 190
1. For intensity measurements, the image background (e.g. camera based offset) should be subtracted from all pixels.
2. For threshold based image segmentation (object detection), it helps to first filter noise in the image.
3. For intensity measurements, it helps to filter noise in the image.
4. The image appears to dark, multiplication of all pixels by a constant number is a means to make it brighter.
5. For uneven illumination (e.g. occuring in wide-field microscopy with large camera chips), one should do flat-field correction, which makes the intensity values even across the image.
6. Our microscope was broken. We took images on a replacement microscope. The pixel values were consistently higher than on our usual microscope. We multiplied the pixels on all images from the replacement microscope by a constant factor to make them comparable to our usual data.
191

Christian Tischer's avatar
Christian Tischer committed
192 193

### Activity: Perform pixel based background subtraction
194

195
- Open image: `xy_8bit__nuclei_noisy_different_intensity.tif`
Christian Tischer's avatar
Christian Tischer committed
196
- Appreciate the significant background intensity
197 198 199
- Measure pixel value at `[ 28, 35 ]` and `[ 28, 39 ]`
- Measure background intensity in below region:
	- upper left corner at `[ 20, 35 ]`
Christian Tischer's avatar
Christian Tischer committed
200 201 202
	- width = 10
	- height = 10 
- Subtract the measured background intensity from each pixel 
203
- Measure pixel values again at above coordinates ( `[ 28, 35 ]` and `[ 28, 39 ]` )
Christian Tischer's avatar
Christian Tischer committed
204
- Discuss how the pixel values changed during background subtraction
205

Christian Tischer's avatar
Christian Tischer committed
206
Repeat above activity, but:
207

208
- After opening the image, convert its pixel data type to floating point
209

Christian Tischer's avatar
Christian Tischer committed
210
### Formative Assessment
211

Christian Tischer's avatar
Christian Tischer committed
212 213
Considering image math operations, which of below statements is correct 
(multiple answers)?
214

215
1. Never change the pixel data type, because it violates image integrity.
216 217 218
2. Changing the pixel data type does not change pixel values.
3. It is scientifically unethical to perform mathematical operations on images, because it changes the pixel values.
4. When performing mathematical operations on images, it should be documented (e.g. by a script of code) 
219 220


Christian Tischer's avatar
Christian Tischer committed
221
## Display of 3-D images
222

223
Biological images are often 3D. However paper and monitors can only show 2D images. It is thus important to understand how to show 3D images in 2D without compromising the scientific message.
224 225 226 227

<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
Christian Tischer's avatar
Christian Tischer committed
228 229
    _3D_data -> visualisation [label="  multiple options"];
    visualisation -> scientific_message [label="  affects"];
230 231 232
  }
'/>

233

Christian Tischer's avatar
Christian Tischer committed
234 235 236 237 238 239 240
<img src='https://g.gravizo.com/svg?
 digraph G {
    shift [fontcolor=white,color=white];
    _3D_visualisation -> sum_projection;
    _3D_visualisation -> max_projection;
    _3D_visualisation -> slice_animation;
    _3D_visualisation -> slice_gallery;
241
    _3D_visualisation -> ...;
Christian Tischer's avatar
Christian Tischer committed
242 243
  }
'/>
244 245


Christian Tischer's avatar
Christian Tischer committed
246 247 248 249 250 251 252 253 254
### Activity: Explore 3D visualisations

- Open image: `xyzt_calibrated_16bit__golgi_bfa.zip`
- Explore and discuss different options how to present this data
    - slice gallery
    - sum projection
    - max projection
    - slice animation

255
### Formative Assessment
256

Christian Tischer's avatar
Christian Tischer committed
257 258
Which statements about visualisation and quantification of 3D images are correct (multiple answers)?

259 260
1. Always use maximum intensity projection, it is by far the most commonly used.
2. Any visualisation can make sense, you just have scientifically justify it.
261 262
3. Intensity quanitifcations ideally should be done in 3D, not in projections.
4. It is impossible to quantify intensities in projections.
263