use of org.dcm4chee.arc.store.InstanceLocations in project dcm4chee-arc-light by dcm4che.
the class CopyToRetrieveCacheTask method copiedToRetrieveCache.
public InstanceLocations copiedToRetrieveCache() {
try {
LOG.debug("Wait for next finished copy to retrieve cache");
InstanceLocations inst = completed.take().instanceLocations;
if (inst == null)
LOG.debug("No more copy to retrieve cache");
else
LOG.debug("Got next finished copy to retrieve cache");
return inst;
} catch (InterruptedException e) {
LOG.error("Failed to wait for next finished copy to retrieve cache:", e);
return null;
}
}
use of org.dcm4chee.arc.store.InstanceLocations in project dcm4chee-arc-light by dcm4che.
the class IocmUtils method linkInstancesWithMWL.
static Attributes linkInstancesWithMWL(StoreSession session, RetrieveService retrieveService, ProcedureService procedureService, ProcedureContext ctx, QueryService queryService, RejectionNote rjNote, Attributes coerceAttrs, InputStream in) throws Exception {
final Attributes result;
String studyInstanceUID = ctx.getStudyInstanceUID();
ArchiveAEExtension arcAE = session.getArchiveAEExtension();
StoreService storeService = session.getStoreService();
Attributes instanceRefs = parseSOPInstanceReferences(in);
ctx.setSourceInstanceRefs(instanceRefs);
restoreInstances(session, instanceRefs);
Collection<InstanceLocations> instanceLocations = retrieveService.queryInstances(session, instanceRefs, studyInstanceUID);
if (instanceLocations.isEmpty())
return null;
if (studyInstanceUID.equals(instanceRefs.getString(Tag.StudyInstanceUID))) {
procedureService.updateStudySeriesAttributes(ctx);
result = getResult(instanceLocations);
} else {
Attributes sopInstanceRefs = getSOPInstanceRefs(instanceRefs, instanceLocations, arcAE.getApplicationEntity());
moveSequence(sopInstanceRefs, Tag.ReferencedSeriesSequence, instanceRefs);
session.setAcceptConflictingPatientID(AcceptConflictingPatientID.YES);
session.setPatientUpdatePolicy(Attributes.UpdatePolicy.PRESERVE);
session.setStudyUpdatePolicy(arcAE.linkMWLEntryUpdatePolicy());
result = storeService.copyInstances(session, instanceLocations, coerceAttrs, Attributes.UpdatePolicy.OVERWRITE);
rejectInstances(instanceRefs, queryService, rjNote, session, result);
}
return result;
}
use of org.dcm4chee.arc.store.InstanceLocations in project dcm4chee-arc-light by dcm4che.
the class IocmUtils method copyMove.
static Attributes copyMove(StoreSession session, RetrieveService retrieveService, QueryService queryService, String studyInstanceUID, Attributes coerceAttrs, RejectionNote rjNote, InputStream in) throws Exception {
ArchiveAEExtension arcAE = session.getArchiveAEExtension();
StoreService storeService = session.getStoreService();
Attributes instanceRefs = parseSOPInstanceReferences(in);
restoreInstances(session, instanceRefs);
Collection<InstanceLocations> instanceLocations = retrieveService.queryInstances(session, instanceRefs, studyInstanceUID);
if (instanceLocations.isEmpty())
return null;
Attributes sopInstanceRefs = getSOPInstanceRefs(instanceRefs, instanceLocations, arcAE.getApplicationEntity());
moveSequence(sopInstanceRefs, Tag.ReferencedSeriesSequence, instanceRefs);
session.setAcceptConflictingPatientID(AcceptConflictingPatientID.YES);
session.setPatientUpdatePolicy(Attributes.UpdatePolicy.PRESERVE);
session.setStudyUpdatePolicy(arcAE.copyMoveUpdatePolicy());
Attributes result = storeService.copyInstances(session, instanceLocations, coerceAttrs, Attributes.UpdatePolicy.MERGE);
if (rjNote != null)
rejectInstances(instanceRefs, queryService, rjNote, session, result);
return result;
}
use of org.dcm4chee.arc.store.InstanceLocations in project dcm4chee-arc-light by dcm4che.
the class WadoRS method retrievePresentionState.
private void retrievePresentionState(RetrieveContext ctx) throws IOException {
InstanceLocations inst = ctx.getMatches().iterator().next();
if (ctx.copyToRetrieveCache(inst)) {
ctx.copyToRetrieveCache(null);
inst = ctx.copiedToRetrieveCache();
}
Attributes attrs;
try (DicomInputStream dis = service.openDicomInputStream(ctx, inst)) {
attrs = dis.readDataset();
service.getAttributesCoercion(ctx, inst).coerce(attrs, null);
} catch (IOException e) {
throw e;
} catch (Exception e) {
throw new IOException(e);
}
Collection<InstanceLocations> matches = new ArrayList<>();
for (Attributes series : attrs.getSequence(Tag.ReferencedSeriesSequence)) {
ctx.setSeriesInstanceUIDs(series.getString(Tag.SeriesInstanceUID));
ctx.setSopInstanceUIDs(series.getSequence(Tag.ReferencedImageSequence).stream().map(item -> item.getString(Tag.ReferencedSOPInstanceUID)).toArray(String[]::new));
service.calculateMatches(ctx);
matches.addAll(ctx.getMatches());
}
ctx.getMatches().clear();
ctx.getMatches().addAll(matches);
ctx.setNumberOfMatches(matches.size());
presentationState = attrs;
}
use of org.dcm4chee.arc.store.InstanceLocations in project dcm4chee-arc-light by dcm4che.
the class WadoRS method matchPresentionState.
private static boolean matchPresentionState(RetrieveContext ctx) {
InstanceLocations inst = ctx.getMatches().iterator().next();
ArchiveDeviceExtension arcDev = ctx.getArchiveAEExtension().getArchiveDeviceExtension();
return arcDev.isWadoSupportedPRClass(inst.getSopClassUID());
}
Aggregations