public SRReader(Series series, DicomSpecialElement dicomSR) { if (dicomSR == null) { throw new IllegalArgumentException("Dicom parameter cannot be null"); //$NON-NLS-1$ } this.dicomSR = dicomSR; this.dcmItems = dicomSR.getMediaReader().getDicomObject(); }
@Override public String toString() { DicomSpecialElement d = (DicomSpecialElement) getUserObject(); StringBuilder buf = new StringBuilder(); boolean newElement = LangUtil.getNULLtoFalse((Boolean) d.getTagValue(TagW.ObjectToSave)); if (newElement) { buf.append("<html>"); //$NON-NLS-1$ buf.append("<font color='orange'><b>NEW </b></font>"); //$NON-NLS-1$ } buf.append(d.getShortLabel()); if (newElement) { buf.append("</html>"); //$NON-NLS-1$ } return buf.toString(); } });
public DicomSpecialElement(DicomMediaIO mediaIO) { super(mediaIO, null); initLabel(); }
@Override public boolean saveToFile(File output) { // When object is in memory, write it if (getMediaReader().isEditableDicom()) { Attributes dcm = getMediaReader().getDicomObject(); if (dcm != null) { try (DicomOutputStream out = new DicomOutputStream(output)) { out.writeDataset(dcm.createFileMetaInformation(UID.ImplicitVRLittleEndian), dcm); return true; } catch (IOException e) { LOGGER.error("Cannot write dicom ({}): {}", getLabel(), e); //$NON-NLS-1$ } } } return super.saveToFile(output); }
@Override public String toString() { String modality = TagD.getTagValue(this, Tag.Modality, String.class); int prefix = modality == null ? 0 : modality.length() + 1; String l = getShortLabel(); return l.length() > prefix ? label.substring(prefix) : l; }
@Override public DicomSpecialElement buildDicomSpecialElement(DicomMediaIO mediaIO) { return new DicomSpecialElement(mediaIO); } }
if (wdata instanceof BulkData) { BulkData bulkData = (BulkData) wdata; try (FileInputStream in = new FileInputStream(media.getFile())) { array = new ByteArrayOutputStream(bulkData.length()); StreamUtils.skipFully(in, bulkData.offset());
public void removePatient(MediaSeriesGroup patientGroup) { if (patientGroup != null) { if (!DownloadManager.TASKS.isEmpty()) { for (MediaSeriesGroup studyGroup : getChildren(patientGroup)) { for (MediaSeriesGroup group : getChildren(studyGroup)) { if (group instanceof DicomSeries) { DownloadManager.stopDownloading((DicomSeries) group, this); } } } } firePropertyChange( new ObservableEvent(ObservableEvent.BasicAction.REMOVE, DicomModel.this, null, patientGroup)); for (MediaSeriesGroup studyGroup : getChildren(patientGroup)) { for (MediaSeriesGroup group : getChildren(studyGroup)) { group.dispose(); } } List<DicomSpecialElement> sps = (List<DicomSpecialElement>) patientGroup.getTagValue(TagW.DicomSpecialElementList); if (sps != null) { for (DicomSpecialElement d : sps) { d.dispose(); } } removeHierarchyNode(MediaSeriesGroupNode.rootNode, patientGroup); LOGGER.info("Remove Patient: {}", patientGroup); //$NON-NLS-1$ } }
private KOSpecialElement buildKO(DicomModel model, DicomSeries s) { DicomSpecialElement dcmElement = DicomModel.getFirstSpecialElement(series, DicomSpecialElement.class); if (dcmElement != null) { DicomImageElement dcm = s.getMedia(MediaSeries.MEDIA_POSITION.FIRST, null, null); if (dcm != null && dcm.getMediaReader() instanceof DcmMediaReader) { Attributes dicomSourceAttribute = ((DcmMediaReader) dcm.getMediaReader()).getDicomObject(); Attributes attributes = DicomMediaUtils.createDicomKeyObject(dicomSourceAttribute, dcmElement.getShortLabel(), null); new LoadDicomObjects(model, attributes).addSelectionAndnotify(); // must be executed in the EDT for (KOSpecialElement koElement : DicomModel.getKoSpecialElements(s)) { if (koElement.getMediaReader().getDicomObject().equals(attributes)) { return koElement; } } } } return null; }
public void setSeries(Series<?> series) { if (series != null) { // Should have only one object by series (if more, they are split in several sub-series in dicomModel) DicomSpecialElement s = DicomModel.getFirstSpecialElement(series, DicomSpecialElement.class); if (s != null) { readAnnotations(s.getMediaReader().getDicomObject()); } } }
@Override protected void initLabel() { Attributes dicom = ((DicomMediaIO) mediaIO).getDicomObject(); String modality = dicom.getString(Tag.Modality); String rtLabel = null; if ("RTSTRUCT".equals(modality)) { rtLabel = dicom.getString(Tag.StructureSetLabel); } else if ("RTPLAN".equals(modality)) { rtLabel = dicom.getString(Tag.RTPlanLabel); } if (rtLabel == null) { super.initLabel(); } else { this.label = rtLabel; } } }
private void displayECG(DicomSpecialElement media) throws Exception { removeAll(); DicomMediaIO dicomImageLoader = media.getMediaReader(); Attributes attributes = dicomImageLoader.getDicomObject(); if (attributes != null) {
@Override protected void initLabel() { Attributes dicom = ((DicomMediaIO) mediaIO).getDicomObject(); /* * DICOM PS 3.3 - 2011 - CONTENT IDENTIFICATION MACRO. Used in Presentation State Identification C.11.10 * * ContentLabel (mandatory): a label that is used to identify this SOP Instance. * * ContentDescription: a description of the content of the SOP Instance. */ String clabel = dicom.getString(Tag.ContentLabel); if (clabel == null) { clabel = dicom.getString(Tag.ContentDescription); } if (clabel == null) { super.initLabel(); } else { StringBuilder buf = new StringBuilder(getLabelPrefix()); buf.append(clabel); label = buf.toString(); } } }
protected AudioData getAudioData(DicomSpecialElement media) { if (media instanceof DicomAudioElement) { DicomMediaIO dicomImageLoader = media.getMediaReader(); Attributes attributes = dicomImageLoader.getDicomObject().getNestedDataset(Tag.WaveformSequence); if (attributes != null) {
String seriesUID = TagD.getTagValue(spel, Tag.SeriesInstanceUID, String.class); if (seriesInstanceUID.equals(seriesUID)) { if (!spel.getMediaReader().isEditableDicom()) { buildInstance(spel, s);