public static Icon getSystemIcon(final MediaElement dObj) { return getSystemIcon(dObj.getFileCache().getOriginalFile().orElse(null)); }
@Override public void loadContent(Path path, Filter<Path> filter) { if (path == null) { return; } clear(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(path, filter)) { StreamSupport.stream(stream.spliterator(), false).sorted(Comparator.comparing(Path::getFileName)) .forEachOrdered(p -> { MediaReader media = ViewerPluginBuilder.getMedia(p.toFile()); if (media != null) { MediaElement preview = media.getPreview(); if (preview instanceof ImageElement) { preview.getFileCache().setRequireTransformation(true); addElement((E) preview); } if (getSize() == 1) { this.list.setSelectedIndex(0); } } }); } catch (IOException e) { LOGGER.error("Building child directories", e); //$NON-NLS-1$ } }
private static boolean writeInDicomDir(DicomDirWriter writer, MediaElement img, DefaultMutableTreeNode node, String iuid, File destinationFile) throws IOException { if (writer != null) { if (!(img.getMediaReader() instanceof DcmMediaReader) || ((DcmMediaReader) img.getMediaReader()).getDicomObject() == null) { LOGGER.error("Cannot export DICOM file: ", img.getFileCache().getOriginalFile().orElse(null)); //$NON-NLS-1$ return false; } return writeInDicomDir(writer, ((DcmMediaReader) img.getMediaReader()).getDicomObject(), node, iuid, destinationFile); } return false; }
@Override public PlanarImage getImageFragment(MediaElement media) throws Exception { Objects.requireNonNull(media); FileCache cache = media.getFileCache();
private PlanarImage getUncacheImage(MediaElement media, int frame) throws IOException { FileCache cache = media.getFileCache(); Optional<File> orinigal = cache.getOriginalFile(); if (orinigal.isPresent()) {