Beispiel #1
0
 public SopDataSourceStudyItem(ILocalSopDataSource sopDataSource)
 {
     _filename = sopDataSource.Filename;
     using (Sop sop = new Sop(sopDataSource))
     {
         _sopReference = sop.CreateTransientReference();
     }
 }
Beispiel #2
0
 public SopDataSourceStudyItem(Sop sop)
 {
     if (sop.DataSource is ILocalSopDataSource)
     {
         _filename     = ((ILocalSopDataSource)sop.DataSource).Filename;
         _sopReference = sop.CreateTransientReference();
     }
 }
Beispiel #3
0
 public SopDataSourceStudyItem(Sop sop)
 {
     Platform.CheckTrue(sop.DataSource is ILocalSopDataSource, "Sop must be local");
     {
         _filename     = ((ILocalSopDataSource)sop.DataSource).Filename;
         _sopReference = sop.CreateTransientReference();
     }
 }
            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);
            }
Beispiel #5
0
        public void TestReferences2()
        {
            IList <DicomAttributeCollection> collections = base.SetupMRSeries(1, 1, "test");
            DicomFile      file       = new DicomFile(null, new DicomAttributeCollection(), collections[0]);
            TestDataSource dataSource = new TestDataSource(file);
            Sop            sop        = Sop.Create(dataSource);

            ISopReference reference1 = sop.CreateTransientReference();
            ISopReference reference2 = sop.CreateTransientReference();

            sop.Dispose();
            Assert.IsFalse(dataSource.IsDisposed);
            Assert.IsFalse(SopDataCache.ItemCount == 0, "The Sop data cache is NOT empty.");

            reference1.Dispose();
            Assert.IsFalse(dataSource.IsDisposed);
            Assert.IsFalse(SopDataCache.ItemCount == 0, "The Sop data cache is NOT empty.");

            reference2.Dispose();
            Assert.IsTrue(dataSource.IsDisposed);
            Assert.IsTrue(SopDataCache.ItemCount == 0, "The Sop data cache is NOT empty.");
        }
Beispiel #6
0
        public void TestCaching()
        {
            IList <DicomAttributeCollection> collections = base.SetupMRSeries(1, 1, "test");
            DicomFile file1 = new DicomFile(null, new DicomAttributeCollection(), collections[0].Copy());
            DicomFile file2 = new DicomFile(null, new DicomAttributeCollection(), collections[0].Copy());

            TestDataSource dataSource1 = new TestDataSource(file1);
            TestDataSource dataSource2 = new TestDataSource(file2);

            Sop sop1 = Sop.Create(dataSource1);

            Assert.IsTrue(SopDataCache.ItemCount == 1, "The Sop data cache should have 1 entry.");

            Sop sop2 = Sop.Create(dataSource2);

            Assert.IsTrue(SopDataCache.ItemCount == 1, "The Sop data cache should have 1 entry.");
            Assert.IsTrue(dataSource2.IsDisposed, "The data source has not been disposed.");
            Assert.IsFalse(dataSource1.IsDisposed, "The data source should not be disposed.");

            sop1.Dispose();
            Assert.IsTrue(SopDataCache.ItemCount == 1, "The Sop data cache should have 1 entry.");

            ISopReference reference21 = sop2.CreateTransientReference();
            ISopReference reference22 = sop2.CreateTransientReference();

            reference21.Dispose();
            Assert.IsFalse(dataSource1.IsDisposed, "The data source has been disposed.");
            Assert.IsTrue(SopDataCache.ItemCount == 1, "The Sop data cache should have 1 entry.");

            sop2.Dispose();
            Assert.IsFalse(dataSource1.IsDisposed, "The data source has been disposed.");
            Assert.IsTrue(SopDataCache.ItemCount == 1, "The Sop data cache should have 1 entry.");

            reference22.Dispose();
            Assert.IsTrue(dataSource1.IsDisposed, "The data source has not been disposed.");
            Assert.IsTrue(SopDataCache.ItemCount == 0, "The Sop data cache is NOT empty.");
        }