public static IOD load(String uri) throws IOException { if (uri.startsWith("resource:")) { try { uri = ResourceLocator.getResource(uri.substring(9), IOD.class); } catch (NullPointerException npe) { throw new FileNotFoundException(uri); } } else if (uri.indexOf(':') < 2) { uri = new File(uri).toURI().toString(); } IOD iod = new IOD(); iod.parse(uri); iod.trimToSize(); return iod; }
private void startItem(String id, String idref, String type) throws SAXException { IOD iod; if (idref != null) { if (type != null) throw new SAXException("<Item> with idref must not specify type"); iod = id2iod.get(idref); if (iod == null) throw new SAXException( "could not resolve <Item idref:\"" + idref + "\"/>"); } else { iod = new IOD(); if (type != null) iod.setType(typeOf(type)); if (locator != null) iod.setLineNumber(locator.getLineNumber()); } getLastDataElement().addItemIOD(iod); iodStack.add(iod); if (id != null) id2iod.put(id, iod); this.idref = idref; itemConditions = true; elementConditions = false; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SOPInstanceUID, VR.UI, IOD.DataElementType.TYPE_0, -1, -1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); return iod; }
@Override protected IOD queryKeysIOD(QueryRetrieveLevel rootLevel, boolean relational) { IOD iod = new IOD(); iod.add(new IOD.DataElement(Tag.PatientID, VR.LO, !relational && rootLevel == QueryRetrieveLevel.PATIENT ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.StudyInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); iod.add(new IOD.DataElement(Tag.SeriesInstanceUID, VR.UI, !relational ? IOD.DataElementType.TYPE_1 : IOD.DataElementType.TYPE_3, 1, 1, 0)); return iod; }
public static IOD valueOf(Code code) { IOD iod = new IOD(); iod.add(new DataElement( Tag.CodeValue, VR.SH, DataElementType.TYPE_1, 1, 1, 0) .setValues(code.getCodeValue())); iod.add(new DataElement( Tag.CodingSchemeDesignator, VR.SH, DataElementType.TYPE_1, 1, 1, 0) .setValues(code.getCodingSchemeDesignator())); String codingSchemeVersion = code.getCodingSchemeVersion(); if (codingSchemeVersion == null) iod.add(new DataElement( Tag.CodingSchemeVersion, VR.SH, DataElementType.TYPE_0, -1, -1, 0)); else iod.add(new DataElement( Tag.CodingSchemeVersion, VR.SH, DataElementType.TYPE_1, 1, 1, 0)); return iod; } }