Exemple #1
0
        public string ComputePixelDataMD5()
        {
            if (!Contains(DicomTags.PixelData))
                throw new DicomDataException("Dataset does not contain pixel data");

            DcmPixelData pixelData = new DcmPixelData(this);
            return pixelData.ComputeMD5();
        }
Exemple #2
0
        private void OnClickPixelDataMD5(object sender, EventArgs e)
        {
            if (_selected == -1)
                return;

            try {
                DicomFileFormat ff = new DicomFileFormat();
                ff.Load(_files[_selected], DicomReadOptions.Default |
                        DicomReadOptions.KeepGroupLengths |
                        DicomReadOptions.DeferLoadingLargeElements |
                        DicomReadOptions.DeferLoadingPixelData);

                DcmPixelData pixels = new DcmPixelData(ff.Dataset);

                if (pixels.NumberOfFrames == 0) {
                    MessageBox.Show(this, "No pixel data", "Pixel Data MD5");
                } else if (pixels.NumberOfFrames >= 1) {
                    MessageBox.Show(this, pixels.ComputeMD5(), String.Format("Pixel Data MD5 [{0} frames]", pixels.NumberOfFrames));
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            } catch {
            }
        }