Search in sources :

Example 1 with DicomViewer

use of artisynth.core.renderables.DicomViewer 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 DicomViewer

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

the class DicomTest method build.

public void build(String[] args) throws IOException {
    // download the BRAINIX dicom data if it does not already exist
    String localDir = ArtisynthPath.getSrcRelativePath(this, "data/MONO2_HEART");
    FileManager fileManager = new FileManager(localDir, "gz:" + dicom_url + "!/");
    fileManager.setConsoleProgressPrinting(true);
    // download zip file first
    fileManager.setOptions(FileManager.DOWNLOAD_ZIP);
    // extract
    File dicomPath = fileManager.get(dicom_file);
    DicomViewer dcp = new DicomViewer("Heart", dicomPath.getAbsolutePath(), null, /*check subdirectories*/
    false);
    addRenderable(dcp);
}
Also used : DicomViewer(artisynth.core.renderables.DicomViewer) File(java.io.File) FileManager(maspack.fileutil.FileManager)

Aggregations

DicomViewer (artisynth.core.renderables.DicomViewer)2 File (java.io.File)2 DicomPlaneViewer (artisynth.core.renderables.DicomPlaneViewer)1 FileManager (maspack.fileutil.FileManager)1 DicomImage (maspack.image.dicom.DicomImage)1