public Attributes readCommand() throws IOException { if (bigEndian || explicitVR) throw new IllegalStateException( "bigEndian=" + bigEndian + ", explicitVR=" + explicitVR ); Attributes attrs = new Attributes(9); readAttributes(attrs, -1, -1); return attrs; }
private Attributes parseXML(String uri) throws ParserConfigurationException, SAXException, IOException { Attributes attrs = new Attributes(); SAXParserFactory f = SAXParserFactory.newInstance(); SAXParser parser = f.newSAXParser(); parser.parse(uri, new ContentHandlerAdapter(attrs)); return attrs; }
private static Attributes configureKeys(CommandLine cl) { Attributes temp = new Attributes(); CLIUtils.addAttributes(temp, cl.getOptionValues("m")); return temp; }
void toItems(Sequence seq) { for (Object value : values) { seq.add(value != null ? (Attributes) value : new Attributes(0)); } }
private void startItem(int number) { Sequence seq = seqs.getLast(); while (seq.size() < number-1) seq.add(new Attributes(0)); Attributes item = new Attributes(); seq.add(item); items.add(item); }
Attributes toDataset(String line) { Attributes dataset = new Attributes(); String[] fields = parseFields(line); if (fields.length > tags.length) { LOG.warn("Number of values in line " + line + " does not match number of headers. Hence line is ignored."); return null; } for (int i = 0; i < fields.length; i++) dataset.setString(tags[i], vrs[i], fields[i]); return dataset; }
private void copyConceptMod(Sequence srcSeq, Attributes rec) { Sequence dstSeq = null; for (Attributes item : srcSeq) { if ("HAS CONCEPT MOD".equals(item.getString(Tag.RelationshipType, null))) { if (dstSeq == null) dstSeq = rec.newSequence(Tag.ContentSequence, 1); dstSeq.add(new Attributes(item, false)); } } } }
private static Attributes refSOP(String iuid, String cuid, int failureReason) { Attributes attrs = new Attributes(3); attrs.setString(Tag.ReferencedSOPClassUID, VR.UI, cuid); attrs.setString(Tag.ReferencedSOPInstanceUID, VR.UI, iuid); if (failureReason != Status.Success) attrs.setInt(Tag.FailureReason, VR.US, failureReason); return attrs ; }
public DicomServiceException(int status, Throwable cause) { super(cause); rsp = new Attributes(); setStatus(status); setErrorComment(getMessage()); }
private Object readItemOrPersonName() { if (next() != JsonParser.Event.KEY_NAME) return null; return (getString().length() == 8) ? doReadDataset(new Attributes()) : readPersonName(); }
private Sequence refSeriesSeq(String studyIUID) { for (Attributes refStudy : evidenceSeq) if (studyIUID.equals(refStudy.getString(Tag.StudyInstanceUID))) return refStudy.getSequence(Tag.ReferencedSeriesSequence); Attributes refStudy = new Attributes(2); Sequence refSeriesSeq = refStudy.newSequence(Tag.ReferencedSeriesSequence, 10); refStudy.setString(Tag.StudyInstanceUID, VR.UI, studyIUID); evidenceSeq.add(refStudy); return refSeriesSeq; }
public Attributes readItem() throws IOException { readHeader(); if (tag != Tag.Item) throw new IOException("Unexpected attribute " + TagUtils.toString(tag) + " #" + length + " @ " + pos); Attributes attrs = new Attributes(bigEndian); attrs.setItemPosition(tagPos); readAttributes(attrs, length, Tag.ItemDelimitationItem); attrs.trimToSize(); return attrs; }
private void copyFrom(DicomDirReader r) throws IOException { Attributes rec = r.findFirstRootDirectoryRecordInUse(false); while (rec != null) { copyChildsFrom(r, rec, out.addRootDirectoryRecord(new Attributes(rec))); rec = r.findNextDirectoryRecordInUse(rec, false); } }
public Attributes toItem() { Attributes codeItem = new Attributes(codingSchemeVersion != null ? 4 : 3); codeItem.setString(Tag.CodeValue, VR.SH, codeValue); codeItem.setString(Tag.CodingSchemeDesignator, VR.SH, codingSchemeDesignator); if (codingSchemeVersion != null) codeItem.setString(Tag.CodingSchemeVersion, VR.SH, codingSchemeVersion); codeItem.setString(Tag.CodeMeaning, VR.LO, codeMeaning); return codeItem ; }
private Attributes contentItem(String valueType, Attributes refSOP) { Attributes item = new Attributes(3); item.setString(Tag.RelationshipType, VR.CS, "CONTAINS"); item.setString(Tag.ValueType, VR.CS, valueType); item.newSequence(Tag.ReferencedSOPSequence, 1).add(refSOP); return item; }
public static Attributes mkCCancelRQ(int msgId) { Attributes rq = new Attributes(); rq.setInt(Tag.CommandField, VR.US, Dimse.C_CANCEL_RQ.commandField()); rq.setInt(Tag.CommandDataSetType, VR.US, NO_DATASET); rq.setInt(Tag.MessageIDBeingRespondedTo, VR.US, msgId); return rq; }
public void retrieve(File f) throws IOException, InterruptedException { Attributes attrs = new Attributes(); DicomInputStream dis = null; try { attrs.addSelected(new DicomInputStream(f).readDataset(-1, -1), inFilter); } finally { SafeClose.close(dis); } attrs.addAll(keys); retrieve(attrs); }
private Attributes keyObjectDescription() { Attributes item = new Attributes(4); item.setString(Tag.RelationshipType, VR.CS, "CONTAINS"); item.setString(Tag.ValueType, VR.CS, "TEXT"); item.newSequence(Tag.ConceptNameCodeSequence, 1).add(toCodeItem("DCM-113012")); item.setString(Tag.TextValue, VR.UT, keyObjectDescription); return item; }
public void retrieve(File f) throws IOException, InterruptedException { Attributes attrs = new Attributes(); DicomInputStream dis = null; try { attrs.addSelected(new DicomInputStream(f).readDataset(-1, -1), inFilter); } finally { SafeClose.close(dis); } attrs.addAll(keys); retrieve(attrs); }
@Override public Attributes nextMatch() throws DicomServiceException { Attributes ret = new Attributes(patRec.size() + studyRec.size() + seriesRec.size()); ret.addAll(patRec); ret.addAll(studyRec); ret.addAll(seriesRec); wrappedFindNextSeries(); return ret; }