예제 #1
0
 @Test
 public void testfilt_cos2_quad() {
   Configuration.loadConfiguration();
   cuop.initCUDA();
   float[][] dirs = new float[6][3];
   AnisotropicFilterFunction.filt_get_filt_dirs(3, dirs);
   Volume3D one =
       op.createDirectionalWeights(3, size, dim, dirs[0], 1, VolumeOperator.FILTER_TYPE.QUADRATIC);
   CUDAVolume3D cudaVol =
       (CUDAVolume3D)
           cuop.createDirectionalWeights(
               3, size, dim, dirs[0], 1, VolumeOperator.FILTER_TYPE.QUADRATIC);
   cudaVol.fetch();
   assertVolumeEquality(one, cudaVol);
   cudaVol.destroy();
   one.destroy();
 }
예제 #2
0
 @Test
 public void testfilt_cos2r() {
   Configuration.loadConfiguration();
   cuop.initCUDA();
   float[][] dirs = new float[6][3];
   AnisotropicFilterFunction.filt_get_filt_dirs(3, dirs);
   Volume3D one =
       op.createExponentialDirectionalHighPassFilter(
           3, size, dim, dirs[0], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.NORMAL);
   CUDAVolume3D cudaVol =
       (CUDAVolume3D)
           cuop.createExponentialDirectionalHighPassFilter(
               3, size, dim, dirs[0], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.NORMAL);
   cudaVol.fetch();
   assertVolumeEquality(one, cudaVol);
   cudaVol.destroy();
   one.destroy();
 }
예제 #3
0
  @Test
  public void testfilt_solve_max_eigenValue() {
    Configuration.loadConfiguration();
    cuop.initCUDA();
    int[] size = {30, 30, 30};
    this.size = size;
    float[][] dirs = new float[6][3];
    AnisotropicFilterFunction.filt_get_filt_dirs(3, dirs);

    Volume3D a11 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[0], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    Volume3D a12 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[1], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    Volume3D a13 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[2], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    Volume3D a22 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[3], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    Volume3D a23 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[4], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    Volume3D a33 =
        op.createExponentialDirectionalHighPassFilter(
            3, size, dim, dirs[5], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    op.real(a11);
    op.real(a12);
    op.real(a13);
    op.real(a22);
    op.real(a23);
    op.real(a33);
    Volume3D[][] st = new Volume3D[3][3];
    st[0][0] = a11;
    st[0][1] = a12;
    st[0][2] = a13;
    st[1][0] = a12;
    st[1][1] = a22;
    st[1][2] = a23;
    st[2][0] = a13;
    st[2][1] = a23;
    st[2][2] = a33;
    CUDAVolume3D ca11 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[0], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    CUDAVolume3D ca12 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[1], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    CUDAVolume3D ca13 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[2], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    CUDAVolume3D ca22 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[3], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    CUDAVolume3D ca23 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[4], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    CUDAVolume3D ca33 =
        (CUDAVolume3D)
            cuop.createExponentialDirectionalHighPassFilter(
                3, size, dim, dirs[5], 1, 2.0f, 1.5f, VolumeOperator.FILTER_TYPE.QUADRATIC);
    cuop.real(ca11);
    cuop.real(ca12);
    cuop.real(ca13);
    cuop.real(ca22);
    cuop.real(ca23);
    cuop.real(ca33);
    CUDAVolume3D[][] cst = new CUDAVolume3D[3][3];
    cst[0][0] = ca11;
    cst[0][1] = ca12;
    cst[0][2] = ca13;
    cst[1][1] = ca22;
    cst[1][2] = ca23;
    cst[2][2] = ca33;

    // new ImageJ();
    Volume3D one = op.solveMaximumEigenvalue(st);
    // one.getImagePlus("CPU Result").show();
    CUDAVolume3D cudaVol = (CUDAVolume3D) cuop.solveMaximumEigenvalue(cst);
    cudaVol.fetch();
    // cudaVol.getImagePlus("CUDA Result").show();
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    assertWeakVolumeEquality(one, cudaVol);
    a11.destroy();
    a12.destroy();
    a13.destroy();
    a22.destroy();
    a23.destroy();
    a33.destroy();
    ca11.destroy();
    ca12.destroy();
    ca13.destroy();
    ca22.destroy();
    ca23.destroy();
    ca33.destroy();
    cudaVol.destroy();
    one.destroy();
  }