Esempio n. 1
0
 def test_Wavelet3D_PyWt(self):
     """Test the adjoint operator for the 3D Wavelet transform
     """
     for ch in self.num_channels:
         print("Testing with Num Channels : " + str(ch))
         for i in range(self.max_iter):
             print("Process Wavelet3D PyWt test '{0}'...", i)
             wavelet_op_adj = WaveletN(
                 wavelet_name="sym8",
                 nb_scale=4,
                 dim=3,
                 padding_mode='periodization',
                 n_coils=ch,
                 n_jobs=-1,
             )
             Img = np.squeeze(
                 np.random.randn(ch, self.N, self.N, self.N) +
                 1j * np.random.randn(ch, self.N, self.N, self.N)
             )
             f_p = wavelet_op_adj.op(Img)
             f = (np.random.randn(*f_p.shape) +
                  1j * np.random.randn(*f_p.shape))
             I_p = wavelet_op_adj.adj_op(f)
             x_d = np.vdot(Img, I_p)
             x_ad = np.vdot(f_p, f)
             np.testing.assert_allclose(x_d, x_ad, rtol=1e-5)
     print(" Wavelet3 adjoint test passes")
 def test_Wavelet2D_PyWt(self):
     """Test the adjoint operator for the 2D Wavelet transform
     """
     for i in range(self.max_iter):
         print("Process Wavelet2D PyWt test '{0}'...", i)
         wavelet_op_adj = WaveletN(wavelet_name="sym8", nb_scale=4)
         Img = (np.random.randn(self.N, self.N) +
                1j * np.random.randn(self.N, self.N))
         f_p = wavelet_op_adj.op(Img)
         f = (np.random.randn(*f_p.shape) +
              1j * np.random.randn(*f_p.shape))
         I_p = wavelet_op_adj.adj_op(f)
         x_d = np.vdot(Img, I_p)
         x_ad = np.vdot(f_p, f)
         np.testing.assert_allclose(x_d, x_ad, rtol=1e-6)
     print(" Wavelet2 adjoint test passes")
Esempio n. 3
0
 def test_Wavelet2D_ISAP(self):
     """Test the adjoint operator for the 2D Wavelet transform
     """
     for ch in self.num_channels:
         print("Testing with Num Channels : " + str(ch))
         for i in range(self.max_iter):
             print("Process Wavelet2D_ISAP test '{0}'...", i)
             wavelet_op_adj = WaveletN(wavelet_name="HaarWaveletTransform",
                                       nb_scale=4,
                                       n_coils=ch,
                                       n_jobs=2)
             Img = np.squeeze(
                 np.random.randn(ch, self.N, self.N) +
                 1j * np.random.randn(ch, self.N, self.N))
             f_p = wavelet_op_adj.op(Img)
             f = (np.random.randn(*f_p.shape) +
                  1j * np.random.randn(*f_p.shape))
             I_p = wavelet_op_adj.adj_op(f)
             x_d = np.vdot(Img, I_p)
             x_ad = np.vdot(f_p, f)
             np.testing.assert_allclose(x_d, x_ad, rtol=1e-5)
     print(" Wavelet2 adjoint test passes")