# Introduction to the a simplified toy-DICOM file format II (Solutions of the problems)

1. 1100=8*1+4*1+0*2+0*1=12=C.
2. C=12
3. CC=C*16+C=12*16+12=192+12=204
4. The question: From which direction do the place values increase?
5. The answer was: The space values increase from the right to the left. That is, in 1F CC the place value of 1F is 1 and the place values of CC is 256. 1F=31, CC=16*12+12=204. As a result: 1F CC = 31*1+204*256= 31+7936=7967
6. If the space values increase from the left to the right then we have
1F CC = 204+256*31= 204 + 7936 = 8140
7. No, it is impossible to decode the byte stream without asking questions: a) a. What is the grouping of the numbers: bytes, words, or the whole string represent only one decimal number? b) b. How to read the groups: from which direction do the place values increase?
8. 8. The answer for the first question a) a. These are words. That is, the right grouping is
11 01 1F 2A 11 11
b) b. The place values increase from he right to the left. That is
11 01 = 256*11+1= 256*17+1= 4353
1F 2A = 256*31+42=7936+32 = 7978
11 11 = 256*17+17=4352+17= 4369
The encoded sequence of decimal numbers is thent
4353, 7978, 4369
9. 9. Before answering the questions let us „rename” the special bytes (and only the special byte. How do we know which bytes are the special ones?) as follows:
00 - *
FF - +
11 - ()
Rewriting the byte stream given, we have now:
* 01 * 00 * 00 + 00 B1 + 00 00 + 00 11 () 42 59 45 11 42 59 45
It is clear that if we did not have the introductory 00=* then we did not know how to start reading our byte stream. Having rewritten our bytes we know now that we have three bytes first with he decimal values: 1, 0 és 0. Then we have 3 words whose values are:
00 B1 = 177, 00 00 = 0, 00 11 = 17
Finally the () symbol introduces a sequence of Latin-2 characters:
BYEBYE
Note having introduced the * symbol nobody will ask why we do not consider the third 00 in the original byte stream to be a special symbol. Clearly, by the definition of our coding system special symbols are followed by bytes or words and it is obvious that after a byte or a word a special symbol has to come. In the case of the () symbol the situation is a little more complicated. It is impossible to see when a character sequence ends.