Search code examples
typesnumbersdm-script

What is difference between RealImage and IntegerImage?


What is difference between Realimage and Integerimage in DM script? I try these in my DM, not find differences.


Solution

  • The difference is the same as the option "Integer" or "Real" image when you create a new image from the menu.

    "Real" images store values as floating point numbers, i.e. you can store the following numbers: 1 , 2.3, -0.023, 1.23e12, ...

    "Integer" images store values as, well, integers. You can only store numbers like: -5, 0, 1234 but no comma-values.

    Both types of images have "limits" given by the amount of memory you use per pixel. (1,2,4, or 8 byte/pixel).
    For integer-images, the memory defines the "highest" and "lowest" number one can store.

    For real-images, the memory defines both the "highest" and "lowest" exponential to be used, and how many digits you can store. A real number is always represented as x,xxxxx * 10**y and the size of y and the number of x's is determined by the amount of memory you use.

    Normal "image" images in script are real-4-byte by default. The following script might make things clearer:

    image rImg := RealImage( "R", 4, 10 )
    image iImg := IntegerImage( "I", 4, 1, 10 )
    
    rImg = icol * 0.25
    iImg = icol * 0.25
    
    rImg.ShowImage()
    iImg.ShowImage()
    

    Both images get the values 0, 0.25, 0.50, 0.75, 1.00,... assigned by icol * 0.25, but because the integer image can only store integer values, they get truncated to in case of the iImg.

    It is also useful to compare with the dialog you get when you use the menu "File/New..." which shows the connection between image type, bytes and allowed value ranges in the "New Data Type" section:

    File/New...