@Override public String toString() { StringBuilder buf = new StringBuilder(getDisplayValue(this, Tag.StudyDescription)); buf.append(" ["); //$NON-NLS-1$ buf.append(getDisplayValue(this, Tag.ModalitiesInStudy)); buf.append("] "); //$NON-NLS-1$ LocalDateTime studyDate = TagD.dateTime(Tag.StudyDate, Tag.StudyTime, this); if (studyDate != null) { buf.append(TagUtil.formatDateTime(studyDate)); buf.append(" "); //$NON-NLS-1$ } buf.append(getDisplayValue(this, Tag.AccessionNumber)); return buf.toString(); } };
public Object getValue(Object data) { Object value = null; if (data instanceof XMLStreamReader) { XMLStreamReader xmler = (XMLStreamReader) data; if (isStringFamilyType()) { value = vmMax > 1 ? TagUtil.getStringArrayTagAttribute(xmler, keyword, (String[]) defaultValue) : TagUtil.getTagAttribute(xmler, keyword, (String) defaultValue); } else if (TagType.DATE.equals(type) || TagType.TIME.equals(type) || TagType.DATETIME.equals(type)) { value = vmMax > 1 ? TagUtil.getDatesFromElement(xmler, keyword, type, (TemporalAccessor[]) defaultValue) : TagUtil.getDateFromElement(xmler, keyword, type, (TemporalAccessor) defaultValue); } else if (TagType.INTEGER.equals(type)) { value = vmMax > 1 ? TagUtil.getIntArrayTagAttribute(xmler, keyword, (int[]) defaultValue) : TagUtil.getIntegerTagAttribute(xmler, keyword, (Integer) defaultValue); } else if (TagType.FLOAT.equals(type)) { value = vmMax > 1 ? TagUtil.getFloatArrayTagAttribute(xmler, keyword, (float[]) defaultValue) : TagUtil.getFloatTagAttribute(xmler, keyword, (Float) defaultValue); } else if (TagType.DOUBLE.equals(type)) { value = vmMax > 1 ? TagUtil.getDoubleArrayTagAttribute(xmler, keyword, (double[]) defaultValue) : TagUtil.getDoubleTagAttribute(xmler, keyword, (Double) defaultValue); } else { value = vmMax > 1 ? TagUtil.getStringArrayTagAttribute(xmler, keyword, (String[]) defaultValue) : TagUtil.getTagAttribute(xmler, keyword, (String) defaultValue); } } return value; }
public static DicomPrintNode buildDicomPrintNode(XMLStreamReader xmler) { DicomPrintNode node = new DicomPrintNode(xmler.getAttributeValue(null, T_DESCRIPTION), xmler.getAttributeValue(null, T_AETITLE), xmler.getAttributeValue(null, T_HOST), TagUtil.getIntegerTagAttribute(xmler, T_PORT, 104)); node.setTsuid(TransferSyntax.getTransferSyntax(xmler.getAttributeValue(null, T_TSUID))); .setMediumType(TagUtil.getTagAttribute(xmler, T_MEDIUM_TYPE, DicomPrintOptions.DEF_MEDIUM_TYPE)); node.printOptions.setPriority(TagUtil.getTagAttribute(xmler, T_PRIORITY, DicomPrintOptions.DEF_PRIORITY)); node.printOptions .setFilmDestination(TagUtil.getTagAttribute(xmler, T_FILM_DEST, DicomPrintOptions.DEF_FILM_DEST)); node.printOptions .setNumOfCopies(TagUtil.getIntegerTagAttribute(xmler, T_NUM_COPIES, DicomPrintOptions.DEF_NUM_COPIES)); node.printOptions.setColorPrint(TagUtil.getBooleanTagAttribute(xmler, T_COLOR, DicomPrintOptions.DEF_COLOR)); TagUtil.getTagAttribute(xmler, T_FILM_ORIENTATION, DicomPrintOptions.DEF_FILM_ORIENTATION)); node.printOptions.setFilmSizeId( FilmSize.getInstance(xmler.getAttributeValue(null, T_FILM_SIZE), DicomPrintOptions.DEF_FILM_SIZE)); node.printOptions.setImageDisplayFormat( TagUtil.getTagAttribute(xmler, T_IMG_DISP_FORMAT, DicomPrintOptions.DEF_IMG_DISP_FORMAT)); node.printOptions.setMagnificationType( TagUtil.getTagAttribute(xmler, T_MAGNIFICATION_TYPE, DicomPrintOptions.DEF_MAGNIFICATION_TYPE)); node.printOptions .setSmoothingType(TagUtil.getTagAttribute(xmler, T_SMOOTHING_TYPE, DicomPrintOptions.DEF_SMOOTHING_TYPE)); node.printOptions .setBorderDensity(TagUtil.getTagAttribute(xmler, T_BORDER_DENSITY, DicomPrintOptions.DEF_BORDER_DENSITY)); node.printOptions.setTrim(TagUtil.getTagAttribute(xmler, T_TRIM, DicomPrintOptions.DEF_TRIM)); node.printOptions .setEmptyDensity(TagUtil.getTagAttribute(xmler, T_EMPTY_DENSITY, DicomPrintOptions.DEF_EMPTY_DENSITY)); TagUtil.getBooleanTagAttribute(xmler, T_SHOW_ANNOTATIONS, DicomPrintOptions.DEF_SHOW_ANNOTATIONS));
private static void readArcQuery(XMLStreamReader xmler, ReaderParams params) throws XMLStreamException { String arcID = TagUtil.getTagAttribute(xmler, ArcParameters.ARCHIVE_ID, ""); //$NON-NLS-1$ String wadoURL = TagUtil.getTagAttribute(xmler, ArcParameters.BASE_URL, null); boolean onlySopUID = Boolean.parseBoolean(TagUtil.getTagAttribute(xmler, WadoParameters.WADO_ONLY_SOP_UID, "false")); //$NON-NLS-1$ String additionnalParameters = TagUtil.getTagAttribute(xmler, ArcParameters.ADDITIONNAL_PARAMETERS, ""); //$NON-NLS-1$ String overrideList = TagUtil.getTagAttribute(xmler, ArcParameters.OVERRIDE_TAGS, null); String webLogin = TagUtil.getTagAttribute(xmler, ArcParameters.WEB_LOGIN, null); final WadoParameters wadoParameters = new WadoParameters(arcID, wadoURL, onlySopUID, additionnalParameters, overrideList, webLogin); readQuery(xmler, params, wadoParameters, ArcParameters.TAG_ARC_QUERY); }
TagUtil.getTagAttribute(xmler, TagW.WadoTransferSyntaxUID.getKeyword(), null)); dicomSeries.setTagNoNull(TagW.WadoCompressionRate, TagUtil.getIntegerTagAttribute(xmler, TagW.WadoCompressionRate.getKeyword(), null)); dicomSeries.setTagNoNull(TagW.DirectDownloadThumbnail, TagUtil.getTagAttribute(xmler, TagW.DirectDownloadThumbnail.getKeyword(), null)); TagUtil.getTagAttribute(xmler, TagD.getKeywordFromTag(Tag.SOPInstanceUID, null), null); if (sopInstanceUID != null) { Integer frame = TagUtil.getIntegerTagAttribute(xmler, TagD.getKeywordFromTag(Tag.InstanceNumber, null), null); SopInstance sop = seriesInstanceList.getSopInstance(sopInstanceUID, frame); if (sop == null) { sop = new SopInstance(sopInstanceUID, frame); sop.setDirectDownloadFile( TagUtil.getTagAttribute(xmler, TagW.DirectDownloadFile.getKeyword(), null)); seriesInstanceList.addSopInstance(sop);
public static DefaultDicomNode buildDicomNodeEx(XMLStreamReader xmler) { DefaultDicomNode node = new DefaultDicomNode(xmler.getAttributeValue(null, T_DESCRIPTION), xmler.getAttributeValue(null, T_AETITLE), xmler.getAttributeValue(null, T_HOST), TagUtil.getIntegerTagAttribute(xmler, T_PORT, 104), UsageType.valueOf(xmler.getAttributeValue(null, T_USAGE_TYPE))); node.setTsuid(TransferSyntax.getTransferSyntax(xmler.getAttributeValue(null, T_TSUID))); // TODO add tls return node; }
public static double[] getDoubleArrayTagAttribute(XMLStreamReader xmler, String attribute, double[] defaultValue) { return getDoubleArrayTagAttribute(xmler, attribute, defaultValue, "\\"); //$NON-NLS-1$ }
public static float[] getFloatArrayTagAttribute(XMLStreamReader xmler, String attribute, float[] defaultValue) { return getFloatArrayTagAttribute(xmler, attribute, defaultValue, "\\"); //$NON-NLS-1$ }
public static String[] getStringArrayTagAttribute(XMLStreamReader xmler, String attribute, String[] defaultValue) { return getStringArrayTagAttribute(xmler, attribute, defaultValue, "\\"); //$NON-NLS-1$ }
public static int[] getIntArrayTagAttribute(XMLStreamReader xmler, String attribute, int[] defaultValue) { return getIntArrayTagAttribute(xmler, attribute, defaultValue, "\\"); //$NON-NLS-1$ }
private static void readWadoQuery(XMLStreamReader xmler, ReaderParams params) throws XMLStreamException { String wadoURL = TagUtil.getTagAttribute(xmler, WadoParameters.WADO_URL, null); boolean onlySopUID = Boolean.parseBoolean(TagUtil.getTagAttribute(xmler, WadoParameters.WADO_ONLY_SOP_UID, "false")); //$NON-NLS-1$ String additionnalParameters = TagUtil.getTagAttribute(xmler, ArcParameters.ADDITIONNAL_PARAMETERS, ""); //$NON-NLS-1$ String overrideList = TagUtil.getTagAttribute(xmler, ArcParameters.OVERRIDE_TAGS, null); String webLogin = TagUtil.getTagAttribute(xmler, ArcParameters.WEB_LOGIN, null); final WadoParameters wadoParameters = new WadoParameters(wadoURL, onlySopUID, additionnalParameters, overrideList, webLogin); readQuery(xmler, params, wadoParameters, WadoParameters.TAG_WADO_QUERY); }
case XMLStreamConstants.START_ELEMENT: if ("p".equals(xmler.getName().getLocalPart()) && xmler.getAttributeCount() >= 1) { //$NON-NLS-1$ index = TagUtil.getIntegerTagAttribute(xmler, "index", -1); //$NON-NLS-1$ format = xmler.getAttributeValue(null, "format");//$NON-NLS-1$
private Object readValue(XMLStreamReader xmler) { Object value; if (isStringFamilyType()) { value = vmMax > 1 ? TagUtil.getStringArrayTagAttribute(xmler, keyword, (String[]) defaultValue) : TagUtil.getTagAttribute(xmler, keyword, (String) defaultValue); } else if (TagType.DICOM_DATE.equals(type) || TagType.DICOM_TIME.equals(type) || TagType.DICOM_DATETIME.equals(type)) { value = vmMax > 1 ? getDatesFromElement(xmler, keyword, type, (TemporalAccessor[]) defaultValue) : getDateFromElement(xmler, keyword, type, (TemporalAccessor) defaultValue); } else if (TagType.INTEGER.equals(type)) { value = vmMax > 1 ? TagUtil.getIntArrayTagAttribute(xmler, keyword, (int[]) defaultValue) : TagUtil.getIntegerTagAttribute(xmler, keyword, (Integer) defaultValue); } else if (TagType.FLOAT.equals(type)) { value = vmMax > 1 ? TagUtil.getFloatArrayTagAttribute(xmler, keyword, (float[]) defaultValue) : TagUtil.getFloatTagAttribute(xmler, keyword, (Float) defaultValue); } else if (TagType.DOUBLE.equals(type)) { value = vmMax > 1 ? TagUtil.getDoubleArrayTagAttribute(xmler, keyword, (double[]) defaultValue) : TagUtil.getDoubleTagAttribute(xmler, keyword, (Double) defaultValue); } else if (TagType.DICOM_SEQUENCE.equals(type)) { value = TagUtil.getTagAttribute(xmler, keyword, (String) defaultValue); } else { value = vmMax > 1 ? TagUtil.getStringArrayTagAttribute(xmler, keyword, (String[]) defaultValue) : TagUtil.getTagAttribute(xmler, keyword, (String) defaultValue); } return value; }
private void writeStudyDateTime(StringBuilder html) { TagW tagDate = TagD.getNullable(Tag.StudyDate, null); if (tagDate != null && html != null && dcmItems != null) { LocalDateTime date = TagD.dateTime(Tag.StudyDateAndTime, dcmItems); if (date != null) { html.append("<B>"); //$NON-NLS-1$ html.append(tagDate.getDisplayedName()); html.append("</B>"); //$NON-NLS-1$ html.append(StringUtil.COLON_AND_SPACE); html.append(TagUtil.formatDateTime(date)); } } }
public PatientComparator(XMLStreamReader xmler) { setPatientId(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientID).getKeyword(), null)); setIssuerOfPatientID(TagUtil.getTagAttribute(xmler, TagD.get(Tag.IssuerOfPatientID).getKeyword(), null)); setName(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientName).getKeyword(), null)); setSex(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientSex).getKeyword(), null)); setBirthdate(TagUtil.getTagAttribute(xmler, TagD.get(Tag.PatientBirthDate).getKeyword(), null)); }
double level = Double.parseDouble(xmler.getAttributeValue(null, "level")); //$NON-NLS-1$ String shape = xmler.getAttributeValue(null, "shape");//$NON-NLS-1$ Integer keyCode = TagUtil.getIntegerTagAttribute(xmler, "key", null);//$NON-NLS-1$ LutShape lutShape = LutShape.getLutShape(shape); PresetWindowLevel preset =
protected static String getFormattedText(Object value, String format) { if (value == null) { return StringUtil.EMPTY_STRING; } String str; if (value instanceof String) { str = (String) value; } else if (value instanceof String[]) { str = Arrays.asList((String[]) value).stream().collect(Collectors.joining("\\")); //$NON-NLS-1$ } else if (value instanceof TemporalAccessor) { str = TagUtil.formatDateTime((TemporalAccessor) value); } else if (value instanceof TemporalAccessor[]) { str = Stream.of((TemporalAccessor[]) value).map(TagUtil::formatDateTime).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof float[]) { float[] array = (float[]) value; str = IntStream.range(0, array.length).mapToObj(i -> String.valueOf(array[i])) .collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof double[]) { str = DoubleStream.of((double[]) value).mapToObj(String::valueOf).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else if (value instanceof int[]) { str = IntStream.of((int[]) value).mapToObj(String::valueOf).collect(Collectors.joining(", ")); //$NON-NLS-1$ } else { str = value.toString(); } if (StringUtil.hasText(format) && !"$V".equals(format.trim())) { //$NON-NLS-1$ return formatValue(str, value instanceof Float || value instanceof Double, format); } return str == null ? StringUtil.EMPTY_STRING : str; }
patients.add(patient); } else if (ArcParameters.TAG_HTTP_TAG.equals(key)) { String httpkey = TagUtil.getTagAttribute(xmler, "key", null); //$NON-NLS-1$ String httpvalue = TagUtil.getTagAttribute(xmler, "value", null); //$NON-NLS-1$ wadoParameters.addHttpTag(httpkey, httpvalue); final String title = TagUtil.getTagAttribute(xmler, "title", null); //$NON-NLS-1$ final String message = TagUtil.getTagAttribute(xmler, "description", null); //$NON-NLS-1$ if (StringUtil.hasText(title) && StringUtil.hasText(message)) { String severity = TagUtil.getTagAttribute(xmler, "severity", "WARN"); //$NON-NLS-1$ //$NON-NLS-2$ final int messageType = "ERROR".equals(severity) ? JOptionPane.ERROR_MESSAGE //$NON-NLS-1$ : "INFO" //$NON-NLS-1$
public String getDisplayName() { String desc = TagD.getTagValue(this, Tag.SeriesDescription, String.class); if (StringUtil.hasText(desc)) { return desc; } switch (type) { case NAME: return name; case DATE: return TagUtil.formatDateTime(date); case NONE: default: return DEFAULT_SERIE_NAME; } }
private static void readImages(SeriesAndInstanceReference rfSeries, XMLStreamReader xmler, ReaderParams params) throws XMLStreamException { List<SOPInstanceReferenceAndMAC> instances = new ArrayList<>(); BiConsumerWithException<XMLStreamReader, ReaderParams, XMLStreamException> method = (x, r) -> { String sopUID = TagUtil.getTagAttribute(xmler, TagD.get(Tag.ReferencedSOPInstanceUID).getKeyword(), null); String sopClassUID = TagUtil.getTagAttribute(xmler, TagD.get(Tag.ReferencedSOPClassUID).getKeyword(), null); int[] seqFrame = (int[]) TagD.get(Tag.ReferencedFrameNumber).getValue(xmler); SOPInstanceReferenceAndMAC referencedSOP = new SOPInstanceReferenceAndMAC(); referencedSOP.setReferencedSOPInstanceUID(sopUID); referencedSOP.setReferencedSOPClassUID(sopClassUID); referencedSOP.setReferencedFrameNumber(seqFrame); instances.add(referencedSOP); }; readElement(xmler, Xml.Level.INSTANCE.getTagName(), Xml.Level.SERIES.getTagName(), method, params); rfSeries.setReferencedSOPInstances(instances); }