| 58 | self.assertEqual( maxOutputValue, 0.5 ) |
| 59 | |
| 60 | def testMinTo( self ) : |
| 61 | |
| 62 | image = IECore.Reader.create( os.path.join( "test", "IECoreImage", "data", "exr", "ramp.exr" ) ).read() |
| 63 | minInputValue = min( image["R"] ) |
| 64 | maxInputValue = max( image["R"] ) |
| 65 | |
| 66 | self.assertTrue( minInputValue < 0.125 ) |
| 67 | self.assertTrue( maxInputValue > 0.5 ) |
| 68 | |
| 69 | image2 = IECoreImage.ClampOp()( input=image, min=0.25, max=0.5, enableMinTo=True, minTo=0.125 ) |
| 70 | |
| 71 | minOutputValue = min( image2["R"] ) |
| 72 | maxOutputValue = max( image2["R"] ) |
| 73 | |
| 74 | self.assertEqual( minOutputValue, 0.125 ) |
| 75 | self.assertEqual( maxOutputValue, 0.5 ) |
| 76 | |
| 77 | intermediateValues = False |
| 78 | for v in image2["R"] : |
| 79 | if v > 0.125 and v < 0.25 : |
| 80 | intermediateValues = True |
| 81 | |
| 82 | self.assertFalse( intermediateValues ) |
| 83 | |
| 84 | def testMaxTo( self ) : |
| 85 | |