| 82 | self.assertFalse( intermediateValues ) |
| 83 | |
| 84 | def testMaxTo( self ) : |
| 85 | |
| 86 | image = IECore.Reader.create( os.path.join( "test", "IECoreImage", "data", "exr", "ramp.exr" ) ).read() |
| 87 | minInputValue = min( image["R"] ) |
| 88 | maxInputValue = max( image["R"] ) |
| 89 | |
| 90 | self.assertTrue( minInputValue < 0.125 ) |
| 91 | self.assertTrue( maxInputValue > 0.5 ) |
| 92 | |
| 93 | image2 = IECoreImage.ClampOp()( input=image, min=0.25, max=0.5, enableMaxTo=True, maxTo=0.75 ) |
| 94 | |
| 95 | minOutputValue = min( image2["R"] ) |
| 96 | maxOutputValue = max( image2["R"] ) |
| 97 | |
| 98 | self.assertEqual( minOutputValue, 0.25 ) |
| 99 | self.assertEqual( maxOutputValue, 0.75 ) |
| 100 | |
| 101 | intermediateValues = False |
| 102 | for v in image2["R"] : |
| 103 | if v > 0.5 and v < 0.75 : |
| 104 | intermediateValues = True |
| 105 | |
| 106 | self.assertFalse( intermediateValues ) |
| 107 | |
| 108 | def testMinToAndMaxTo( self ) : |
| 109 | |