DicomMediaUtils { public static String getStringFromDicomElement(Attributes dicom, int tag) { if (dicom == null || !dicom.containsValue(tag)) { return null; } String[] s = dicom.getStrings(tag); if (s == null || s.length == 0) { return null; } if (s.length == 1) { return s[0]; } StringBuilder sb = new StringBuilder(s[0]); for (int i = 1; i < s.length; i++) { sb.append("\\" + s[i]); } return sb.toString(); } private  DicomMediaUtils(); static synchronized void enableAnonymizationProfile(boolean activate); static boolean containsRequiredAttributes(Attributes dcmItems, int... requiredTags); static boolean containsRequiredModalityLUTAttributes(Attributes dcmItems); static boolean containsRequiredModalityLUTDataAttributes(Attributes dcmItems); static boolean containsRequiredVOILUTWindowLevelAttributes(Attributes dcmItems); static boolean containsLUTAttributes(Attributes dcmItems); static LookupTableCV createLut(Attributes dicomLutObject); static String getStringFromDicomElement(Attributes dicom, int tag); static String[] getStringArrayFromDicomElement(Attributes dicom, int tag); static String[] getStringArrayFromDicomElement(Attributes dicom, int tag, String privateCreatorID); static String[] getStringArrayFromDicomElement(Attributes dicom, int tag, String[] defaultValue); static String[] getStringArrayFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        String[] defaultValue); static Date getDateFromDicomElement(Attributes dicom, int tag, Date defaultValue); static Date[] getDatesFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        Date[] defaultValue); static String getPatientAgeInPeriod(Attributes dicom, int tag, boolean computeOnlyIfNull); static String getPatientAgeInPeriod(Attributes dicom, int tag, String privateCreatorID, String defaultValue,
        boolean computeOnlyIfNull); static String getPeriod(LocalDate first, LocalDate last); static Float getFloatFromDicomElement(Attributes dicom, int tag, Float defaultValue); static Float getFloatFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        Float defaultValue); static Integer getIntegerFromDicomElement(Attributes dicom, int tag, Integer defaultValue); static Integer getIntegerFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        Integer defaultValue); static Double getDoubleFromDicomElement(Attributes dicom, int tag, Double defaultValue); static Double getDoubleFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        Double defaultValue); static int[] getIntAyrrayFromDicomElement(Attributes dicom, int tag, int[] defaultValue); static int[] getIntArrayFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        int[] defaultValue); static float[] getFloatArrayFromDicomElement(Attributes dicom, int tag, float[] defaultValue); static float[] getFloatArrayFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        float[] defaultValue); static double[] getDoubleArrayFromDicomElement(Attributes dicom, int tag, double[] defaultValue); static double[] getDoubleArrayFromDicomElement(Attributes dicom, int tag, String privateCreatorID,
        double[] defaultValue); static boolean hasOverlay(Attributes attrs); static Integer getIntPixelValue(Attributes ds, int tag, boolean signed, int stored); static void setTag(Map<TagW, Object> tags, TagW tag, Object value); static void setTagNoNull(Map<TagW, Object> tags, TagW tag, Object value); static void writeMetaData(MediaSeriesGroup group, Attributes header); static void computeSlicePositionVector(Tagable tagable); static void buildSeriesReferences(Tagable tagable, Attributes attributes); static void setShutterColor(Tagable tagable, Attributes attributes); static void setShutter(Tagable tagable, Attributes dcmObject); static void writeFunctionalGroupsSequence(Tagable tagable, Attributes dcm); static boolean writePerFrameFunctionalGroupsSequence(Tagable tagable, Attributes header, int index); static void applyModalityLutModule(Attributes mLutItems, Tagable tagable, Integer seqParentTag); static void buildMoalityLUT(Attributes mLutItems, Tagable tagable); static void applyVoiLutModule(Attributes voiItems, Attributes mLutItems, Tagable tagable,
        Integer seqParentTag); static void buildVoiLUTs(Sequence voiLUTSequence, Tagable tagable); static void applyPrLutModule(Attributes dcmItems, Tagable tagable); static void readPRLUTsModule(Attributes dcmItems, Tagable tagable); static void computeSUVFactor(Attributes dicomObject, Tagable tagable, int index); static Attributes createDicomPR(Attributes dicomSourceAttribute, String seriesInstanceUID,
        String sopInstanceUID); static Attributes createDicomKeyObject(Attributes dicomSourceAttribute, String keyObjectDescription,
        String seriesInstanceUID); static TemporalAccessor getDateFromDicomElement(TagType type, Attributes dicom, int tag,
        String privateCreatorID, TemporalAccessor defaultValue); static TemporalAccessor[] getDatesFromDicomElement(TagType type, Attributes dicom, int tag,
        String privateCreatorID, TemporalAccessor[] defaultValue); static TemporalAccessor getDateFromDicomElement(XMLStreamReader xmler, String attribute, TagType type,
        TemporalAccessor defaultValue); static TemporalAccessor[] getDatesFromDicomElement(XMLStreamReader xmler, String attribute, TagType type,
        TemporalAccessor[] defaultValue); static TemporalAccessor[] getDatesFromDicomElement(XMLStreamReader xmler, String attribute, TagType type,
        TemporalAccessor[] defaultValue, String separator); static void fillAttributes(Map<TagW, Object> tags, Attributes dataset); static void fillAttributes(Iterator<Entry<TagW, Object>> iter, Attributes dataset); static void fillAttributes(Attributes dataset, final TagW tag, final Object val, ElementDictionary dic);  }
@Test public void testGetStringFromDicomElement() throws Exception { assertEquals("RECTANGULAR\\CIRCULAR\\POLYGONAL", DicomMediaUtils.getStringFromDicomElement(attributes, Tag.ShutterShape)); assertEquals(null, DicomMediaUtils.getStringFromDicomElement(attributes, Tag.ShutterPresentationValue)); }