118
Biomedical Signal and Image Processing
1
2
3
4
0.5
0.3
0.15
0.05
0.5
0.3
0.5
1
0
0
1
1
1
0.5
0.2
x i
p i
0
FIGURE 6.3 Tree diagram for Hoffman coding.
The procedure for Hoffman coding can be more easily performed using a tree diagram. In the tree formation, first, the codes are listed in a column in a descending
order according to their probabilities. Then, in a second column, the two least probable codes are combined with each other. The rest of the probabilities are copied to
the second column. The same process is repeated on the new column until we reach a
column with only one row (which has probability one). Then, 0’s and 1’s are assigned
to each combination of probabilities in each transition from one column to another.
As the last step, to form the code for a specific symbol or gray level, we start accumulating 0’s and 1’s encountered in a path from the last column of the tree toward the
given code. This tree procedure is illustrated in the following example:
Example 6.3
An image has four gray levels {1, 2, 3, 4} with probabilities p 1 = 0.5, p 2 = 0.3,
p 3 = 0.15, p 4 = 0.05. We design a Hoffman code for the image using a tree as
shown in Figure 6.3.
Using the diagram, the resulting codes are C(1) = 0, C(2) = 10, C(3) = 110, and
C(4) = 111. Remember that when assigning the codes using the tree diagram, we
are moving backward, i.e., we start from the right-hand side and move toward
the gray level in the left-hand side. Calculating the entropy and the average code
−
length, we have H = 1.6477 and L (C) = 1.7. This gives the code rate of R = 96.92%.
The reader can verify that the code rate for a fixed-length code with 2 bit is
82.38%. This shows the significant improvement gained by using Hoffman code.
The importance of Hoffman code in signal and image processing cannot be
exaggerated. Compression technologies such as JPEG are all based on Hoffman
coding. Without this compression method, the storage and communication of biomedical signals would have been practically impossible.
6.6 REGISTRATION OF IMAGES
In practical medical imaging applications, sometimes the images of the same tissue (e.g., the brain) are taken using different modalities such as MRI, CT, and PET.
Knowing that each of these modalities provides certain types of information about
the imaged tissues, it is important to coregister these images with each other. This
allows the user to register the same objects in all images. For instance, image registration between MRI and CT of the head allows knowing the exact location of the
objects such as the basal ganglia in both MRI and CT images.
Registration is important even when the images of the same tissue are taken at
different times by the same modality or even by the same machine. It is often the
Biomedical Signal and Image Processing
1
2
3
4
0.5
0.3
0.15
0.05
0.5
0.3
0.5
1
0
0
1
1
1
0.5
0.2
x i
p i
0
FIGURE 6.3 Tree diagram for Hoffman coding.
The procedure for Hoffman coding can be more easily performed using a tree diagram. In the tree formation, first, the codes are listed in a column in a descending
order according to their probabilities. Then, in a second column, the two least probable codes are combined with each other. The rest of the probabilities are copied to
the second column. The same process is repeated on the new column until we reach a
column with only one row (which has probability one). Then, 0’s and 1’s are assigned
to each combination of probabilities in each transition from one column to another.
As the last step, to form the code for a specific symbol or gray level, we start accumulating 0’s and 1’s encountered in a path from the last column of the tree toward the
given code. This tree procedure is illustrated in the following example:
Example 6.3
An image has four gray levels {1, 2, 3, 4} with probabilities p 1 = 0.5, p 2 = 0.3,
p 3 = 0.15, p 4 = 0.05. We design a Hoffman code for the image using a tree as
shown in Figure 6.3.
Using the diagram, the resulting codes are C(1) = 0, C(2) = 10, C(3) = 110, and
C(4) = 111. Remember that when assigning the codes using the tree diagram, we
are moving backward, i.e., we start from the right-hand side and move toward
the gray level in the left-hand side. Calculating the entropy and the average code
−
length, we have H = 1.6477 and L (C) = 1.7. This gives the code rate of R = 96.92%.
The reader can verify that the code rate for a fixed-length code with 2 bit is
82.38%. This shows the significant improvement gained by using Hoffman code.
The importance of Hoffman code in signal and image processing cannot be
exaggerated. Compression technologies such as JPEG are all based on Hoffman
coding. Without this compression method, the storage and communication of biomedical signals would have been practically impossible.
6.6 REGISTRATION OF IMAGES
In practical medical imaging applications, sometimes the images of the same tissue (e.g., the brain) are taken using different modalities such as MRI, CT, and PET.
Knowing that each of these modalities provides certain types of information about
the imaged tissues, it is important to coregister these images with each other. This
allows the user to register the same objects in all images. For instance, image registration between MRI and CT of the head allows knowing the exact location of the
objects such as the basal ganglia in both MRI and CT images.
Registration is important even when the images of the same tissue are taken at
different times by the same modality or even by the same machine. It is often the
