use of maspack.image.dicom.DicomImage 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();
}
use of maspack.image.dicom.DicomImage 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);
}
Aggregations