Skip to content

Commit 494d405

Browse files
committed
markdown source builds
Auto-generated via {sandpaper} Source : 06c4504 Branch : main Author : Toby Hodges <tbyhdgs@gmail.com> Time : 2023-07-26 07:19:24 +0000 Message : Merge pull request #288 from datacarpentry/library-name-formatting Consistent library naming
1 parent 2ddb90b commit 494d405

15 files changed

+178
-203
lines changed

01-introduction.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,21 @@ shown in the morphometric example above.
8484
Why should we learn how to write a Python program to do a task
8585
we could easily perform with our own eyes?
8686
There are at least two reasons to learn how to perform tasks like these
87-
with Python and skimage:
87+
with Python and scikit-image:
8888

8989
1. What if there are many more bacteria colonies in the Petri dish?
9090
For example, suppose the image looked like this:
9191

9292
![](fig/colonies-03.jpg){alt='Bacteria colony'}
9393

9494
Manually counting the colonies in that image would present more of a challenge.
95-
A Python program using skimage could count the number of colonies more accurately,
95+
A Python program using scikit-image could count the number of colonies more accurately,
9696
and much more quickly, than a human could.
9797

9898
2. What if you have hundreds, or thousands, of images to consider?
9999
Imagine having to manually count colonies on several thousand images
100100
like those above.
101-
A Python program using skimage could move through all of the images in seconds;
101+
A Python program using scikit-image could move through all of the images in seconds;
102102
how long would a graduate student require to do the task?
103103
Which process would be more accurate and repeatable?
104104

@@ -120,9 +120,7 @@ by learning some basics about how images are represented and stored digitally.
120120

121121
:::::::::::::::::::::::::::::::::::::::: keypoints
122122

123-
- Simple Python and skimage (scikit-image) techniques can be used to solve genuine image analysis problems.
123+
- Simple Python and scikit-image techniques can be used to solve genuine image analysis problems.
124124
- Morphometric problems involve the number, shape, and / or size of the objects in an image.
125125

126126
::::::::::::::::::::::::::::::::::::::::::::::::::
127-
128-

02-image-basics.md

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ exercises: 5
88

99
- Define the terms bit, byte, kilobyte, megabyte, etc.
1010
- Explain how a digital image is composed of pixels.
11-
- Recommend using imageio (resp. skimage) for I/O (resp. image processing) tasks.
11+
- Recommend using imageio (resp. scikit-image) for I/O (resp. image processing) tasks.
1212
- Explain how images are stored in NumPy arrays.
1313
- Explain the left-hand coordinate system used in digital images.
1414
- Explain the RGB additive colour model used in digital images.
15-
- Explain the order of the three colour values in skimage images.
15+
- Explain the order of the three colour values in scikit-image images.
1616
- Explain the characteristics of the BMP, JPEG, and TIFF image formats.
1717
- Explain the difference between lossy and lossless compression.
1818
- Explain the advantages and disadvantages of compressed image formats.
@@ -72,7 +72,7 @@ The **matrix** is mathematical concept - numbers evenly arranged in a rectangle.
7272
like the shape of the screen you're looking at now. Or it could be a three dimensional equivalent, a cuboid, or have
7373
even more dimensions, but always keeping the evenly spaced arrangement of numbers. In computing, **array** refers
7474
to a structure in the computer's memory where data is stored in evenly-spaced **elements**. This is strongly analogous
75-
to a matrix. A `numpy` array is a **type** of variable (a simpler example of a type is an integer). For our purposes,
75+
to a matrix. A NumPy array is a **type** of variable (a simpler example of a type is an integer). For our purposes,
7676
the distinction between matrices and arrays is not important, we don't really care how the computer arranges our data
7777
in its memory. The important thing is that the computer stores values describing the pixels in images, as arrays. And
7878
the terms matrix and array can be used interchangeably.
@@ -111,7 +111,7 @@ Additional functionality can be loaded as a single function or object,
111111
a module defining several of these, or a library containing many modules.
112112
You will encounter several different forms of `import` statement.
113113

114-
```python
114+
```python
115115
import skimage # form 1, load whole skimage library
116116
import skimage.draw # form 2, load skimage.draw module only
117117
from skimage.draw import disk # form 3, load only the disk function
@@ -122,7 +122,7 @@ import numpy as np # form 4, load all of numpy into an object called
122122

123123
## Further Explanation
124124

125-
In the example above, form 1 loads the entire `skimage` library into the
125+
In the example above, form 1 loads the entire scikit-image library into the
126126
program as an object.
127127
Individual modules of the library are then available within that object,
128128
e.g., to access the `disk` function used in [the drawing episode](04-drawing.md),
@@ -131,7 +131,7 @@ you would write `skimage.draw.disk()`.
131131
Form 2 loads only the `draw` module of `skimage` into the program.
132132
When we run the code,
133133
the program will take less time and use less memory
134-
because we will not load the whole `skimage` library.
134+
because we will not load the whole scikit-image library.
135135
The syntax needed to use the module remains unchanged:
136136
to access the `disk` function,
137137
we would use the same function call as given for form 1.
@@ -182,7 +182,7 @@ natively (think of volumes, movies).
182182

183183
## Why not use `skimage.io.imread()`
184184

185-
The `skimage` library has its own function to read an image,
185+
The scikit-image library has its own function to read an image,
186186
so you might be asking why we don't use it here.
187187
Actually, `skimage.io.imread()` uses `iio.imread()` internally when loading an image into Python.
188188
It is certainly something you may use as you see fit in your own code.
@@ -226,7 +226,7 @@ print(eight.shape)
226226
print(eight)
227227
```
228228

229-
```output
229+
```output
230230
(5, 3)
231231
[[0. 0. 0.]
232232
[0. 1. 0.]
@@ -237,8 +237,8 @@ print(eight)
237237

238238
Thus if we have tools that will allow us to manipulate these arrays of numbers,
239239
we can manipulate the image.
240-
The `numpy` library can be particularly useful here,
241-
so let's try that out using `numpy` array slicing.
240+
The NumPy library can be particularly useful here,
241+
so let's try that out using NumPy array slicing.
242242
Notice that the default behavior of the `imshow` function appended row and
243243
column numbers that will be helpful to us as we try to address individual or
244244
groups of pixels.
@@ -262,7 +262,7 @@ plt.imshow(zero)
262262
print(zero)
263263
```
264264

265-
```output
265+
```output
266266
[[0. 0. 0.]
267267
[0. 1. 0.]
268268
[0. 1. 0.]
@@ -337,7 +337,7 @@ plt.imshow(five)
337337
print(five)
338338
```
339339

340-
```output
340+
```output
341341
[[0. 0. 0.]
342342
[0. 1. 1.]
343343
[0. 0. 0.]
@@ -433,7 +433,7 @@ key to certain techniques explored in later chapters of this lesson.
433433
To get started let's see an example of how different dimensions of information
434434
combine to produce a set of pixels using a 4 X 4 matrix with 3 dimensions
435435
for the colours red, green, and blue.
436-
Rather than loading it from a file, we will generate this example using numpy.
436+
Rather than loading it from a file, we will generate this example using NumPy.
437437

438438
```python
439439
# set the random seed so we all get the same matrix
@@ -447,7 +447,7 @@ plt.imshow(checkerboard)
447447
print(checkerboard)
448448
```
449449

450-
```output
450+
```output
451451
[[[116 85 57]
452452
[128 109 94]
453453
[214 44 62]
@@ -658,11 +658,11 @@ There are several image formats we might encounter,
658658
and we should know the basics of at least of few of them.
659659
Some formats we might encounter, and their file extensions, are shown in this table:
660660

661-
| Format | Extension |
661+
| Format | Extension |
662662
| :-------------------------------------- | :------------ |
663-
| Device-Independent Bitmap (BMP) | .bmp |
664-
| Joint Photographic Experts Group (JPEG) | .jpg or .jpeg |
665-
| Tagged Image File Format (TIFF) | .tif or .tiff |
663+
| Device-Independent Bitmap (BMP) | .bmp |
664+
| Joint Photographic Experts Group (JPEG) | .jpg or .jpeg |
665+
| Tagged Image File Format (TIFF) | .tif or .tiff |
666666

667667
## BMP
668668

@@ -742,12 +742,12 @@ The amount of memory (RAM) and drive space our computers have is quantified
742742
by terms like Megabytes (MB), Gigabytes (GB), and Terabytes (TB).
743743
The following table provides more formal definitions for these terms.
744744

745-
| Unit | Abbreviation | Size |
745+
| Unit | Abbreviation | Size |
746746
| :-------------------------------------- | ------------- | :--------- |
747-
| Kilobyte | KB | 1024 bytes |
748-
| Megabyte | MB | 1024 KB |
749-
| Gigabyte | GB | 1024 MB |
750-
| Terabyte | TB | 1024 GB |
747+
| Kilobyte | KB | 1024 bytes |
748+
| Megabyte | MB | 1024 KB |
749+
| Gigabyte | GB | 1024 MB |
750+
| Terabyte | TB | 1024 GB |
751751

752752
::::::::::::::::::::::::::::::::::::::::::::::::::
753753

@@ -1025,7 +1025,7 @@ metadata = iio.immeta(uri="data/eight.tif")
10251025
metadata
10261026
```
10271027

1028-
```output
1028+
```output
10291029
{'is_fluoview': False,
10301030
'is_nih': False,
10311031
'is_micromanager': False,
@@ -1060,29 +1060,27 @@ the metadata of your images.
10601060
The following table summarises the characteristics of the BMP, JPEG, and TIFF
10611061
image formats:
10621062

1063-
| Format | Compression | Metadata | Advantages | Disadvantages |
1063+
| Format | Compression | Metadata | Advantages | Disadvantages |
10641064
| :-------------------------------------- | :------------ | :--------- | :--------------------- | :----------------------------------------- |
1065-
| BMP | None | None | Universally viewable, | Large file sizes |
1066-
| | | | high quality | |
1067-
| JPEG | Lossy | Yes | Universally viewable, | Detail may be lost |
1068-
| | | | smaller file size | |
1069-
| PNG | Lossless | [Yes](https://www.w3.org/TR/PNG/#11keywords) | Universally viewable, [open standard](https://www.w3.org/TR/PNG/), smaller file size | Metadata less flexible than TIFF, RGB only |
1070-
| TIFF | None, lossy, | Yes | High quality or | Not universally viewable |
1071-
| | or lossless | | smaller file size | |
1065+
| BMP | None | None | Universally viewable, | Large file sizes |
1066+
| | | | high quality | |
1067+
| JPEG | Lossy | Yes | Universally viewable, | Detail may be lost |
1068+
| | | | smaller file size | |
1069+
| PNG | Lossless | [Yes](https://www.w3.org/TR/PNG/#11keywords) | Universally viewable, [open standard](https://www.w3.org/TR/PNG/), smaller file size | Metadata less flexible than TIFF, RGB only |
1070+
| TIFF | None, lossy, | Yes | High quality or | Not universally viewable |
1071+
| | or lossless | | smaller file size | |
10721072

10731073
:::::::::::::::::::::::::::::::::::::::: keypoints
10741074

10751075
- Digital images are represented as rectangular arrays of square pixels.
10761076
- Digital images use a left-hand coordinate system, with the origin in the upper left corner, the x-axis running to the right, and the y-axis running down. Some learners may prefer to think in terms of counting down rows for the y-axis and across columns for the x-axis. Thus, we will make an effort to allow for both approaches in our lesson presentation.
10771077
- Most frequently, digital images use an additive RGB model, with eight bits for the red, green, and blue channels.
1078-
- skimage images are stored as multi-dimensional NumPy arrays.
1079-
- In skimage images, the red channel is specified first, then the green, then the blue, i.e., RGB.
1078+
- scikit-image images are stored as multi-dimensional NumPy arrays.
1079+
- In scikit-image images, the red channel is specified first, then the green, then the blue, i.e., RGB.
10801080
- Lossless compression retains all the details in an image, but lossy compression results in loss of some of the original image detail.
10811081
- BMP images are uncompressed, meaning they have high quality but also that their file sizes are large.
10821082
- JPEG images use lossy compression, meaning that their file sizes are smaller, but image quality may suffer.
10831083
- TIFF images can be uncompressed or compressed with lossy or lossless compression.
10841084
- Depending on the camera or sensor, various useful pieces of information may be stored in an image file, in the image metadata.
10851085

10861086
::::::::::::::::::::::::::::::::::::::::::::::::::
1087-
1088-

0 commit comments

Comments
 (0)