def testFilter( self ) : r = GafferImage.ImageReader() r["fileName"].setValue( os.path.dirname( __file__ ) + "/images/radial.exr" ) m = GafferImage.Dilate() m["in"].setInput( r["out"] ) self.assertImagesEqual( m["out"], r["out"] ) m["radius"].setValue( imath.V2i( 12 ) ) m["boundingMode"].setValue( GafferImage.Sampler.BoundingMode.Clamp ) dataWindow = m["out"]["dataWindow"].getValue() s = GafferImage.Sampler( m["out"], "R", dataWindow ) self.assertEqual( s.sample( 112, 112 ), 1.0 )
def testExpandDataWindow(self): c = GafferImage.Constant() m = GafferImage.Dilate() m["in"].setInput(c["out"]) m["radius"].setValue(imath.V2i(1)) self.assertEqual(m["out"]["dataWindow"].getValue(), c["out"]["dataWindow"].getValue()) m["expandDataWindow"].setValue(True) self.assertEqual( m["out"]["dataWindow"].getValue().min(), c["out"]["dataWindow"].getValue().min() - imath.V2i(1)) self.assertEqual( m["out"]["dataWindow"].getValue().max(), c["out"]["dataWindow"].getValue().max() + imath.V2i(1))
def nodeMenuCreateCommand(menu): erode = GafferImage.Dilate() erode["radius"].gang() return erode