TestCenter Reference
TestSupport.Image Namespace Reference

Support functions regarding image handling. More...

Functions

 calculateHashFromImage (fileName, hashMethod='SHA256', encoder='Hex')
 Calculate the hash of the given image.
 
 getVoxelValue (outFieldName, position, coordinateType="Voxel", useStoredValue=False)
 Get the voxel value of the given field at the given position.
 
 compareImages (outFieldA, outFieldB)
 Compare the two given images (excluding the extention properties).
 
 compareImagesProperties (outFieldA, outFieldB)
 Compare just the properties of the two given images (excluding page extent, the extension properties, and of course the image data).
 
 compareImagesData (outFieldA, outFieldB)
 Compare the two given images (only verifying data).
 
 compareImagesAllProps (outFieldA, outFieldB)
 Compare the two given images.
 
 getTrueMinMaxValues (outFieldName)
 Returns the true min/max range of the image data, which is therefore scanned entirely using a MinMaxScan module.
 
 verifyMinMaxPropertyValues (outFieldName, expectedMin=None, expectedMax=None, requireExactMin=False, requireExactMax=False, logOnSuccess=True)
 Verifies the min/max image property values.
 

Detailed Description

Support functions regarding image handling.

Function Documentation

◆ calculateHashFromImage()

TestSupport.Image.calculateHashFromImage ( fileName,
hashMethod = 'SHA256',
encoder = 'Hex' )

Calculate the hash of the given image.

The method will use the ImageHash module to get the hash of the images content. For supported hash methods and encodings see ImageHash module.

Parameters
fileNameThe name of the input file.
hashMethodThe hash to be computed.
encoderThe encoder to be used.
Returns
The hash of the content of the given file.

Definition at line 34 of file Image.py.

◆ compareImages()

TestSupport.Image.compareImages ( outFieldA,
outFieldB )

Compare the two given images (excluding the extention properties).

(??)

Definition at line 114 of file Image.py.

◆ compareImagesAllProps()

TestSupport.Image.compareImagesAllProps ( outFieldA,
outFieldB )

Compare the two given images.

Definition at line 133 of file Image.py.

◆ compareImagesData()

TestSupport.Image.compareImagesData ( outFieldA,
outFieldB )

Compare the two given images (only verifying data).

Definition at line 127 of file Image.py.

◆ compareImagesProperties()

TestSupport.Image.compareImagesProperties ( outFieldA,
outFieldB )

Compare just the properties of the two given images (excluding page extent, the extension properties, and of course the image data).

Definition at line 121 of file Image.py.

◆ getTrueMinMaxValues()

TestSupport.Image.getTrueMinMaxValues ( outFieldName)

Returns the true min/max range of the image data, which is therefore scanned entirely using a MinMaxScan module.

Parameters
outFieldNameString: Name of the output image field
Returns
tuple(Number, Number): Returns a tuple (trueMinimumValue, trueMaximumValue) or (None, None) if the image could not be scanned

Definition at line 138 of file Image.py.

Referenced by TestSupport.Image.verifyMinMaxPropertyValues().

◆ getVoxelValue()

TestSupport.Image.getVoxelValue ( outFieldName,
position,
coordinateType = "Voxel",
useStoredValue = False )

Get the voxel value of the given field at the given position.

The coordinate type is either "Voxel" or "World". The return value is a tuple with the string and scalar representation of the voxel value.

Parameters
outFieldNameName of the output field.
positionThe position as a string.
coordinateTypeType of coordinate system.
useStoredValueUse the stored value instead of the output value.
Returns
Tuple with the string and scalar representation of the value.

Definition at line 69 of file Image.py.

◆ verifyMinMaxPropertyValues()

TestSupport.Image.verifyMinMaxPropertyValues ( outFieldName,
expectedMin = None,
expectedMax = None,
requireExactMin = False,
requireExactMax = False,
logOnSuccess = True )

Verifies the min/max image property values.

By default (none of the optional arguments provided) the functions just checks if the min/max range specified by the image properties include the actual min/max range of the image data, which is therefore scanned. Note that this check is always done, since ML images always need to fulfill the condition. In addition, it is possible to check against expected values, or to require exact matches of the range boundaries (using the expected values, if provided, and the actual values otherwise). Logs an error if the output image is valid and any of the checks fail. @outFieldName String: Name of the output image field to perform the check on.

Parameters
expectedMinNumber: If given, the minimum value image property is compared against expectedMin
expectedMaxNumber: If given, the maximum value image property is compared against expectedMax
requireExactMinBool: If given, the minimum value image property must be identical to expectedMin (if given) or the actual image minimum (otherwise)
requireExactMaxBool: If given, the maximum value image property must be identical to expectedMax (if given) or the actual image maximum (otherwise)
logOnSuccessBool: If enabled, provide success message

Definition at line 159 of file Image.py.

References TestSupport.Image.getTrueMinMaxValues().