Search in sources :

Example 1 with DicomPlaneViewer

use of artisynth.core.renderables.DicomPlaneViewer in project artisynth_core by artisynth.

the class DicomLoader method load.

void load() {
    String folder = fnf.getText();
    String pattern = fnp.getText();
    boolean subdirs = fns.getBooleanValue();
    if (viewer != null) {
        removeRenderable(viewer);
    }
    if (viewerPlanes.size() > 0) {
        for (DicomPlaneViewer dpv : viewerPlanes) {
            removeRenderable(dpv);
        }
        viewerPlanes.clear();
    }
    File file = new File(folder);
    String name = file.getName();
    viewer = new DicomViewer(name, file.getAbsolutePath(), Pattern.compile(pattern), subdirs);
    DicomImage image = viewer.getImage();
    System.out.println(image.toString());
    addRenderable(viewer);
    Main.getMain().getViewer().autoFit();
}
Also used : DicomPlaneViewer(artisynth.core.renderables.DicomPlaneViewer) DicomViewer(artisynth.core.renderables.DicomViewer) DicomImage(maspack.image.dicom.DicomImage) File(java.io.File)

Example 2 with DicomPlaneViewer

use of artisynth.core.renderables.DicomPlaneViewer in project artisynth_core by artisynth.

the class DicomLoader method addPlane.

void addPlane() {
    if (viewer == null) {
        return;
    }
    DicomImage image = viewer.getImage();
    Point3d pmin = new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
    Point3d pmax = new Point3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
    viewer.updateBounds(pmin, pmax);
    // center transform
    RigidTransform3d trans = new RigidTransform3d();
    trans.p.interpolate(pmin, 0.5, pmax);
    Vector2d size = new Vector2d(pmax.x - pmin.x, pmax.y - pmin.y);
    DicomPlaneViewer dpv = new DicomPlaneViewer("plane_" + viewerPlanes.size(), image, trans, size);
    addRenderable(dpv);
    viewerPlanes.add(dpv);
}
Also used : RigidTransform3d(maspack.matrix.RigidTransform3d) Vector2d(maspack.matrix.Vector2d) DicomPlaneViewer(artisynth.core.renderables.DicomPlaneViewer) Point3d(maspack.matrix.Point3d) DicomImage(maspack.image.dicom.DicomImage)

Aggregations

DicomPlaneViewer (artisynth.core.renderables.DicomPlaneViewer)2 DicomImage (maspack.image.dicom.DicomImage)2 DicomViewer (artisynth.core.renderables.DicomViewer)1 File (java.io.File)1 Point3d (maspack.matrix.Point3d)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 Vector2d (maspack.matrix.Vector2d)1