public synchronized void reBuildThumbnail(File file, MediaSeries.MEDIA_POSITION position) { MediaElement media = series.getMedia(position, null, null); // Handle special case for DICOM SR if (media == null) { List<MediaElement> specialElements = (List<MediaElement>) series.getTagValue(TagW.DicomSpecialElementList); if (specialElements != null && !specialElements.isEmpty()) { media = specialElements.get(0); } } if (file != null || media != null) { mediaPosition = position; if (thumbnailPath != null && thumbnailPath.getPath().startsWith(AppProperties.FILE_CACHE_DIR.getPath())) { FileUtil.delete(thumbnailPath); // delete old temp file } thumbnailPath = file; readable = true; /* * Do not remove the image from the cache after building the thumbnail when the series is associated to a * explorerModel (stream should be closed at least when closing the application or when free the cache). */ buildThumbnail(media, series.getTagValue(TagW.ExplorerModel) != null, null); revalidate(); repaint(); } }
@Override public void mouseReleased(MouseEvent e) { if (progressBar != null) { // To avoid concurrency issue JProgressBar bar = progressBar; if (bar.isVisible()) { Point p = e.getPoint(); p.translate(-(thumbnailSize - stopButton.width), -5); if (stopButton.contains(p)) { SeriesImporter loader = series.getSeriesLoader(); if (loader != null) { loader.stop(); } repaint(); return; } p.translate(3 * BUTTON_SIZE_HALF, 0); if (startButton.getBounds().contains(p)) { SeriesImporter loader = series.getSeriesLoader(); if (loader != null) { loader.resume(); } repaint(); } } } }
thumbnail.reBuildThumbnail(MediaSeries.MEDIA_POSITION.MIDDLE); } else { thumbnail.repaint();
t = DicomExplorer.createThumbnail(dicomSeries, dicomModel, Thumbnail.DEFAULT_SIZE); dicomSeries.setTag(TagW.Thumbnail, t); Optional.ofNullable(t).ifPresent(v -> v.repaint());
t = DicomExplorer.createThumbnail(dicomSeries, dicomModel, Thumbnail.DEFAULT_SIZE); dicomSeries.setTag(TagW.Thumbnail, t); Optional.ofNullable(t).ifPresent(v -> v.repaint());