A DICOM SOP Instance.

Note that there should no longer be any need to derive from this class; the Sop, ImageSop and Frame classes are now just simple Bridge classes (see Bridge Design Pattern) to ISopDataSource and ISopFrameData. See the remarks for ISopDataSource for more information.

Also, for more information on 'transient references' and the lifetime of Sops, see ISopReference.

Inheritance: IDisposable, IDicomAttributeProvider, ISopInstanceData, ISeriesData, IStudyData, IPatientData
コード例 #1
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;
			}
		}
コード例 #2
0
ファイル: StudyItem.cs プロジェクト: m-berkani/ClearCanvas
		public SopDataSourceStudyItem(Sop sop)
		{
			Platform.CheckTrue(sop.DataSource is ILocalSopDataSource, "Sop must be local");
			{
				_filename = ((ILocalSopDataSource) sop.DataSource).Filename;
				_sopReference = sop.CreateTransientReference();
			}
		}
コード例 #3
0
ファイル: StudyItem.cs プロジェクト: nhannd/Xian
		public SopDataSourceStudyItem(Sop sop)
		{
			if (sop.DataSource is ILocalSopDataSource)
			{
				_filename = ((ILocalSopDataSource) sop.DataSource).Filename;
				_sopReference = sop.CreateTransientReference();
			}
		}
コード例 #4
0
ファイル: StudyItem.cs プロジェクト: nhannd/Xian
		public SopDataSourceStudyItem(ILocalSopDataSource sopDataSource)
		{
			_filename = sopDataSource.Filename;
			using (Sop sop = new Sop(sopDataSource))
			{
				_sopReference = sop.CreateTransientReference();
			}
		}
コード例 #5
0
ファイル: SopReference.cs プロジェクト: hksonngan/Xian
 public void Dispose()
 {
     if (_sop != null)
     {
         _sop.OnReferenceDisposed();
         _sop = null;
     }
 }
コード例 #6
0
 internal void SetSop(Sop sop)
 {
     if (sop == null)
     {
         _sop = null;
     }
     else if (_sop == null)
     {
         _sop = sop;
     }
 }
コード例 #7
0
		/// <summary>
		/// Compares two <see cref="ImageSop"/>s based on series number.
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <returns></returns>
		public override int Compare(Sop x, Sop y)
		{
			int seriesNumber1 = x.SeriesNumber;
			int seriesNumber2 = y.SeriesNumber;

			if (seriesNumber1 < seriesNumber2)
				return this.ReturnValue;
			else if (seriesNumber1 > seriesNumber2)
				return -this.ReturnValue;
			else
				return 0;
		}
コード例 #8
0
ファイル: StudyTree.cs プロジェクト: hksonngan/Xian
        private void AddPatient(Sop sop)
        {
            if (_patients[sop.PatientId] != null)
            {
                return;
            }

            Patient patient = new Patient();

            patient.SetSop(sop);

            _patients.Add(patient);
        }
コード例 #9
0
ファイル: Series.cs プロジェクト: ronmark1/ClearCanvas-1
        internal void SetSop(Sop sop)
        {
            if (sop == null)
            {
                _sop = null;
            }
            else if (_sop == null)
            {
                _sop = sop;
            }

            ParentStudy.SetSop(sop);
        }
コード例 #10
0
        internal void SetSop(Sop sop)
        {
            if (sop == null)
            {
                _sop = null;
            }
            else if (_sop == null)
            {
                _sop = sop;
            }

            this.ParentPatient.SetSop(sop);
        }
コード例 #11
0
ファイル: StudyTree.cs プロジェクト: hksonngan/Xian
        private void AddStudy(Sop sop)
        {
            if (_studies.ContainsKey(sop.StudyInstanceUid))
            {
                return;
            }

            Patient patient = _patients[sop.PatientId];
            Study   study   = new Study(patient);

            study.SetSop(sop);
            patient.Studies.Add(study);

            _studies[study.StudyInstanceUid] = study;
        }
コード例 #12
0
ファイル: InstanceNumberComparer.cs プロジェクト: nhannd/Xian
		private static IEnumerable<IComparable> GetCompareValues(Sop sop)
		{
            //Group be common study level attributes
            yield return sop.StudyInstanceUid;

            //Group by common series level attributes
            //This sorts "FOR PRESENTATION" images to the beginning (except in reverse, of course).
            if (!sop.IsImage)
                yield return 1;
            else
                yield return ((ImageSop)sop).PresentationIntentType == "FOR PRESENTATION" ? 0 : 1;

            yield return sop.SeriesNumber;
            yield return sop.SeriesDescription;
            yield return sop.SeriesInstanceUid;

			yield return sop.InstanceNumber;
			yield return sop[DicomTags.AcquisitionNumber].GetInt32(0, 0);
		}
コード例 #13
0
ファイル: StudyTree.cs プロジェクト: hksonngan/Xian
        private void AddSeries(Sop sop)
        {
            Series series;

            if (_series.ContainsKey(sop.SeriesInstanceUid))
            {
                series = _series[sop.SeriesInstanceUid];
            }
            else
            {
                Study study = _studies[sop.StudyInstanceUid];
                series = new Series(study);
                series.SetSop(sop);
                study.Series.Add(series);

                _series[series.SeriesInstanceUid] = series;
            }

            sop.ParentSeries = series;
            series.Sops.Add(sop);
        }
コード例 #14
0
        /// <summary>
        /// Adds a <see cref="Sop"/> to the <see cref="StudyTree"/>.
        /// </summary>
        public bool AddSop(Sop sop)
        {
            Platform.CheckForNullReference(sop, "sop");

            //disable
            //if (!this.SopValidationDisabled)
            //    sop.Validate();

            if (_sops.ContainsKey(sop.SopInstanceUid))
            {
                sop.Dispose();
                return(false);
            }

            AddPatient(sop);
            AddStudy(sop);
            AddSeries(sop);
            _sops[sop.SopInstanceUid] = sop;

            return(true);
        }
コード例 #15
0
ファイル: Study.cs プロジェクト: m-berkani/ClearCanvas
		internal void SetSop(Sop sop)
		{
			if (sop == null)
				_sop = null;
			else if (_sop == null)
				_sop = sop;

			this.ParentPatient.SetSop(sop);
		}
コード例 #16
0
		protected SopInstanceReferenceBase(Sop sop)
			: this(sop.StudyInstanceUid, sop.SeriesInstanceUid, sop.SopClassUid, sop.SopInstanceUid, sop.DataSource[DicomTags.SourceApplicationEntityTitle].ToString()) {}
コード例 #17
0
		public SopInstanceReference(Sop sop)
			: base(sop) {}
コード例 #18
0
		/// <summary>
		/// Creates the presentation images for a given image SOP.
		/// </summary>
		/// <param name="sop">The image SOP from which presentation images are to be created.</param>
		/// <returns>A list of created presentation images.</returns>
		public virtual List<IPresentationImage> CreateImages(Sop sop)
		{
			if (sop.IsImage)
				return CreateImages((ImageSop)sop);
			
			if (sop.SopClassUid == SopClass.KeyObjectSelectionDocumentStorageUid)
				return CreateImages(new KeyObjectSelectionDocumentIod(sop.DataSource));

			return new List<IPresentationImage>();
		}
コード例 #19
0
ファイル: Patient.cs プロジェクト: m-berkani/ClearCanvas
		internal void SetSop(Sop sop)
		{
			if (sop == null)
				_sop = null;
			else if (_sop == null)
				_sop = sop;
		}
コード例 #20
0
		private static bool IsAttenuationCorrected(Sop sop)
		{
			var correctionTypes = DicomStringHelper.GetStringArray(sop[DicomTags.CorrectedImage].ToString().ToUpperInvariant());
			return (Array.FindIndex(correctionTypes, s => s == _attenuationCorrectionCode) >= 0);
		}
コード例 #21
0
		public KeyImageInformation(StudyTree studyTree, Sop keyObjectSelectionDocument)
			: base(CreateClipboardItems(studyTree, keyObjectSelectionDocument))
		{
			var koDeserializer = new KeyImageDeserializer(keyObjectSelectionDocument);
			var description = koDeserializer.DeserializeDescriptions().OfType<KeyObjectDescriptionContentItem>().FirstOrDefault();
			var author = koDeserializer.DeserializeObserverContexts().OfType<PersonObserverContextContentItem>().FirstOrDefault();

			_parentStudyInstanceUid = keyObjectSelectionDocument.StudyInstanceUid;
			_documentInstanceUid = keyObjectSelectionDocument.SopInstanceUid;
			_author = author != null ? author.PersonObserverName : string.Empty;
			_description = description != null ? description.Description : string.Empty;
			_documentTitle = koDeserializer.DocumentTitle ?? KeyObjectSelectionDocumentTitleContextGroup.OfInterest;
			_seriesDescription = keyObjectSelectionDocument.SeriesDescription;
			_seriesNumber = keyObjectSelectionDocument.SeriesNumber;
			_contentDateTime = DateTimeParser.ParseDateAndTime(null, keyObjectSelectionDocument.ContentDate, keyObjectSelectionDocument.ContentTime);
			_name = string.Format(SR.FormatOriginalKeyImageSelection, keyObjectSelectionDocument.SeriesNumber, keyObjectSelectionDocument.SeriesDescription, Format.DateTime(_contentDateTime));
		}
コード例 #22
0
		public SopArgumentHint(Sop sop) : this(sop.DataSource) {}
コード例 #23
0
ファイル: SopReference.cs プロジェクト: m-berkani/ClearCanvas
			public void Dispose()
			{
				if (_sop != null)
				{
					_sop.OnReferenceDisposed();
					_sop = null;
				}
			}
コード例 #24
0
ファイル: SopReference.cs プロジェクト: m-berkani/ClearCanvas
			public SopReference(Sop sop)
			{
				_sop = sop;
				_sop.OnReferenceCreated();
			}
コード例 #25
0
		/// <summary>
		/// Constructs a new instance of <see cref="KeyImageDeserializer"/>.
		/// </summary>
		/// <remarks>
		/// <para>Due to the relatively new nature of key object support in the ClearCanvas Framework, this API may be more prone to changes in the next release.</para>
		/// </remarks>
		public KeyImageDeserializer(Sop sourceSop)
		{
			_document = new KeyObjectSelectionDocumentIod(sourceSop);
		}
コード例 #26
0
ファイル: Series.cs プロジェクト: nhannd/Xian
		internal void SetSop(Sop sop)
		{
			if (sop == null)
				_sop = null;
			else if (_sop == null)
				_sop = sop;

			ParentStudy.SetSop(sop);
		}
コード例 #27
0
 /// <summary>
 /// Creates a <see cref="Sop"/> from the given <see cref="ISopDataSource"/>.
 /// </summary>
 protected virtual Sop CreateSop(ISopDataSource dataSource)
 {
     return(Sop.Create(dataSource));
 }
コード例 #28
0
        private SegmentationMenuInfo MenuInfoFromDocumentAndSeg(SegmentationDocument segmentationDocument, Seg seg, Sop sop)
        {
            if (seg.SegmentImageData != null &&
                seg.SegmentImageData.SegmentFrameData != null &&
                seg.SegmentImageData.SegmentFrameData.Count > 0)
            {
                return new SegmentationMenuInfo
                           {
                               DisplayLabel = seg.DisplayLabel,
                               DisplayImageSeriesUid = seg.ImageSeriesUid,
                               SegmentationNumber = seg.SegmentationNumber,
                               SegmentationDocumentUid = segmentationDocument.SopInstanceUid,
                               SeriesNumber = segmentationDocument.SeriesNumber,
                               ImagePositionPatient = seg.SegmentImageData.SegmentFrameData[0].ImagePositionPatient,
                               ImageOrientationPatient =
                                   seg.SegmentImageData.SegmentFrameData[0].ImageOrientationPatient,
                               FrameOfReferenceUid = seg.SegmentImageData.FrameOfReferenceUid,
                               PatientId = sop.PatientId,
                               PatientsName = sop.PatientsName,
                               StudyAccessionNumber = sop.AccessionNumber,
                               StudyDate = sop.StudyDate,
                               StudyTime = sop.StudyTime,
                               StudyDescription = sop.StudyDescription,
                               StudyInstanceUid = sop.StudyInstanceUid
                           };
            }

            return null;
        }
コード例 #29
0
ファイル: StudyTree.cs プロジェクト: m-berkani/ClearCanvas
		private void AddStudy(Sop sop)
		{
			if (_studies.ContainsKey(sop.StudyInstanceUid))
				return;

			Patient patient = _patients[sop.PatientId];
			Study study = new Study(patient);
			study.SetSop(sop);
			patient.Studies.Add(study);

			_studies[study.StudyInstanceUid] = study;
		}
コード例 #30
0
ファイル: StudyTree.cs プロジェクト: m-berkani/ClearCanvas
		private void AddSeries(Sop sop)
		{
			Series series;
			if (_series.ContainsKey(sop.SeriesInstanceUid))
			{
				series = _series[sop.SeriesInstanceUid];
			}
			else
			{
				Study study = _studies[sop.StudyInstanceUid];
				series = new Series(study);
				series.SetSop(sop);
				study.Series.Add(series);

				_series[series.SeriesInstanceUid] = series;
			}

			sop.ParentSeries = series;
			series.Sops.Add(sop);
		}
コード例 #31
0
ファイル: DisplaySetDescriptor.cs プロジェクト: nhannd/Xian
		internal virtual bool ShouldAddSop(Sop sop)
		{
			return false;
		}
コード例 #32
0
ファイル: InstanceNumberComparer.cs プロジェクト: nhannd/Xian
		/// <summary>
		/// Compares 2 <see cref="Sop"/>s based on Instance Number.
		/// </summary>
		public override int Compare(Sop x, Sop y)
		{
			return Compare(GetCompareValues(x), GetCompareValues(y));
		}
コード例 #33
0
ファイル: SopReference.cs プロジェクト: hksonngan/Xian
 public SopReference(Sop sop)
 {
     _sop = sop;
     _sop.OnReferenceCreated();
 }
コード例 #34
0
ファイル: DisplaySetDescriptor.cs プロジェクト: nhannd/Xian
        //Add this when we actually support it.
		internal virtual bool Update(Sop sop)
		{
            throw new NotSupportedException();
		}
コード例 #35
0
ファイル: StudyTree.cs プロジェクト: m-berkani/ClearCanvas
		/// <summary>
		/// Adds a <see cref="Sop"/> to the <see cref="StudyTree"/>.
		/// </summary>
		public bool AddSop(Sop sop)
		{
			Platform.CheckForNullReference(sop, "sop");

			if (!this.SopValidationDisabled)
				sop.Validate();

			if (_sops.ContainsKey(sop.SopInstanceUid))
			{
				sop.Dispose();
				return false;
			}

			AddPatient(sop);
			AddStudy(sop);
			AddSeries(sop);
			_sops[sop.SopInstanceUid] = sop;
		
			return true;
		}
コード例 #36
0
ファイル: StudyTree.cs プロジェクト: m-berkani/ClearCanvas
		private void AddPatient(Sop sop)
		{
			if (_patients[sop.PatientId] != null)
				return;

			Patient patient = new Patient();
			patient.SetSop(sop);

			_patients.Add(patient);
		}
コード例 #37
0
            public PlaceholderPresentationImage(Sop sop)
                : base(new GrayscaleImageGraphic(1, 1))
            {
                _sopReference = sop.CreateTransientReference();

                var sopClass = SopClass.GetSopClass(sop.SopClassUid);
                var sopClassDescription = sopClass != null ? sopClass.Name : SR.LabelUnknown;
                CompositeImageGraphic.Graphics.Add(new ErrorMessageGraphic { Text = string.Format(SR.MessageUnsupportedImageType, sopClassDescription), Color = Color.WhiteSmoke });
                Platform.Log(LogLevel.Warn, "Unsupported SOP Class \"{0} ({1})\" (SOP Instance {2})", sopClassDescription, sop.SopClassUid, sop.SopInstanceUid);
            }
コード例 #38
0
 private void AddSegmentationMenuInfo(SegmentationDocument segmentationDocument, Seg seg, Sop sop)
 {
     if (
         !_segmentationMenuInfos.ContainsKey(
             segmentationDocument.SopInstanceUid + seg.SegmentationNumber))
     {
         SegmentationMenuInfo info =
             MenuInfoFromDocumentAndSeg(segmentationDocument, seg, sop);
         if (info != null)
             _segmentationMenuInfos.Add(
                 segmentationDocument.SopInstanceUid + seg.SegmentationNumber,
                 info);
     }
 }