Dicom Conversion Calculator can Handle Binary, Octal, Hexadecimal and Arbitrary Based Numbers
In Dicom a value without any base indicator is a decimal value as usual.
Example: 100, 1.234, 1e-10 etc.
However you can specify the base value of a number in Dicom. To do this you need to follow the syntax below:
0b<base value>:<number>
Here, base value can be any value between 2 and 36
Example:
Binary number or base-2
0b2:10101010 (decimal 170)
Octal number or base-8
0b8:1234567 (decimal 342391)
Hexadecimal number or base-16
0b16:2345FF (decimal 2311679)
An arbitrary base-36 number
0b36:19ADZ (decimal 2112983)
Note that the digits and letters allowed in an arbitrary N (36>=N>=2) based number are first N number of digits and letters from the list below:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Thus for a binary number only allowed digits are: 0 and 1.
For an octal number allowed digits are 0 to 7.
For a hexadecimal number allowed digits are 0 to 9 and letters A to F.
For a 36 based number all 36 values (0 to 9 plus A to Z) are allowed.
If you don't specify digits and letters from the allowed range an "Unknown string" or "Missing operator" error will occur.
Converting a Decimal Number to a Base-N Number
You can use FORMAT command to specify the base value to be converted to. The syntax is as below:
FORMAT '0b<base value>'
Example:
FORMAT '0b2'; 170
= 0b2:10101010
FORMAT '0b8'; 342391
= 0b8:1234567
FORMAT '0b16'; 2311679
= 0b16:2345ff
FORMAT '0b36'; 2112983
= 0b36:19adz
Note that FORMAT command without any specification will reset Dicom to decimal value formatting.
Converting a Base-X number to a Base-Y Number
Set FORMAT to specify base value Y to convert to. Enter the X-based representation of the number to convert.
Example: Convert binary 10101010 to hexadecimal number
FORMAT '0b16'; 0b2:10101010
= 0b16:aa
<< Home