コード例 #1
0
ファイル: KeyImageItem.cs プロジェクト: m-berkani/ClearCanvas
		public static bool UpdateKeyImage(this IPresentationImage image, KeyImageInformation context)
		{
			if (context != null)
			{
				var presentationStateUid = GetPresentationStateSopInstanceUid(image);

				var clipboardItems = context.Items;
				var result = clipboardItems.Select((k, i) => new
				                                             	{
				                                             		k.Item,
				                                             		IsSerialized = k.IsSerialized(),
				                                             		Index = i,
				                                             		MetaData = k.ExtensionData.GetOrCreate<KeyImageItemMetaData>()
				                                             	})
					.FirstOrDefault(c => c.IsSerialized && c.MetaData.PrSopInstanceUid == presentationStateUid);
				if (result != null)
				{
					var keyImageItem = context.CreateKeyImageItem(image);

					var metadata = ((IClipboardItem) keyImageItem).ExtensionData.GetOrCreate<KeyImageItemMetaData>();
					metadata.Changes = true;
					metadata.Guid = result.MetaData.Guid;
					metadata.KoSopInstanceUid = result.MetaData.KoSopInstanceUid;
					metadata.PrSopInstanceUid = result.MetaData.PrSopInstanceUid;
					metadata.OriginalItem = result.MetaData.OriginalItem ?? clipboardItems[result.Index];

					clipboardItems[result.Index] = keyImageItem;
					return true;
				}
			}
			return false;
		}
コード例 #2
0
ファイル: KeyImageItem.cs プロジェクト: bangush/server-1
        public static bool UpdateKeyImage(this IPresentationImage image, KeyImageInformation context)
        {
            if (context != null)
            {
                var presentationStateUid = GetPresentationStateSopInstanceUid(image);

                var clipboardItems = context.Items;
                var result         = clipboardItems.Select((k, i) => new
                {
                    k.Item,
                    IsSerialized = k.IsSerialized(),
                    Index        = i,
                    MetaData     = k.ExtensionData.GetOrCreate <KeyImageItemMetaData>()
                })
                                     .FirstOrDefault(c => c.IsSerialized && c.MetaData.PrSopInstanceUid == presentationStateUid);
                if (result != null)
                {
                    var keyImageItem = context.CreateKeyImageItem(image);

                    var metadata = ((IClipboardItem)keyImageItem).ExtensionData.GetOrCreate <KeyImageItemMetaData>();
                    metadata.Changes          = true;
                    metadata.Guid             = result.MetaData.Guid;
                    metadata.KoSopInstanceUid = result.MetaData.KoSopInstanceUid;
                    metadata.PrSopInstanceUid = result.MetaData.PrSopInstanceUid;
                    metadata.OriginalItem     = result.MetaData.OriginalItem ?? clipboardItems[result.Index];

                    clipboardItems[result.Index] = keyImageItem;
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
0
        private static IEnumerable <IClipboardItem> CreateClipboardItems(StudyTree studyTree, Sop keyObjectSelectionDocument)
        {
            Platform.CheckTrue(keyObjectSelectionDocument.SopClassUid == SopClass.KeyObjectSelectionDocumentStorageUid, "SOP Class must be Key Object Selection Document Storage");

            var dummyContext = new KeyImageInformation();             // just need an instance of creating items
            var factory      = new PresentationImageFactory(studyTree);

            foreach (var image in factory.CreateImages(keyObjectSelectionDocument))
            {
                var presentationStateInstanceUid = string.Empty;

                // set the deserialize interactive flag on the presentation state
                var dicomPresentationImage = image as IDicomPresentationImage;
                if (dicomPresentationImage != null)
                {
                    var presentationState = dicomPresentationImage.PresentationState as DicomSoftcopyPresentationState;
                    if (presentationState != null)
                    {
                        presentationState.DeserializeOptions |= DicomSoftcopyPresentationStateDeserializeOptions.InteractiveAnnotations;
                        presentationStateInstanceUid          = presentationState.PresentationSopInstanceUid;
                    }
                }

                var item = dummyContext.CreateKeyImageItem(image, true);
                item.AssignSourceInfo(Guid.NewGuid(), keyObjectSelectionDocument.SopInstanceUid, presentationStateInstanceUid);
                yield return(item);
            }
        }
コード例 #4
0
		private static IEnumerable<IClipboardItem> CreateClipboardItems(StudyTree studyTree, Sop keyObjectSelectionDocument)
		{
			Platform.CheckTrue(keyObjectSelectionDocument.SopClassUid == SopClass.KeyObjectSelectionDocumentStorageUid, "SOP Class must be Key Object Selection Document Storage");

			var dummyContext = new KeyImageInformation(); // just need an instance of creating items
			var factory = new PresentationImageFactory(studyTree);
			foreach (var image in factory.CreateImages(keyObjectSelectionDocument))
			{
				// set the deserialize interactive flag on the presentation state
				var dicomPresentationImage = image as IDicomPresentationImage;
				if (dicomPresentationImage != null)
				{
					var presentationState = dicomPresentationImage.PresentationState as DicomSoftcopyPresentationState;
					if (presentationState != null) presentationState.DeserializeInteractiveAnnotations = true;
				}

				var item = dummyContext.CreateKeyImageItem(image, true);
				item.AssignSourceInfo(Guid.NewGuid(), keyObjectSelectionDocument.SopInstanceUid);
				yield return item;
			}
		}