⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pixeldata.cs

📁 Open Dicom source code C#
💻 CS
📖 第 1 页 / 共 2 页
字号:
/*       openDICOM.NET openDICOM# 0.1.1    openDICOM# provides a library for DICOM related development on Mono.    Copyright (C) 2006-2007  Albert Gnandt    This library is free software; you can redistribute it and/or    modify it under the terms of the GNU Lesser General Public    License as published by the Free Software Foundation; either    version 2.1 of the License, or (at your option) any later version.    This library is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU    Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public    License along with this library; if not, write to the Free Software    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA    $Id: PixelData.cs 48 2007-03-28 13:49:15Z agnandt $*/using System;using System.IO;using System.Text.RegularExpressions;using openDicom;using openDicom.DataStructure;using openDicom.DataStructure.DataSet;using openDicom.Encoding;namespace openDicom.Image{    /// <summary>    ///     Basic class for working with DICOM pixel data.    /// </summary>    public sealed class PixelData    {        /// <summary>        ///     DICOM tag (0028,0002).        /// </summary>        public static readonly Tag SamplesPerPixelTag  =             new Tag("0028", "0002");        /// <summary>        ///     DICOM tag (0028,0006).        /// </summary>        public static readonly Tag PlanarConfigurationTag =             new Tag("0028", "0006");        /// <summary>        ///     DICOM tag (0028,0010).        /// </summary>        public static readonly Tag RowsTag          = new Tag("0028", "0010");        /// <summary>        ///     DICOM tag (0028,0011).        /// </summary>        public static readonly Tag ColumnsTag       = new Tag("0028", "0011");        /// <summary>        ///     DICOM tag (0028,0100).        /// </summary>        public static readonly Tag BitsAllocatedTag = new Tag("0028", "0100");        /// <summary>        ///     DICOM tag (0028,0101).        /// </summary>        public static readonly Tag BitsStoredTag    = new Tag("0028", "0101");        /// <summary>        ///     DICOM tag (0028,0102).        /// </summary>        public static readonly Tag HighBitTag       = new Tag("0028", "0102");        /// <summary>        ///     DICOM tag (7FE0,0010).        /// </summary>        public static readonly Tag PixelDataTag     = new Tag("7FE0", "0010");        private int samplesPerPixel = 0;        /// <summary>        ///     Value from DICOM tag (0028,0002). If this value is not        ///     specified, 0 will be returned.        /// </summary>        public int SamplesPerPixel        {            get            {                if (samplesPerPixel > 0)                    return samplesPerPixel;                else                    throw new DicomException("Pixel data samples per pixel " +                        "are invalid.", "PixelData.SamplesPerPixel",                         samplesPerPixel.ToString());            }        }        private int planarConfiguration = -1;        /// <summary>        ///     Value from DICOM tag (0028,0006). If this value is not        ///     specified, -1 will be returned.        /// </summary>        public int PlanarConfiguration        {            get            {                if (planarConfiguration >= 0 && planarConfiguration <= 1)                    return planarConfiguration;                else                    throw new DicomException("Pixel data planar configuration " +                        "is invalid.", "PixelData.PlanarConfiguration",                         planarConfiguration.ToString());            }        }        private int rows = 0;        /// <summary>        ///     Value from DICOM tag (0028,0010). If this value is not        ///     specified, 0 will be returned.        /// </summary>        public int Rows        {            get            {                if (rows > 0)                    return rows;                else                    throw new DicomException("Pixel data rows are invalid.",                         "PixelData.Rows", rows.ToString());            }        }        private int columns = 0;        /// <summary>        ///     Value from DICOM tag (0028,0011). If this value is not        ///     specified, 0 will be returned.        /// </summary>        public int Columns        {            get            {                if (columns > 0)                    return columns;                else                    throw new DicomException("Pixel data columns are invalid.",                         "PixelData.Columns", columns.ToString());            }        }        private int bitsAllocated = 0;        /// <summary>        ///     Value from DICOM tag (0028,0100). If this value is not        ///     specified, 0 will be returned.        /// </summary>        public int BitsAllocated        {            get            {                if (bitsAllocated > 0)                    return bitsAllocated;                else                    throw new DicomException("Pixel data bits allocated is invalid.",                         "PixelData.BitsAllocated", bitsAllocated.ToString());            }        }        private int bitsStored = 0;        /// <summary>        ///     Value from DICOM tag (0028,0101). If this value is not        ///     specified, 0 will be returned.        /// </summary>        public int BitsStored        {            get            {                if (bitsStored > 0)                    return bitsStored;                else                    throw new DicomException("Pixel data bits stored is invalid.",                         "PixelData.BitsStored", bitsStored.ToString());            }        }        private int highBit = -1;        /// <summary>        ///     Value from DICOM tag (0028,0102). If this value is not        ///     specified, -1 will be returned.        /// </summary>        public int HighBit        {            get            {                if (highBit > -1)                    return highBit;                else                    throw new DicomException("Pixel data high bit is invalid.",                         "PixelData.HighBit", highBit.ToString());            }        }        private DataElement data = null;        /// <summary>        ///     Pixel data, DICOM tag (7FE0,0010), as DICOM data element.        /// </summary>        public DataElement Data        {            get            {                if (data != null)                    return data;                else                    throw new DicomException("Pixel data is null.",                         "PixelData.Data");            }        }        private TransferSyntax transferSyntax = null;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -