| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] | SDC Morphology Toolbox V1.1 15Jan02 |
mmdataconv The SDC Morphology Toolbox supports binary and gray-scale images (or signals) . The binary images (or signals) are represented in the logical uint8 data type, while the gray-scale images (or signals) are represented in the uint8 and uint16 data types. Note that any image (or signal) represented in logical uint8 may be represented in uint8 or uint16 and that any image (or signal) in uint8 may be represented in uint16.
If an image (or signal) is not in the required data type, than it should be converted to the maximum and nearest SDC Morphology Toolbox data type. For example, if an image (or signal) is in DOUBLE and a morphological gray-scale processing is required, it should be converted to uint16. Another example, if a uint8 logical image (or signal) should be added to a uint8 image (or signal), the logical uint8 image (or signal) should be converted to uint8.
In cases of operators that have as parameters an image (or signal) and a constant, the type of the image (or signal) should be kept as reference, while the type of the constant should be converted, if necessary.
There are two cases that should be considered: conversion to a binary and to a gray-scale image (or signal). In the first case, 0 should be kept and values different of 0 should be converted to 1, while in the second one, it is necessary casting to uint8 or uint16.
The SDC Morphology Toolbox has the possibility of automatic data type conversion. The function mmfreedom controls the type conversion.
There are 3 possible levels, called FREEDOM levels, for automatic conversion:
0 - image type conversion is not allowed;
1 - image type conversion is allowed, but a warning is sent for each conversion;
2 - image type conversion is allowed without warning. The FREEDOM levels are set or inquired by mmfreedom.
a=mmneg([0 1 2]) Warning: Converting image from double to uint16. a = 65535 65534 65533 whos('a') Name Size Bytes Class a 1x3 6 uint16 array Grand total is 3 elements using 6 bytes |
a=mmneg(logical([0 1 2])) Warning: Converting image from binary double to binary uint8. a = 1 0 0 whos('a') Name Size Bytes Class a 1x3 3 uint8 array (logical) Grand total is 3 elements using 3 bytes |
a=mmsubm([4 2 1],uint8([3 2 0])) Warning: Converting image from double to uint16. Warning: Converting image from uint8 to uint16. a = 1 0 1 whos('a') Name Size Bytes Class a 1x3 6 uint16 array Grand total is 3 elements using 6 bytes |
a=mmsubm([4 2 1], logical([3 2 0])) Warning: Converting image from double to uint16. Warning: Converting image from binary double to uint16. a = 3 1 1 whos('a') Name Size Bytes Class a 1x3 6 uint16 array Grand total is 3 elements using 6 bytes |
a=mmsubm(uint8([4 3 2 1]), 1) Warning: Converting image from scalar to uint8. a = 3 2 1 0 whos('a') Name Size Bytes Class a 1x4 4 uint8 array Grand total is 4 elements using 4 bytes |
a=mmsubm(2, logical([0 1 2 3])) Warning: Converting image from scalar to binary uint8. Warning: Converting image from binary double to binary uint8. a = 1 0 0 0 whos('a') Name Size Bytes Class a 1x4 4 uint8 array (logical) Grand total is 4 elements using 4 bytes |
| [Top] [Up] [Prev] [Next] | [Up] [Basic Concepts] [Demonstrations] [Functions] |
|
| Copyright (c) 1998-2002 by SDC Information Systems | ||