/// <summary> /// Deserializes the key object selection SOP instance into a list of constituent images and associated presentation states. /// </summary> public IList <IKeyObjectContentItem> Deserialize() { List <IKeyObjectContentItem> contentItems = new List <IKeyObjectContentItem>(); SrDocumentContentModuleIod srDocument = _document.SrDocumentContent; if (srDocument.ContentSequence != null) { foreach (IContentSequence contentItem in srDocument.ContentSequence.Where(contentItem => contentItem.RelationshipType == RelationshipType.Contains)) { if (contentItem.ValueType == ValueType.Image) { IImageReferenceMacro imageReference = contentItem; if (imageReference.ReferencedSopSequence == null) { Platform.Log(LogLevel.Warn, "Invalid Key Object Selection document has no Referenced SOP Sequence."); continue; } string referencedSopInstanceUid = imageReference.ReferencedSopSequence.ReferencedSopInstanceUid; string presentationStateSopInstanceUid = null; if (imageReference.ReferencedSopSequence.ReferencedSopSequence != null) { presentationStateSopInstanceUid = imageReference.ReferencedSopSequence.ReferencedSopSequence.ReferencedSopInstanceUid; } string referencedFrameNumbers = imageReference.ReferencedSopSequence.ReferencedFrameNumber; int[] frameNumbers; if (!string.IsNullOrEmpty(referencedFrameNumbers) && DicomStringHelper.TryGetIntArray(referencedFrameNumbers, out frameNumbers) && frameNumbers.Length > 0) { foreach (int frameNumber in frameNumbers) { KeyImageContentItem item = new KeyImageContentItem(referencedSopInstanceUid, frameNumber, presentationStateSopInstanceUid, _document); contentItems.Add(item); } } else { KeyImageContentItem item = new KeyImageContentItem(referencedSopInstanceUid, presentationStateSopInstanceUid, _document); contentItems.Add(item); } } } } else { Platform.Log(LogLevel.Warn, "Invalid Key Object Selection document has no Content Sequence."); } return(contentItems.AsReadOnly()); }
public KeyObjectSelectionDocumentIod(IDicomElementProvider dicomElementProvider) { _dicomElementProvider = dicomElementProvider; _patientModule = new PatientModuleIod(_dicomElementProvider); _specimenIdentificationModule = new SpecimenIdentificationModuleIod(_dicomElementProvider); _clinicalTrialSubjectModule = new ClinicalTrialSubjectModuleIod(_dicomElementProvider); _generalStudyModule = new GeneralStudyModuleIod(_dicomElementProvider); _patientStudyModule = new PatientStudyModuleIod(_dicomElementProvider); _clinicalTrialStudyModule = new ClinicalTrialStudyModuleIod(_dicomElementProvider); _keyObjectDocumentSeriesModule = new KeyObjectDocumentSeriesModuleIod(_dicomElementProvider); _clinicalTrialSeriesModule = new ClinicalTrialSeriesModuleIod(_dicomElementProvider); _generalEquipmentModule = new GeneralEquipmentModuleIod(_dicomElementProvider); _keyObjectDocumentModule = new KeyObjectDocumentModuleIod(_dicomElementProvider); _srDocumentContentModule = new SrDocumentContentModuleIod(_dicomElementProvider); _sopCommonModule = new SopCommonModuleIod(_dicomElementProvider); }
/// <summary> /// Deserializes the key object selection SOP instance into a list of descriptions. /// </summary> public IList <IKeyObjectContentItem> DeserializeDescriptions() { List <IKeyObjectContentItem> contentItems = new List <IKeyObjectContentItem>(); SrDocumentContentModuleIod srDocument = _document.SrDocumentContent; if (srDocument.ContentSequence != null) { foreach (IContentSequence contentItem in srDocument.ContentSequence.Where(contentItem => contentItem.RelationshipType == RelationshipType.Contains)) { if (AreEqual(contentItem.ConceptNameCodeSequence, KeyObjectSelectionCodeSequences.KeyObjectDescription)) { contentItems.Add(new KeyObjectDescriptionContentItem(contentItem.TextValue, _document)); } } } else { Platform.Log(LogLevel.Warn, "Invalid Key Object Selection document has no Content Sequence."); } return(contentItems.AsReadOnly()); }
public IImageProperty[] GetProperties(IPresentationImage image) { List <IImageProperty> properties = new List <IImageProperty>(); if (image != null && image.ParentDisplaySet != null) { IImageViewer viewer = image.ImageViewer; if (viewer != null) { IDicomDisplaySetDescriptor descriptor = image.ParentDisplaySet.Descriptor as IDicomDisplaySetDescriptor; if (descriptor != null && descriptor.SourceSeries != null) { string uid = descriptor.SourceSeries.SeriesInstanceUid; if (!String.IsNullOrEmpty(uid)) { StudyTree studyTree = viewer.StudyTree; Series keyObjectSeries = studyTree.GetSeries(uid); if (keyObjectSeries != null && keyObjectSeries.Sops.Count > 0) { Sop keyObjectSop = keyObjectSeries.Sops[0]; if (keyObjectSop.SopClassUid == SopClass.KeyObjectSelectionDocumentStorageUid) { KeyObjectSelectionDocumentIod iod = new KeyObjectSelectionDocumentIod(keyObjectSop); SrDocumentContentModuleIod content = iod.SrDocumentContent; GeneralEquipmentModuleIod equipment = iod.GeneralEquipment; if (content != null) { string codeValue = ""; CodeSequenceMacro conceptSequence = content.ConceptNameCodeSequence; if (conceptSequence != null) { KeyObjectSelectionDocumentTitle documentTitle = KeyObjectSelectionDocumentTitleContextGroup.LookupTitle(conceptSequence); if (documentTitle != null) { codeValue = documentTitle.ToString(); } } string documentDescription = ""; IContentSequence[] contentSequences = content.ContentSequence ?? new IContentSequence[0]; for (int i = contentSequences.Length - 1; i >= 0; --i) { IContentSequence contentSequence = contentSequences[i]; CodeSequenceMacro sequenceMacro = contentSequence.ConceptNameCodeSequence; if (sequenceMacro != null && sequenceMacro.CodeValue == KeyObjectSelectionCodeSequences.KeyObjectDescription.CodeValue) { documentDescription = contentSequence.TextValue; break; } } properties.Add( new ImageProperty("KeyImageDocumentTitle", SR.CategoryKeyImageSeries, SR.NameKeyImageDocumentTitle, SR.DescriptionKeyImageDocumentTitle, codeValue)); properties.Add( new ImageProperty("KeyImageDocumentDescription", SR.CategoryKeyImageSeries, SR.NameKeyImageDocumentDescription, SR.DescriptionKeyImageDocumentDescription, documentDescription)); properties.Add( new ImageProperty("KeyImageEquipmentManufacturer", SR.CategoryKeyImageEquipment, SR.NameManufacturer, SR.DescriptionManufacturer, equipment.Manufacturer ?? "")); properties.Add( new ImageProperty("KeyImageEquipmentManufacturersModelName", SR.CategoryKeyImageEquipment, SR.NameManufacturersModelName, SR.DescriptionManufacturersModelName, equipment.ManufacturersModelName ?? "")); properties.Add( new ImageProperty("KeyImageEquipmentSoftwareVersions", SR.CategoryKeyImageEquipment, SR.NameSoftwareVersions, SR.DescriptionSoftwareVersions, equipment.SoftwareVersions ?? "")); } } } } } } } return(properties.ToArray()); }