Examples of ThebaGUI


Examples of net.sourceforge.theba.core.gui.ThebaGUI

        int height = voxels.getHeight();
        int depth = voxels.getDepth();
        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];
        ThebaGUI control = ThebaGUI.getInstance();
        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);
        for (int z = 0; z < depth; z++) {
            short[] origdata = voxels.getSlice(z);
            control.setProgress(z);
            if (control.isStopped())
                return;
            int index = 0;
            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    short max = data[index];
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

                    }
                }
            }
            control.updateImage();
        }
        ThebaGUI control = ThebaGUI.getInstance();
        for (int z = 0; z < depth; z++) {
            short[] data = control.getSlice(z);
            control.setProgress(z);
            if (control.isStopped())
                return;
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
                    int index = x + y * width;
                    if (data[index] == 255)
                        continue;
                    if ((data[index] & (1 << 12)) != 0) {
                        data[index] = (short) (data[index] & ~(1 << 12));
                    } else {
                        data[index] = 0;
                    }
                }
            }
        }
        control.updateImage();
    }
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        int height = voxels.getHeight();
        int depth = voxels.getDepth();
        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];
        ThebaGUI control = ThebaGUI.getInstance();
        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);
        for (int z = 0; z < depth; z++) {
            control.setProgress(z);
            if (control.isStopped())
                return;
            int index = 0;
            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    short max = data[index];
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        int height = voxels.getHeight();
        int depth = voxels.getDepth();
        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];
        ThebaGUI control = ThebaGUI.getInstance();
        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);
        for (int z = 0; z < depth; z++) {
            control.setProgress(z);
            if (control.isStopped())
                return;
            int index = 0;
            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    short min = data[index];
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

     */
    public static void distance3d(Stack voxels) {
        int width = voxels.getWidth();
        int height = voxels.getHeight();
        int depth = voxels.getDepth();
        ThebaGUI control = ThebaGUI.getInstance();
        // set borders to 0
        for (int z = 0; z < depth; z++) {
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
                    int index = x + y * width;
                    if (z == 0 || x == 0 || y == 0 || z == depth - 1
                            || y == height - 1 || x == width - 1)
                        voxels.getSlice(z)[index] = (short) 0;
                    else
                        voxels.getSlice(z)[index] = (short) (0xff - (voxels
                                .getSlice(z)[index]));
                }
            }
        }
        // int a = 3, b = 4, c = 3, d = 4, e = 5;
        int a = 3, b = 4, c = 5, d = 3, e = 7;
        int[] wf = new int[]{e, d, e, d, c, d, e, d, e, b, a, b, a, 255, 255,
                255, 255, 255,};
        int[] wb = new int[]{255, 255, 255, 255, 255, a, b, a, b, e, d, e, d,
                c, d, e, d, e,};
        int[] slask = new int[2 * 3 * 3];
        // Note that we ignore pixels on the edge of the image to avoid problems
        for (int z = 1; z < depth - 1; z++) {
            control.setProgress(z / 2);
            for (int x = 1; x < width - 1; x++) {
                for (int y = 1; y < height - 1; y++) {
                    int index = x + y * width;
                    for (int k = -1; k < 1; k++) {
                        for (int j = -1; j < 2; j++) {
                            for (int i = -1; i < 2; i++) {
                                int slaskindex = (i + 1) + (j + 1) * 3
                                        + (k + 1) * 3 * 3;
                                slask[slaskindex] = (voxels.getSlice(z + k)[index
                                        + (i) + j * width])
                                        + wf[slaskindex];
                            }
                        }
                    }
                    int minval = slask[0]; // init to max
                    for (int i = 1; i < slask.length; i++) {
                        if ((slask[i]) < minval)
                            minval = (slask[i]);
                    }
                    if ((voxels.getSlice(z)[index]) > minval) {
                        voxels.getSlice(z)[index] = (short) minval;
                    }
                }
            }
        }
        // Second backward iteration:
        for (int z = depth - 2; z > 0; z--) {
            control.setProgress((depth - z / 2));
            for (int x = width - 2; x > 0; x--) {
                for (int y = height - 2; y > 0; y--) {
                    int index = x + y * width;
                    for (int k = 0; k < 2; k++) {
                        for (int j = -1; j < 2; j++) {
                            for (int i = -1; i < 2; i++) {
                                int slaskindex = (i + 1) + (j + 1) * 3 + (k)
                                        * 3 * 3;
                                slask[slaskindex] = (voxels.getSlice(z + k)[index
                                        + (i) + j * width])
                                        + wb[slaskindex];
                            }
                        }
                    }
                    int minval = slask[0]; // init to max
                    for (int i = 1; i < slask.length; i++) {
                        if ((slask[i]) < minval)
                            minval = (slask[i]);
                    }
                    if ((voxels.getSlice(z)[index]) > minval)
                        voxels.getSlice(z)[index] = (short) minval;
                }
            }
        }
        try {
            System.out.println("Writing to file dmap.raw");
            FileOutputStream fs = new FileOutputStream("dmap.raw");
            short[] buffer = new short[width]; // read and write one scanline at once
            for (int z = 0; z < depth; z++)
                for (int y = 0; y < height; y++) {
                    for (int x = 0; x < width; x++) {
                        buffer[x] = voxels.getSlice(z)[x + y * width];
                    }
                    byte[] out = DataConversion.shortToBytes(buffer);
                    fs.write(out);
                }
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        control.setProgressComplete();
    }
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        int height = voxels.getHeight();
        int depth = voxels.getDepth();
        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];
        ThebaGUI control = ThebaGUI.getInstance();
        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);
        for (int z = 1; z < depth - 1; z++) {
            if (control.isStopped())
                return;
            control.setProgress(z);
            for (int x = 1; x < width - 1; x++) {
                for (int y = 1; y < height - 1; y++) {
                    int offset = x + y * width;
                    int count = 0;
                    for (int i = -1; i < 2; i++) {
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];

        ThebaGUI control = ThebaGUI.getInstance();

        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);

        for (int z = 0; z < depth; z++) {

            short[] origdata = voxels.getSlice(z);

            control.setProgress(z);

            if (control.isStopped()) {
                return;
            }

            int index = 0;

View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

                }
            }
            control.updateImage();
        }

        ThebaGUI control = ThebaGUI.getInstance();
        for (int z = 0; z < depth; z++) {

            short[] data = control.getSlice(z);
            control.setProgress(z);
            if (control.isStopped()) {
                return;
            }

            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
                    int index = x + y * width;
                    if (data[index] == 255)
                        continue;
                    if ((data[index] & (1 << 12)) != 0) {
                        data[index] = (short) (data[index] & ~(1 << 12));
                    } else {
                        data[index] = 0;
                    }
                }
            }
        }

        control.updateImage();

    }
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        short[] prevdata = new short[width * height];
        short[] data = new short[width * height];
        short[] nextdata = new short[width * height];

        ThebaGUI control = ThebaGUI.getInstance();

        System.arraycopy(voxels.getSlice(1), 0, nextdata, 0, nextdata.length);
        System.arraycopy(voxels.getSlice(0), 0, data, 0, data.length);

        for (int z = 0; z < depth; z++) {

            short[] origdata = voxels.getSlice(z);

            control.setProgress(z);

            if (control.isStopped())
                return;

            int index = 0;

            if (z > 0)
View Full Code Here

Examples of net.sourceforge.theba.core.gui.ThebaGUI

        for (int i = 0; i < 10; i++) {
            dilate3d_toWhite(control.getStack());
        }

        ThebaGUI control = ThebaGUI.getInstance();

        for (int z = 0; z < depth; z++) {

            short[] data = control.getSlice(z);

            control.setProgress(z);

            if (control.isStopped())
                return;

            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {

                    int index = x + y * width;

                    if (data[index] == 255) {
                        continue;
                    }

                    if ((data[index] & (1 << 12)) != 0) {
                        data[index] = (short) (data[index] & ~(1 << 12));
                    } else {
                        data[index] = 0;
                    }
                }
            }
        }

        control.updateImage();

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.