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; } }
public SopDataSourceStudyItem(Sop sop) { Platform.CheckTrue(sop.DataSource is ILocalSopDataSource, "Sop must be local"); { _filename = ((ILocalSopDataSource) sop.DataSource).Filename; _sopReference = sop.CreateTransientReference(); } }
public SopDataSourceStudyItem(Sop sop) { if (sop.DataSource is ILocalSopDataSource) { _filename = ((ILocalSopDataSource) sop.DataSource).Filename; _sopReference = sop.CreateTransientReference(); } }
public SopDataSourceStudyItem(ILocalSopDataSource sopDataSource) { _filename = sopDataSource.Filename; using (Sop sop = new Sop(sopDataSource)) { _sopReference = sop.CreateTransientReference(); } }
public void Dispose() { if (_sop != null) { _sop.OnReferenceDisposed(); _sop = null; } }
internal void SetSop(Sop sop) { if (sop == null) { _sop = null; } else if (_sop == null) { _sop = sop; } }
/// <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; }
private void AddPatient(Sop sop) { if (_patients[sop.PatientId] != null) { return; } Patient patient = new Patient(); patient.SetSop(sop); _patients.Add(patient); }
internal void SetSop(Sop sop) { if (sop == null) { _sop = null; } else if (_sop == null) { _sop = sop; } ParentStudy.SetSop(sop); }
internal void SetSop(Sop sop) { if (sop == null) { _sop = null; } else if (_sop == null) { _sop = sop; } this.ParentPatient.SetSop(sop); }
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; }
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); }
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); }
/// <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); }
internal void SetSop(Sop sop) { if (sop == null) _sop = null; else if (_sop == null) _sop = sop; this.ParentPatient.SetSop(sop); }
protected SopInstanceReferenceBase(Sop sop) : this(sop.StudyInstanceUid, sop.SeriesInstanceUid, sop.SopClassUid, sop.SopInstanceUid, sop.DataSource[DicomTags.SourceApplicationEntityTitle].ToString()) {}
public SopInstanceReference(Sop sop) : base(sop) {}
/// <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>(); }
internal void SetSop(Sop sop) { if (sop == null) _sop = null; else if (_sop == null) _sop = sop; }
private static bool IsAttenuationCorrected(Sop sop) { var correctionTypes = DicomStringHelper.GetStringArray(sop[DicomTags.CorrectedImage].ToString().ToUpperInvariant()); return (Array.FindIndex(correctionTypes, s => s == _attenuationCorrectionCode) >= 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)); }
public SopArgumentHint(Sop sop) : this(sop.DataSource) {}
public void Dispose() { if (_sop != null) { _sop.OnReferenceDisposed(); _sop = null; } }
public SopReference(Sop sop) { _sop = sop; _sop.OnReferenceCreated(); }
/// <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); }
internal void SetSop(Sop sop) { if (sop == null) _sop = null; else if (_sop == null) _sop = sop; ParentStudy.SetSop(sop); }
/// <summary> /// Creates a <see cref="Sop"/> from the given <see cref="ISopDataSource"/>. /// </summary> protected virtual Sop CreateSop(ISopDataSource dataSource) { return(Sop.Create(dataSource)); }
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; }
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; }
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); }
internal virtual bool ShouldAddSop(Sop sop) { return false; }
/// <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)); }
public SopReference(Sop sop) { _sop = sop; _sop.OnReferenceCreated(); }
//Add this when we actually support it. internal virtual bool Update(Sop sop) { throw new NotSupportedException(); }
/// <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; }
private void AddPatient(Sop sop) { if (_patients[sop.PatientId] != null) return; Patient patient = new Patient(); patient.SetSop(sop); _patients.Add(patient); }
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); }
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); } }