def test_image_shape():
 point = np.zeros((5, 5), np.float)
 point[(2, 2)] = 1.0
 psf = ndi.gaussian_filter(point, sigma=1.0)
 image = skimage.img_as_float(camera()[110:155, 225:270])
 image_conv = ndi.convolve(image, psf)
 deconv_sup = restoration.wiener(image_conv, psf, 1)
 deconv_un = restoration.unsupervised_wiener(image_conv, psf)[0]
 np.testing.assert_equal(image.shape, deconv_sup.shape)
 np.testing.assert_equal(image.shape, deconv_un.shape)
 sup_relative_error = (np.abs((deconv_sup - image)) / image)
 un_relative_error = (np.abs((deconv_un - image)) / image)
 np.testing.assert_array_less(np.median(sup_relative_error), 0.1)
 np.testing.assert_array_less(np.median(un_relative_error), 0.1)

def test_image_shape ( ) : point = np . zeros ( ( 5 , 5 ) , np . float ) point [ ( 2 , 2 ) ] = 1.0 psf = ndi . gaussian_filter ( point , sigma = 1.0 ) image = skimage . img_as_float ( camera ( ) [ 110 : 155 , 225 : 270 ] ) image_conv = ndi . convolve ( image , psf ) deconv_sup = restoration . wiener ( image_conv , psf , 1 ) deconv_un = restoration . unsupervised_wiener ( image_conv , psf ) [ 0 ] np . testing . assert_equal ( image . shape , deconv_sup . shape ) np . testing . assert_equal ( image . shape , deconv_un . shape ) sup_relative_error = ( np . abs ( ( deconv_sup - image ) ) / image ) un_relative_error = ( np . abs ( ( deconv_un - image ) ) / image ) np . testing . assert_array_less ( np . median ( sup_relative_error ) , 0.1 ) np . testing . assert_array_less ( np . median ( un_relative_error ) , 0.1 )
test that shape of output image in deconvolution is same as input .