EyesFirstClassifier implements Runnable { static String createDicomResultURI(DicomObject dicom) { SpecificCharacterSet sc = dicom.getSpecificCharacterSet(); try { StringBuilder result = new StringBuilder("studyUID="); DicomElement e = dicom.get(Tag.StudyInstanceUID); if (e == null) { logger().debug("No StudyInstanceUID found"); return null; } result.append(URLEncoder.encode(e.getString(sc, false), "UTF-8")); result.append("&seriesUID="); e = dicom.get(Tag.SeriesInstanceUID); if (e == null) { logger().debug("No SeriesInstanceUID found"); return null; } result.append(URLEncoder.encode(e.getString(sc, false), "UTF-8")); result.append("&objectUID="); e = dicom.get(Tag.SOPInstanceUID); if (e == null) { logger().debug("No SOPInstanceUID found"); return null; } result.append(URLEncoder.encode(e.getString(sc, false), "UTF-8")); return result.toString(); } catch (UnsupportedOperationException e) { logger().warn("Unable to create result URI (bad DICOM file?)", e); return null; } catch (UnsupportedEncodingException e) { logger().warn("Unable to create result URI", e); return null; } } EyesFirstClassifier(URI wadoURI, File destDir, String dicomURI, URI callbackURI, String callbackKey); void runAll(); void run(); static final int BUFFER_SIZE; }
@Test public void testCreateDicomResultURI() { DicomObject testObject = new BasicDicomObject(); testObject.putString(Tag.StudyInstanceUID, VR.UI, "1.2.826.0.1.3680043.2.139.3.6.33166195690.200803141441141090"); testObject.putString(Tag.SeriesInstanceUID, VR.UI, "1.2.826.0.1.3680043.2.139.3.6.33166195690.200803141441141400"); testObject.putString(Tag.SOPInstanceUID, VR.UI, "1.2.826.0.1.3680043.8.1302.20080314144114.1671730634998957899"); assertEquals("URL", "studyUID=1.2.826.0.1.3680043.2.139.3.6.33166195690.200803141441141090&seriesUID=1.2.826.0.1.3680043.2.139.3.6.33166195690.200803141441141400&objectUID=1.2.826.0.1.3680043.8.1302.20080314144114.1671730634998957899", EyesFirstClassifier.createDicomResultURI(testObject)); }