Beispiel #1
0
    def preview(self, event):
        """ @brief Load a downsampled version of the full ASDF
        """
        params = self.get_params(get_bounds=False)
        if params is None:  return
        for p in params:    exec('{0} = params["{0}"]'.format(p))

        voxels = ni * nj * nk

        shift = int(ceil(log(voxels / 128.**3, 8)))
        full = Region(
            (0, 0, 0), (ni-1, nj-1, nk-1), 1, dummy=True
        )
        libfab.build_arrays(
            full, 0, 0, 0, ni*mm, nj*mm, nk*mm
        )
        full.free_arrays = True

        asdf = ASDF(
            libfab.import_vol_region(
                self.filename, ni, nj, nk, full, shift, density,
                True, close_boundary
            )
        )
        mesh = asdf.triangulate()

        koko.FRAME.get_menu('View', '3D').Check(True)
        koko.APP.render_mode('3D')
        koko.GLCANVAS.load_mesh(mesh)
        koko.GLCANVAS.snap = True
Beispiel #2
0
    def run(self, event):
        params = self.get_params()
        for p in params:    exec('{0} = params["{0}"]'.format(p))

        full = Region(
            (imin, jmin, kmin),
            (imax, jmax, kmax),
            1, dummy=True
        )
        libfab.build_arrays(
            full, imin*mm, jmin*mm, kmin*mm, (imax+1)*mm, (jmax+1)*mm, (kmax+1)*mm
        )
        # Position the lower corner based on imin, jmin, kmin
        full.imin = imin
        full.jmin = jmin
        full.kmin = kmin
        full.free_arrays = True

        koko.FRAME.status = 'Importing ASDF'
        wx.Yield()

        asdf = ASDF(
            libfab.import_vol_region(
                self.filename, ni, nj, nk, full, 0, density,
                True, close_boundary
            )
        )

        koko.FRAME.status = 'Triangulating'
        wx.Yield()

        mesh = asdf.triangulate()
        koko.FRAME.get_menu('View', '3D').Check(True)
        koko.APP.render_mode('3D')
        koko.GLCANVAS.load_mesh(mesh)
        koko.GLCANVAS.snap = True
        koko.FAB.set_input(asdf)

        koko.FRAME.status = ''
        koko.APP.mode = 'asdf'
        koko.APP.filename = None
        koko.APP.savepoint(False)