public SeriesThumbnail(final MediaSeries<? extends MediaElement> sequence, int thumbnailSize) { super(thumbnailSize); if (sequence == null) { throw new IllegalArgumentException("Sequence cannot be null"); //$NON-NLS-1$ } this.series = sequence; // media can be null for seriesThumbnail MediaElement media = sequence.getMedia(MEDIA_POSITION.MIDDLE, 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); } } /* * 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). */ init(media, series.getTagValue(TagW.ExplorerModel) != null, null); }
public static List<DicomSpecialElement> getSpecialElements(MediaSeries<DicomImageElement> dicomSeries) { if (dicomSeries == null) { return Collections.emptyList(); } List<DicomSpecialElement> list = null; DataExplorerModel model = (DataExplorerModel) dicomSeries.getTagValue(TagW.ExplorerModel); if (model instanceof DicomModel) { MediaSeriesGroup patientGroup = ((DicomModel) model).getParent(dicomSeries, DicomModel.patient); if (patientGroup != null) { list = (List<DicomSpecialElement>) patientGroup.getTagValue(TagW.DicomSpecialElementList); } } return list == null ? Collections.emptyList() : list; }
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(); } }
MediaSeries<?> s = (MediaSeries<?>) getUserObject(); StringBuilder buf = new StringBuilder(); boolean newElement = LangUtil.getNULLtoFalse((Boolean) s.getTagValue(TagW.ObjectToSave)); if (newElement) { buf.append("<html>"); //$NON-NLS-1$
public synchronized void setThumbnailSize(int thumbnailSize) { boolean update = this.thumbnailSize != thumbnailSize; if (update) { Object media = series.getMedia(mediaPosition, null, null); this.thumbnailSize = thumbnailSize; removeImageFromCache(); buildThumbnail((MediaElement) media, series.getTagValue(TagW.ExplorerModel) != null, null); } }
MediaSeries<? extends MediaElement> base = seriesList.get(0); for (MediaSeries<? extends MediaElement> s : seriesList) { Integer splitNb = (Integer) s.getTagValue(TagW.SplitSeriesNumber); if (splitNb != null && min > splitNb) { min = splitNb;
Integer splitNb = (Integer) series.getTagValue(TagW.SplitSeriesNumber); if (splitNb != null) { String nb = "#" + splitNb; //$NON-NLS-1$
} else if (node.getUserObject() instanceof Series) { MediaSeries<?> s = (MediaSeries<?>) node.getUserObject(); if (LangUtil.getNULLtoFalse((Boolean) s.getTagValue(TagW.ObjectToSave))) { Series<?> series = (Series<?>) s.getTagValue(CheckTreeModel.SourceSeriesForPR); if (series != null) { String seriesInstanceUID = UIDUtils.createUID();
for (MediaElement media : ms) { media.setTag(TagW.get("SeriesInstanceUID"), //$NON-NLS-1$ series.getTagValue(series.getTagID())); URI uri = media.getMediaURI(); media.setTag(TagW.get("SOPInstanceUID"), //$NON-NLS-1$
@Override public void actionPerformed(ActionEvent e) { EventManager eventManager = EventManager.getInstance(); MediaSeries<org.weasis.dicom.codec.DicomImageElement> s = eventManager.getSelectedSeries(); // Requires at least 5 images to build the MPR views if (s != null && s.size(null) >= 5) { DataExplorerModel model = (DataExplorerModel) s.getTagValue(TagW.ExplorerModel); if (model instanceof DicomModel) { ViewerPluginBuilder.openSequenceInPlugin(new MPRFactory(), s, model, false, false); } } } };
public void initTreeValues(ViewCanvas<?> viewCanvas) { if (viewCanvas != null) { MediaSeries<?> dcmSeries = viewCanvas.getSeries(); if (dcmSeries != null) { DicomModel dicomModel = (DicomModel) dcmSeries.getTagValue(TagW.ExplorerModel); if (dicomModel != null) { MediaSeriesGroup patient = dicomModel.getParent(dcmSeries, DicomModel.patient); if (patient != null) { String frameOfReferenceUID = TagD.getTagValue(dcmSeries, Tag.FrameOfReferenceUID, String.class); List<MediaElement> list = getRelatedSpecialElements(dicomModel, patient, frameOfReferenceUID); RtSet set = RtSet_Cache.get(frameOfReferenceUID); boolean reload = set == null || (!list.isEmpty() && !set.getRtElements().equals(list)); if (reload) { set = new RtSet(frameOfReferenceUID, list); RtSet_Cache.put(frameOfReferenceUID, set); } boolean empty = set.getStructures().isEmpty(); btnLoad.setEnabled(empty || reload); this.rtSet = set; updateCanvas(viewCanvas); } } } } }
if (node.getUserObject() instanceof Series) { MediaSeries<?> s = (MediaSeries<?>) node.getUserObject(); if (LangUtil.getNULLtoFalse((Boolean) s.getTagValue(TagW.ObjectToSave))) { Series<?> series = (Series<?>) s.getTagValue(CheckTreeModel.SourceSeriesForPR); if (series != null) { seriesGph.add((String) series.getTagValue(TagD.get(Tag.SeriesInstanceUID)));
public static KOSpecialElement loadDicomKeyObject(MediaSeries<DicomImageElement> dicomSeries, Attributes newDicomKO) { DicomModel dicomModel = (DicomModel) dicomSeries.getTagValue(TagW.ExplorerModel); new LoadDicomObjects(dicomModel, newDicomKO).addSelectionAndnotify(); // must be executed in the EDT for (KOSpecialElement koElement : DicomModel.getKoSpecialElements(dicomSeries)) { if (koElement.getMediaReader().getDicomObject().equals(newDicomKO)) { return koElement; } } return null; }
if (LangUtil.getNULLtoFalse((Boolean) s.getTagValue(TagW.ObjectToSave))) { Series<?> series = (Series<?>) s.getTagValue(CheckTreeModel.SourceSeriesForPR); if (series != null) { String seriesInstanceUID = UIDUtils.createUID();
LOGGER.info("Delete KeyObject {}", list.getSelectedValue()); //$NON-NLS-1$ DicomModel dicomModel = (DicomModel) selectedDicomSeries.getTagValue(TagW.ExplorerModel); if (dicomModel != null) { dicomModel.removeSpecialElement(list.getSelectedValue());
private void displayLimitedDicomInfo(MediaSeries<?> series, MediaElement media) { StyledDocument doc = jTextPaneLimited.getStyledDocument(); int oldCaretPosition = jTextPaneLimited.getCaretPosition(); try { // clear previous text doc.remove(0, doc.getLength()); } catch (BadLocationException e) { LOGGER.error("Clear document", e); //$NON-NLS-1$ } if (series != null && media != null) { Object tagValue = series.getTagValue(TagW.ExplorerModel); if (tagValue instanceof DicomModel) { DicomModel model = (DicomModel) tagValue; MediaReader loader = media.getMediaReader(); if (loader instanceof DcmMediaReader) { List<DicomData> list = DicomManager.getInstance().getLimitedDicomTags(); for (DicomData dicomData : list) { writeItems(dicomData, getGroup(model, series, dicomData), doc); } } } } oldCaretPosition = oldCaretPosition > doc.getLength() ? doc.getLength() : oldCaretPosition; jTextPaneLimited.setCaretPosition(oldCaretPosition); limitedPane.setViewportView(jTextPaneLimited); }
s.addAll(dicoms); ((DcmMediaReader) dcm.getMediaReader()).writeMetaData(s); DataExplorerModel model = (DataExplorerModel) ser.getTagValue(TagW.ExplorerModel); if (model instanceof DicomModel) { DicomModel dicomModel = (DicomModel) model;
series.size((Filter<ImageElement>) view2d.getActionValue(ActionW.FILTERED_SERIES.cmd())), view2d.getFrameIndex() + 1, false)); final Integer speed = (Integer) series.getTagValue(TagW.get("CineRate")); //$NON-NLS-1$ if (speed != null) { cineAction.ifPresent(a -> a.setSpeed(speed));
public static boolean setKeyObjectReferenceAllSeries(boolean selectedState, final ViewCanvas<DicomImageElement> view2d) { KOSpecialElement validKOSelection = getValidKOSelection(view2d); if (validKOSelection == null) { return false; // canceled } KOSpecialElement currentSelectedKO = KOManager.getCurrentKOSelection(view2d); if (validKOSelection != currentSelectedKO) { ActionState koSelection = view2d.getEventManager().getAction(ActionW.KO_SELECTION); if (koSelection instanceof ComboItemListener) { ((ComboItemListener) koSelection).setSelectedItem(validKOSelection); } } boolean hasKeyObjectReferenceChanged = false; if (validKOSelection == currentSelectedKO || currentSelectedKO == null) { // KO Toogle State is changed only if KO Selection remains the same, // or if there was no previous KO Selection hasKeyObjectReferenceChanged = validKOSelection.setKeyObjectReference(selectedState, view2d.getSeries()); if (hasKeyObjectReferenceChanged) { DicomModel dicomModel = (DicomModel) view2d.getSeries().getTagValue(TagW.ExplorerModel); // Fire an event since any view in any View2dContainer may have its KO selected state changed if (dicomModel != null) { dicomModel.firePropertyChange(new ObservableEvent(ObservableEvent.BasicAction.UPDATE, view2d, null, new SeriesEvent(SeriesEvent.Action.UPDATE, validKOSelection, "updateAll"))); //$NON-NLS-1$ } } } return hasKeyObjectReferenceChanged; }
DicomModel dicomModel = (DicomModel) view2d.getSeries().getTagValue(TagW.ExplorerModel);