TestCenter Reference
TestSupport.Image Namespace Reference

Support functions regarding image handling. More...

Functions

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

Detailed Description

Support functions regarding image handling.

Function Documentation

◆ calculateHashFromImage()

def 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.

References TestSupport.Fields.touch().

◆ compareImages()

def TestSupport.Image.compareImages (   outFieldA,
  outFieldB 
)

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

(??)

Definition at line 114 of file Image.py.

◆ compareImagesAllProps()

def TestSupport.Image.compareImagesAllProps (   outFieldA,
  outFieldB 
)

Compare the two given images.

Definition at line 133 of file Image.py.

◆ compareImagesData()

def TestSupport.Image.compareImagesData (   outFieldA,
  outFieldB 
)

Compare the two given images (only verifying data).

Definition at line 127 of file Image.py.

◆ compareImagesProperties()

def 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()

def 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.

References TestSupport.Fields.touch().

Referenced by TestSupport.Image.verifyMinMaxPropertyValues().

◆ getVoxelValue()

def 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.

References TestSupport.Fields.touch().

◆ verifyMinMaxPropertyValues()

def 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().