/// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">The cloning context object.</param> private PlaceholderPresentationImage(PlaceholderPresentationImage source, ICloningContext context) : base(source, context) { _sopReference = source._sopReference.Clone(); context.CloneFields(source, this); }
public void Dispose() { if (_sopReference != null) { _sopReference.Dispose(); _sopReference = null; } }
public SopDataSourceStudyItem(Sop sop) { Platform.CheckTrue(sop.DataSource is ILocalSopDataSource, "Sop must be local"); { _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 SopDataSourceStudyItem(Sop sop) { if (sop.DataSource is ILocalSopDataSource) { _filename = ((ILocalSopDataSource) sop.DataSource).Filename; _sopReference = sop.CreateTransientReference(); } }
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(); } }
protected override void Dispose(bool disposing) { if (_sopReference != null) { _sopReference.Dispose(); _sopReference = null; } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { if (_sopReference != null) { _sopReference.Dispose(); _sopReference = null; } } base.Dispose(disposing); }
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); }
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."); }
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."); }
public FrameReference(Frame frame) { _frame = frame; _sopReference = _frame.ParentImageSop.CreateTransientReference(); }