Ejemplo n.º 1
0
def test_sigma2fwhm():
    # Test from constant
    assert_almost_equal(sigma2fwhm(1), 2.3548200)
    assert_almost_equal(sigma2fwhm([1, 2, 3]), np.arange(1, 4) * 2.3548200)
    assert_almost_equal(fwhm2sigma(2.3548200), 1)
    assert_almost_equal(fwhm2sigma(np.arange(1, 4) * 2.3548200), [1, 2, 3])
    # direct test fwhm2sigma and sigma2fwhm are inverses of each other
    fwhm = np.arange(1.0, 5.0, 0.1)
    sigma = np.arange(1.0, 5.0, 0.1)
    assert_true(np.allclose(sigma2fwhm(fwhm2sigma(fwhm)), fwhm))
    assert_true(np.allclose(fwhm2sigma(sigma2fwhm(sigma)), sigma))
Ejemplo n.º 2
0
def test_sigma2fwhm():
    # Test from constant
    assert_almost_equal(sigma2fwhm(1), 2.3548200)
    assert_almost_equal(sigma2fwhm([1, 2, 3]), np.arange(1, 4) * 2.3548200)
    assert_almost_equal(fwhm2sigma(2.3548200), 1)
    assert_almost_equal(fwhm2sigma(np.arange(1, 4) * 2.3548200), [1, 2, 3])
    # direct test fwhm2sigma and sigma2fwhm are inverses of each other
    fwhm = np.arange(1.0, 5.0, 0.1)
    sigma = np.arange(1.0, 5.0, 0.1)
    assert np.allclose(sigma2fwhm(fwhm2sigma(fwhm)), fwhm)
    assert np.allclose(fwhm2sigma(sigma2fwhm(sigma)), sigma)
Ejemplo n.º 3
0
 def __init__(self, dimension_selection, slice_number, smoothing_sigma,
              gauss_sigma, threshold):
     # Image parameters
     self.Number_of_images = 0
     self.dimension_option = dimension_selection
     self.slice = slice_number
     #Smoothing parameters
     self.fwhm = processing.sigma2fwhm(smoothing_sigma)
     self.gauss = gauss_sigma
     #Data parameters
     self.threshold = threshold
     #Data dimension options based on representation selection
     self.reshape_parm = (0, 0)
     if self.dimension_option == '2D':
         dim_1 = 176
         dim_2 = 208
         self.image_dimension = dim_1 * dim_2
         self.dim = [dim_1, dim_2]
     elif self.dimension_option == '3D':
         dim_1 = 176
         dim_2 = 208
         dim_3 = 176
         self.image_dimension = dim_1 * dim_2 * dim_3
         self.dim = [dim_1, dim_2, dim_3]
     else:
         self.dimension_option = '2D'  # set a default option
         dim_1 = 176
         dim_2 = 208
         self.image_dimension = dim_1 * dim_2
         self.dim = [dim_1, dim_2]