/** * Add selected attributes from another Attributes object to this. * The specified array of tag values must be sorted (as by the * {@link java.util.Arrays#sort(int[])} method) prior to making this call. * * @param other the other Attributes object * @param selection sorted tag values * @return <tt>true</tt> if one ore more attributes were added */ public boolean addSelected(Attributes other, int... selection) { return addSelected(other, selection, 0, selection.length); }
public Attributes(Attributes other, boolean bigEndian, int... selection) { this(bigEndian, selection.length); if (other.properties != null) properties = new HashMap<String, Object>(other.properties); addSelected(other, selection); }
public Attributes(Attributes other, boolean bigEndian, Attributes selection) { this(bigEndian, selection.size()); if (other.properties != null) properties = new HashMap<String, Object>(other.properties); addSelected(other, selection); }
private void addFunctionGroups(Attributes dest, Attributes fgs) { dest.addSelected(fgs, Tag.ReferencedImageSequence); Attributes fg; for (int sqTag : fgs.tags()) if (sqTag != Tag.ReferencedImageSequence && (fg = fgs.getNestedDataset(sqTag)) != null) dest.addAll(fg); }
private void addFunctionGroups(Attributes dest, Attributes fgs) { dest.addSelected(fgs, Tag.ReferencedImageSequence); Attributes fg; for (int sqTag : fgs.tags()) if (sqTag != Tag.ReferencedImageSequence && (fg = fgs.getNestedDataset(sqTag)) != null) dest.addAll(fg); }
public void query(File f) throws Exception { Attributes attrs; String filePath = f.getPath(); String fileExt = filePath.substring(filePath.lastIndexOf(".")+1).toLowerCase(); DicomInputStream dis = null; try { attrs = fileExt.equals("xml") ? SAXReader.parse(filePath) : new DicomInputStream(f).readDataset(-1, -1); if (inFilter != null) { attrs = new Attributes(inFilter.length + 1); attrs.addSelected(attrs, inFilter); } } finally { SafeClose.close(dis); } mergeKeys(attrs, keys); query(attrs); }
public void query(File f) throws Exception { Attributes attrs; String filePath = f.getPath(); String fileExt = filePath.substring(filePath.lastIndexOf(".")+1).toLowerCase(); DicomInputStream dis = null; try { attrs = fileExt.equals("xml") ? SAXReader.parse(filePath) : new DicomInputStream(f).readDataset(-1, -1); if (inFilter != null) { attrs = new Attributes(inFilter.length + 1); attrs.addSelected(attrs, inFilter); } } finally { SafeClose.close(dis); } mergeKeys(attrs, keys); query(attrs); }
private Attributes keys(RecordType type, Attributes attrs, RecordFactory recFact) { int[] selection = recFact.getRecordKeys(type); Attributes keys = new Attributes(selection.length + 1); keys.setString(Tag.DirectoryRecordType, VR.CS, type.name()); keys.addSelected(attrs, selection); return keys; }
private Attributes keys(Attributes attrs, RecordFactory recFact) { int[] selection = recFact.getRecordKeys(RecordType.SR_DOCUMENT); Attributes keys = new Attributes(selection.length + 1); String[] iuids = keys.getStrings(Tag.SOPInstanceUID); if (iuids != null && iuids.length > 0) keys.setString(Tag.ReferencedSOPInstanceUIDInFile, VR.CS, iuids); keys.addSelected(attrs, selection); return keys; }
protected Attributes adjust(Attributes match) { if (match == null) return null; Attributes filtered = new Attributes(match.size()); // include SpecificCharacterSet also if not in keys if (!keys.contains(Tag.SpecificCharacterSet)) { String[] ss = match.getStrings(Tag.SpecificCharacterSet); if (ss != null) filtered.setString(Tag.SpecificCharacterSet, VR.CS, ss); } filtered.addSelected(match, keys); return filtered; } }
protected Attributes adjust(Attributes match) { if (match == null) return null; Attributes filtered = new Attributes(match.size()); // include SpecificCharacterSet also if not in keys if (!keys.contains(Tag.SpecificCharacterSet)) { String[] ss = match.getStrings(Tag.SpecificCharacterSet); if (ss != null) filtered.setString(Tag.SpecificCharacterSet, VR.CS, ss); } filtered.addSelected(match, keys); return filtered; } }
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); }
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); }
@SuppressWarnings("resource") 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); }
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 getPerfSeries(Sequence prefSeriesSeq, Attributes inst) { String suid = inst.getString(Tag.SeriesInstanceUID); for (Attributes prefSeries : prefSeriesSeq) { if (suid.equals(prefSeries.getString(Tag.SeriesInstanceUID))) return prefSeries; } Attributes prefSeries = new Attributes(); prefSeriesSeq.add(prefSeries); for (int tag : PERF_SERIES_TYPE_2_ATTRS) prefSeries.setNull(tag, dict.vrOf(tag)); prefSeries.setString(Tag.ProtocolName, VR.LO, protocolName); prefSeries.addSelected(inst, PERF_SERIES_ATTRS); prefSeries.newSequence(Tag.ReferencedImageSequence, 10); if (archiveRequested != null) prefSeries.setString(Tag.ArchiveRequested, VR.CS, archiveRequested); return prefSeries; } }
private Attributes getPerfSeries(Sequence prefSeriesSeq, Attributes inst) { String suid = inst.getString(Tag.SeriesInstanceUID); for (Attributes prefSeries : prefSeriesSeq) { if (suid.equals(prefSeries.getString(Tag.SeriesInstanceUID))) return prefSeries; } Attributes prefSeries = new Attributes(); prefSeriesSeq.add(prefSeries); for (int tag : PERF_SERIES_TYPE_2_ATTRS) prefSeries.setNull(tag, dict.vrOf(tag)); prefSeries.setString(Tag.ProtocolName, VR.LO, protocolName); prefSeries.addSelected(inst, PERF_SERIES_ATTRS); prefSeries.newSequence(Tag.ReferencedImageSequence, 10); if (archiveRequested != null) prefSeries.setString(Tag.ArchiveRequested, VR.CS, archiveRequested); return prefSeries; } }
fmi.getString(Tag.TransferSyntaxUID, null)); rec.addSelected(dataset, keys, 0, keys.length); Sequence contentSeq = dataset.getSequence(Tag.ContentSequence); if (contentSeq != null)
@Override public void readValue(DicomInputStream dis, Attributes attrs) throws IOException { int tag = dis.tag(); if (dis.level() == 0 && tag == Tag.PixelData) { imageDescriptor = new ImageDescriptor(attrs); initDicomOutputStream(); processPixelData(); postPixelData = new Attributes(dis.bigEndian()); } else { dis.readValue(dis, attrs); if (postPixelData != null && dis.level() == 0) postPixelData.addSelected(attrs, attrs.getPrivateCreator(tag), tag); } }
for (int tag : MPPS_TOP_LEVEL_TYPE_2_ATTRS) mpps.setNull(tag, dict.vrOf(tag)); mpps.addSelected(inst, MPPS_TOP_LEVEL_ATTRS); if (newPPSID || !mpps.containsValue(Tag.PerformedProcedureStepID)) mpps.setString(Tag.PerformedProcedureStepID, VR.CS, mkPPSID()); for (int tag : SSA_TYPE_2_ATTRS) ssa.setNull(tag, dict.vrOf(tag)); ssa.addSelected(inst, SSA_ATTRS); } else { Sequence ssaSeq = for (int tag : SSA_TYPE_2_ATTRS) ssa.setNull(tag, dict.vrOf(tag)); ssa.addSelected(inst, SSA_ATTRS); ssa.addSelected(ra, SSA_ATTRS);