public StudyTree CreateStudyTree(List<Sop> sops) { StudyTree studyTree = new StudyTree(); foreach (Sop sop in sops) studyTree.AddSop(sop); return studyTree; }
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 KeyImageClipboard(StudyTree studyTree) { _studyTree = studyTree; _currentContext = new KeyImageInformation(); _availableContexts = new ObservableList<KeyImageInformation> {_currentContext}; _availableContexts.AddRange(_studyTree.Studies .SelectMany(s => s.Series) .SelectMany(s => s.Sops) .Where(s => s.SopClassUid == SopClass.KeyObjectSelectionDocumentStorageUid) .Select(s => new KeyImageInformation(studyTree, s)) .OrderByDescending(s => s.ContentDateTime) .ThenBy(s => s.SeriesNumber)); }
public ImageSetFiller(StudyTree studyTree, IDisplaySetCreationOptions displaySetCreationOptions) { _displaySetCreationOptions = displaySetCreationOptions; foreach (IModalityDisplaySetCreationOptions option in displaySetCreationOptions) _modalityDisplaySetFactories[option.Modality] = new DisplaySetFactory(option); _modalityDisplaySetFactory = new ModalityDisplaySetFactory(); _defaultDisplaySetFactory = new BasicDisplaySetFactory(); foreach (IDisplaySetFactory displaySetFactory in _modalityDisplaySetFactories.Values) displaySetFactory.SetStudyTree(studyTree); _modalityDisplaySetFactory.SetStudyTree(studyTree); _defaultDisplaySetFactory.SetStudyTree(studyTree); }
void IPatientReconciliationStrategy.SetStudyTree(StudyTree studyTree) { StudyTree = studyTree; }
void IImageSetFactory.SetStudyTree(StudyTree studyTree) { _studyTree = studyTree; _displaySetFactory.SetStudyTree(studyTree); }
void IPresentationImageFactory.SetStudyTree(StudyTree studyTree) { _studyTree = studyTree; }
/// <summary> /// Sets the <see cref="StudyManagement.StudyTree"/> where the factory can search for referenced <see cref="Sop"/>s. /// </summary> public virtual void SetStudyTree(StudyTree studyTree) { _studyTree = studyTree; PresentationImageFactory.SetStudyTree(_studyTree); }
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)); }
private void Test(StudyTree studyTree, StudyBuilder builder, DisplaySetCreationOptions options, bool expectModalityDisplaySet, int expectedDisplaySetCount) { var filler = new LayoutManager.ImageSetFiller(studyTree, options); var imageSet = new ImageSet { Uid = builder.StudyInstanceUid }; var study = studyTree.Studies.First(); try { //NOTE: follow the same pattern as the layout manager where we add the "all images" display sets //first, then we add ones for the individual series after. filler.AddMultiSeriesDisplaySets(imageSet, study); Assert.AreEqual(expectModalityDisplaySet ? 1 : 0, imageSet.DisplaySets.Count, "Empty Image Set"); foreach (var series in study.Series) filler.AddSeriesDisplaySets(imageSet, series); Assert.AreEqual(expectedDisplaySetCount, imageSet.DisplaySets.Count, "Display Set Counts"); } finally { studyTree.Dispose(); imageSet.Dispose(); } }
public void TestMixedMultiframe(bool split, bool showOriginal, bool showOriginalSeries, int numberSingleImages, int numberMultiframes, int expectedDisplaySetCount) { Trace.WriteLine(String.Format("Mixed Multiframe: split={0}, showOriginal={1}, showOriginalSeries={2}, " + "singleImages={3}, multiFrames={4}" , split, showOriginal, showOriginalSeries, numberSingleImages, numberMultiframes)); var studyTree = new StudyTree(); var builder = StudyBuilderFactory.CreateMixedMultiframeUltrasound("Patient1", "Test^Patient", "Mixed Multiframe", null, 3, "Series3", numberSingleImages, numberMultiframes, false, false); builder.AddStudy(studyTree); var options = new DisplaySetCreationOptions(); var o = (StoredDisplaySetCreationSetting)options["US"]; Assert.IsTrue(o.SplitMixedMultiframes); Assert.IsFalse(o.ShowOriginalMixedMultiframeSeries); Assert.IsTrue(o.ShowOriginalSeries); o.SplitMixedMultiframes = split; o.ShowOriginalMixedMultiframeSeries = showOriginal; o.ShowOriginalSeries = showOriginalSeries; Test(studyTree, builder, options, false, expectedDisplaySetCount); }
public void TestMR(bool createEchos, bool split, bool showOriginal, bool showOriginalSeries, int expectedDisplaySetCount) { Trace.WriteLine(String.Format("MR Echo: split={0}, showOriginal={1}, showOriginalSeries={2}", split, showOriginal, showOriginalSeries)); var studyTree = new StudyTree(); var builder = StudyBuilderFactory.CreateMRBuilder("Patient1", "Test^Patient", "MR Echo", null, "Series1", "Series2", 1, createEchos, false); builder.AddStudy(studyTree); var options = new DisplaySetCreationOptions(); var o = (StoredDisplaySetCreationSetting)options["MR"]; Assert.IsTrue(o.SplitMultiEchoSeries); Assert.IsFalse(o.ShowOriginalMultiEchoSeries); Assert.IsTrue(o.ShowOriginalSeries); o.SplitMultiEchoSeries = split; o.ShowOriginalMultiEchoSeries = showOriginal; o.ShowOriginalSeries = showOriginalSeries; Test(studyTree, builder, options, false, expectedDisplaySetCount); }
public void TestCT(int expectedDisplaySetCount) { var studyTree = new StudyTree(); var builder = StudyBuilderFactory.CreateCTChestBuilder("Patient1", "Test^Patient", "Chest", null, "Scout", "Axial", 22); Assert.AreEqual(2, builder.Series.Count); foreach (var series in builder.Series) Assert.IsTrue(series.Images.Count > 1); builder.AddStudy(studyTree); var options = new DisplaySetCreationOptions(); var o = (StoredDisplaySetCreationSetting)options["CT"]; Assert.IsTrue(o.ShowOriginalSeries); Test(studyTree, builder, options, false, expectedDisplaySetCount); }
public void TestDX(bool oneSeries, bool oneImagePerSeries, bool createSingleImages, bool createAllImages, bool showOriginal, int expectedDisplaySetCount) { Trace.WriteLine(String.Format("DX: oneSeries={0}, oneImagePerSeries={1}, createSingleImages={2}, createAllImages={3}, showOriginal={4}" , oneSeries, oneImagePerSeries, createSingleImages, createAllImages, showOriginal)); var studyTree = new StudyTree(); var builder = StudyBuilderFactory.CreateDigitalXRayBuilder("Patient1", "Test^Patient", "Chest", null, "Chest", 3, oneSeries, oneImagePerSeries, false); var seriesCount = oneSeries ? 1 : 2; var imageCount = oneImagePerSeries ? 1 : 2; Assert.AreEqual(seriesCount, builder.Series.Count); foreach (var series in builder.Series) Assert.AreEqual(imageCount, series.Images.Count); builder.AddStudy(studyTree); var options = new DisplaySetCreationOptions(); var o = (StoredDisplaySetCreationSetting)options["DX"]; o.CreateAllImagesDisplaySet = createAllImages; o.CreateSingleImageDisplaySets = createSingleImages; o.ShowOriginalSeries = showOriginal; Test(studyTree, builder, options, createAllImages && seriesCount > 1, expectedDisplaySetCount); }
public void TestMG(bool createSingleImages, bool createAllImages, bool showOriginal, int expectedDisplaySetCount) { Trace.WriteLine(String.Format("MG: createSingleImages={0}, createAllImages={1}, showOriginal={2}" , createSingleImages, createAllImages, showOriginal)); var studyTree = new StudyTree(); var builder = StudyBuilderFactory.CreateDigitalMammoBuilder("Patient1", "Test^Patient", "Breast", null, "Bilateral Mammo", 33, false); Assert.AreEqual(2, builder.Series.Count); foreach (var series in builder.Series) Assert.AreEqual(4, series.Images.Count); builder.AddStudy(studyTree); var options = new DisplaySetCreationOptions(); var o = (StoredDisplaySetCreationSetting)options["MG"]; o.CreateAllImagesDisplaySet = createAllImages; o.CreateSingleImageDisplaySets = createSingleImages; o.ShowOriginalSeries = showOriginal; Test(studyTree, builder, options, createAllImages, expectedDisplaySetCount); }
internal static IEnumerable<IDisplaySet> CreateSeriesDisplaySets(Series series, StudyTree studyTree) { BasicDisplaySetFactory factory = new BasicDisplaySetFactory(); factory.SetStudyTree(studyTree); return factory.CreateDisplaySets(series); }
public override void SetStudyTree(StudyTree studyTree) { base.SetStudyTree(studyTree); _basicFactory.SetStudyTree(studyTree); if (_echoFactory != null) _echoFactory.SetStudyTree(studyTree); if (_mixedMultiFrameFactory != null) _mixedMultiFrameFactory.SetStudyTree(studyTree); _placeholderDisplaySetFactory.SetStudyTree(studyTree); foreach (var factory in _externalFactories) factory.SetStudyTree(studyTree); }