如何使用digitalmicrograph(DM)脚本查询图像数据类型和大小?我想知道图像是有符号还是无符号,实数或整数,像素大小等等。
答案 0 :(得分:1)
有一些命令可以将此信息作为返回值返回,还有一些命令可以查询特定类型。您可以在以下F1帮助部分找到命令:
以下是一些示例代码:
number byteIN = 4
number sx = 10, sy = 10
image test := RealImage( "Test", byteIN, sx, sy )
// General commands
number dataTypeEnum = test.ImageGetDataType()
Result( "Image is of data type " + dataTypeEnum + ".\n" )
number byte = test.ImageGetDataElementByteSize()
number bits = test.ImageGetDataElementBitSize()
Result( "Image has " + byte +" bytes/pixel ( =" + bits + "bits/pixel )\n" )
// Some specific commands (there are more), all return Boolean
if ( test.ImageIsDataTypeFloat() )
Result( "Image is a real image.\n" )
if ( test.ImageIsDataTypeInteger() )
Result( "Image is an integer image.\n" )
if ( test.ImageIsDataTypeBinary() )
Result( "Image is a binary image.\n" )
if ( test.ImageIsDataTypeComplex() )
Result( "Image is a complex image.\n" )