The following diagram shows the relationship between DicomImage and DicomDataSet objects.
DicomImage contains DicomDataSet which holds the pixel data.
DicomImage.Dispose() method does not need to be called explicitly as it will get cleaned up eventually via a finaliser when called from the Garbage Collector.
The following objects are cleared when DicomImage object is disposed:
DicomDataSet object contains all DICOM attributes, including pixel data. It also contains the Textures when in DirectX mode.
DicomDataSet.Dispose() method does not need to be called explicitly as it will get cleaned up eventually via a finaliser when called from the Garbage Collector.
The following objects are cleared when DicomDataSet object is disposed:
disposing DicomImage object does not necessarily dispose the DicomDataSet object the image contains, as the above diagram shows it is possible to construct 2 DicomImage objects that share the same DicomDataSet object. To clean things up more predictably, it is best to call Dispose on both the DicomImage and the DicomDataset (assuming that no other images are using the dataset) in either order.
There are a few unmanaged resources being used: