• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Data.DcmDataset类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Dicom.Data.DcmDataset的典型用法代码示例。如果您正苦于以下问题:C# DcmDataset类的具体用法?C# DcmDataset怎么用?C# DcmDataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DcmDataset类属于Dicom.Data命名空间,在下文中一共展示了DcmDataset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FromDataset

        public static WindowLevel[] FromDataset(DcmDataset dataset)
        {
            List<WindowLevel> settings = new List<WindowLevel>();

            if (dataset.Contains(DicomTags.WindowCenter) && dataset.Contains(DicomTags.WindowWidth)) {
                string[] wc = dataset.GetDS(DicomTags.WindowCenter).GetValues();
                string[] ww = dataset.GetDS(DicomTags.WindowWidth).GetValues();

                if (wc.Length != ww.Length)
                    throw new DicomImagingException("Window Center count does not match Window Width count");

                string[] desc = null;
                if (dataset.Contains(DicomTags.WindowCenterWidthExplanation)) {
                    desc = dataset.GetLO(DicomTags.WindowCenterWidthExplanation).GetValues();
                }

                for (int i = 0; i < wc.Length; i++) {
                    double window;
                    double level;
                    if (!Double.TryParse(ww[i], out window) || !Double.TryParse(wc[i], out level))
                        throw new DicomImagingException("Unable to parse Window/Level [wc: {0}; ww: {1}]", wc[i], ww[i]);

                    string description = String.Empty;
                    if (desc != null && i < desc.Length)
                        description = desc[i];

                    settings.Add(new WindowLevel(description, window, level));
                }
            }

            return settings.ToArray();
        }
开发者ID:JeanLedesma,项目名称:mdcm,代码行数:32,代码来源:WindowLevel.cs


示例2: DcmFilmBox

 /// <summary>
 /// Initializes new Basic Film Box
 /// </summary>
 /// <param name="session">Basic Film Session</param>
 /// <param name="sopInstance">SOP Instance UID</param>
 /// <param name="dataset">Dataset</param>
 public DcmFilmBox(DcmFilmSession session, DicomUID sopInstance, DcmDataset dataset)
 {
     _session = session;
     _sopInstance = sopInstance;
     _dataset = dataset;
     _boxes = new List<DcmImageBox>();
 }
开发者ID:k11hao,项目名称:mdcm-printscp,代码行数:13,代码来源:DicomPrint.cs


示例3: DcmImageBox

 /// <summary>
 /// Initializes new Basic Image Box
 /// </summary>
 /// <param name="filmBox">Basic Film Box</param>
 /// <param name="sopClass">SOP Class UID</param>
 /// <param name="sopInstance">SOP Instance UID</param>
 public DcmImageBox(DcmFilmBox filmBox, DicomUID sopClass, DicomUID sopInstance)
 {
     _filmBox = filmBox;
     _sopClass = sopClass;
     _sopInstance = sopInstance;
     _dataset = new DcmDataset(DicomTransferSyntax.ImplicitVRLittleEndian);
 }
开发者ID:hide1980,项目名称:mdcm,代码行数:13,代码来源:DcmImageBox.cs


示例4: LoadDataset

        private void LoadDataset(DcmDataset ds, Collection<Node> parent)
        {
            if (ds == null)
                return;

            foreach (DcmItem di in ds.Elements) {
                Image icon = LoadTreeViewAdvResourceImage("Leaf", di.VR.VR, Color.Blue);

                DicomNode dn = new DicomNode(icon, di);
                parent.Add(dn);

                if (di is DcmItemSequence) {
                    dn.Icon = LoadTreeViewAdvResourceImage("FolderClosed", "SQ", Color.Blue);

                    DcmItemSequence sq = di as DcmItemSequence;
                    foreach (DcmItemSequenceItem item in sq.SequenceItems) {
                        icon = LoadTreeViewAdvResourceImage("Folder", "", Color.Black);
                        DicomTagNode din = new DicomTagNode(icon, DicomTags.Item, item.StreamLength);
                        dn.Nodes.Add(din);
                        LoadDataset(item.Dataset, din.Nodes);
                        if (item.StreamLength == 0xffffffff) {
                            icon = LoadTreeViewAdvResourceImage("FolderClosed", "", Color.Black);
                            din.Nodes.Add(new DicomTagNode(icon, DicomTags.ItemDelimitationItem, 0));
                        }
                    }
                    if (sq.StreamLength == 0xffffffff) {
                        icon = LoadTreeViewAdvResourceImage("FolderClosed", "", Color.Black);
                        dn.Nodes.Add(new DicomTagNode(icon, DicomTags.SequenceDelimitationItem, 0));
                    }
                }
            }
        }
开发者ID:rameshr,项目名称:mdcm,代码行数:32,代码来源:DicomDumpForm.cs


示例5: ToXML

		public static XDocument ToXML(DcmDataset dataset, XDicomOptions options) {
			XDocument document = new XDocument(new XDeclaration("1.0", "utf-8", "yes"));
			XElement root = new XElement("dicom");
			LoadSequence(root, dataset.Elements, options);
			document.Add(root);
			return document;
		}
开发者ID:mcmssupereditor,项目名称:mdcm,代码行数:7,代码来源:XDicom.cs


示例6: DcmPixelData

		public DcmPixelData(DcmDataset dataset) {
			_transferSyntax = dataset.InternalTransferSyntax;
			_lossy = dataset.GetString(DicomTags.LossyImageCompression, "00") != "00";
			_lossyMethod = dataset.GetString(DicomTags.LossyImageCompressionMethod, String.Empty);
			_lossyRatio = dataset.GetString(DicomTags.LossyImageCompressionRatio, String.Empty);
			_frames = dataset.GetInt32(DicomTags.NumberOfFrames, 1);
			_width = dataset.GetUInt16(DicomTags.Columns, 0);
			_height = dataset.GetUInt16(DicomTags.Rows, 0);
			_bitsStored = dataset.GetUInt16(DicomTags.BitsStored, 0);
			_bitsAllocated = dataset.GetUInt16(DicomTags.BitsAllocated, 0);
			_highBit = dataset.GetUInt16(DicomTags.HighBit, (ushort)(_bitsStored - 1));
			_samplesPerPixel = dataset.GetUInt16(DicomTags.SamplesPerPixel, 0);
			_pixelRepresentation = dataset.GetUInt16(DicomTags.PixelRepresentation, 0);
			_planarConfiguration = dataset.GetUInt16(DicomTags.PlanarConfiguration, 0);
			_photometricInterpretation = dataset.GetString(DicomTags.PhotometricInterpretation, String.Empty);
			_rescaleSlope = dataset.GetDouble(DicomTags.RescaleSlope, 1.0);
			_rescaleIntercept = dataset.GetDouble(DicomTags.RescaleIntercept, 0.0);
			_pixelDataItem = dataset.GetItem(DicomTags.PixelData);

			_hasPixelPadding = dataset.Contains(DicomTags.PixelPaddingValue);
			if (_hasPixelPadding) {
				DcmElement elem = dataset.GetElement(DicomTags.PixelPaddingValue);
				if (elem is DcmUnsignedShort)
					_pixelPaddingValue = (elem as DcmUnsignedShort).GetValue();
				else if (elem is DcmSignedShort) {
					_pixelPaddingValue = (elem as DcmSignedShort).GetValue();
				} else
					_pixelPaddingValue = MinimumDataValue;
			}
		}
开发者ID:mcmssupereditor,项目名称:mdcm,代码行数:30,代码来源:DcmPixelData.cs


示例7: FilterByModality

        private static Expression<Func<Study, bool>> FilterByModality(DcmDataset query)
        {
            Expression<Func<Study, bool>> allMatch = p => true;

            var studyQuery = query.GetElement(DicomTags.ModalitiesInStudy);

            if (studyQuery == null)
                return allMatch;

            var valueString = studyQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var modalities = valueString.Replace(@"\\", @"\").Split('\\');

            if (modalities.Length == 1)
            {
                return s => s.ModalityAggregation.Contains(modalities[0]);
            }
            else
            {
                return s => s.Series.Any( series => modalities.Contains(series.PerformedModalityType));
            }
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:25,代码来源:StudyQueries.cs


示例8: Create

 public static IPipeline Create(DcmDataset dataset, DcmPixelData pixelData)
 {
     PhotometricInterpretation pi = PhotometricInterpretation.Lookup(pixelData.PhotometricInterpretation);
     if (pi == PhotometricInterpretation.Monochrome1 || pi == PhotometricInterpretation.Monochrome2) {
         GenericGrayscalePipeline pipeline = new GenericGrayscalePipeline(pixelData.RescaleSlope, pixelData.RescaleIntercept, pixelData.BitsStored, pixelData.IsSigned);
         if (pi == PhotometricInterpretation.Monochrome1)
             pipeline.ColorMap = ColorTable.Monochrome1;
         else
             pipeline.ColorMap = ColorTable.Monochrome2;
         WindowLevel[] wl = WindowLevel.FromDataset(dataset);
         if (wl.Length > 0)
             pipeline.WindowLevel = wl[0];
         return pipeline;
     }
     else if (pi == PhotometricInterpretation.Rgb)
     {
         return new RgbColorPipeline();
     }
     else if (pi == PhotometricInterpretation.YbrFull || pi == PhotometricInterpretation.YbrFull422)
     {
         return new RgbColorPipeline();
     }
     else
     {
         throw new DicomImagingException("Unsupported pipeline photometric interpretation: {0}", pi.Value);
     }
 }
开发者ID:vigilant,项目名称:mdcm,代码行数:27,代码来源:IPipeline.cs


示例9: Match

 public bool Match(DcmDataset dataset)
 {
     if (dataset.Contains(_tag)) {
         string value = dataset.GetValueString(_tag);
         return value.Contains(_value);
     }
     return false;
 }
开发者ID:fo-dicom,项目名称:mdcm,代码行数:8,代码来源:DicomMatch.cs


示例10: Transform

		public void Transform(DcmDataset dataset) {
			if (_conditions != null)
				if (!_conditions.Match(dataset))
					return;

			foreach (IDicomTransformRule rule in _transformRules)
				rule.Transform(dataset);
		}
开发者ID:hide1980,项目名称:mdcm,代码行数:8,代码来源:DicomTransform.cs


示例11: Load

 private void Load(DcmDataset dataset, int frame)
 {
     Dataset = dataset;
     if (Dataset.InternalTransferSyntax.IsEncapsulated)
         Dataset.ChangeTransferSyntax(DicomTransferSyntax.ExplicitVRLittleEndian, null);
     DcmPixelData pixelData = new DcmPixelData(Dataset);
     _pixelData = PixelDataFactory.Create(pixelData, frame);
     _pipeline = PipelineFactory.Create(Dataset, pixelData);
     pixelData.Unload();
 }
开发者ID:CharlieRoot,项目名称:mdcm,代码行数:10,代码来源:DicomImage.cs


示例12: DcmFilmSession

        /// <summary>
        /// Initializes new Basic Film Session
        /// </summary>
        /// <param name="sessionClass">Color or Grayscale Basic Print Management UID</param>
        /// <param name="sopInstance">SOP Instance UID</param>
        /// <param name="dataset">Dataset</param>
        public DcmFilmSession(DicomUID sessionClass, DicomUID sopInstance, DcmDataset dataset)
        {
            _sessionClass = sessionClass;
            _sopInstance = sopInstance;
            _dataset = dataset;
            _boxes = new List<DcmFilmBox>();

            if (_sopInstance == null || _sopInstance.UID == String.Empty)
                _sopInstance = DicomUID.Generate();
        }
开发者ID:hide1980,项目名称:mdcm,代码行数:16,代码来源:DcmFilmSession.cs


示例13: DicomFileFormat

		/// <summary>
		/// Initializes new DICOM file format from dataset
		/// </summary>
		/// <param name="dataset">Dataset</param>
		public DicomFileFormat(DcmDataset dataset) {
			_metainfo = new DcmFileMetaInfo();
			_metainfo.FileMetaInformationVersion = DcmFileMetaInfo.Version;
			_metainfo.MediaStorageSOPClassUID = dataset.GetUID(DicomTags.SOPClassUID);
			_metainfo.MediaStorageSOPInstanceUID = dataset.GetUID(DicomTags.SOPInstanceUID);
			_metainfo.TransferSyntax = dataset.InternalTransferSyntax;
			_metainfo.ImplementationClassUID = Implementation.ClassUID;
			_metainfo.ImplementationVersionName = Implementation.Version;
			_metainfo.SourceApplicationEntityTitle = "";
			_dataset = dataset;
		}
开发者ID:mcmssupereditor,项目名称:mdcm,代码行数:15,代码来源:DicomFileFormat.cs


示例14: GetMatchingSeries

        public static IQueryable<Series> GetMatchingSeries(MedicalISDataContext database, DcmDataset query)
        {
            var series = from s in database.Series select s;

            series = series.Where( FilterByStudyUid(query) );
            series = series.Where( FilterBySeriesUid(query) );
            series = series.Where( FilterBySeriesDate(query) );

            series.OrderBy(s => s.PerformedDateTime);

            return series;
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:12,代码来源:SeriesQueries.cs


示例15: FilterByPatientsName

        private static Expression<Func<Patient, bool>> FilterByPatientsName(DcmDataset query)
        {
            Expression<Func<Patient, bool>> allMatch = p => true;

            var patientNameQuery = query.GetElement(DicomTags.PatientsName);

            if (patientNameQuery == null)
                return allMatch;

            var patientNameDicomFormatted = patientNameQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(patientNameDicomFormatted))
                return allMatch;

            string[] lName;

            if (patientNameDicomFormatted.Contains("[^]"))
                lName = patientNameDicomFormatted.Split(new[] { "[^]" }, StringSplitOptions.None);
            else if (patientNameDicomFormatted.Contains("^"))
                lName = patientNameDicomFormatted.Split(new[] { "^" }, StringSplitOptions.None);
            else
                lName = patientNameDicomFormatted.Split(new[] { Properties.Settings.Default.PatientNameSplitCharacterForFind });

            var firstName = "";
            var lastName = "";

            if (lName.Length == 0)
                return allMatch;

            if (lName.Length >= 2)
            {
                firstName = lName[1];
                firstName = firstName.TrimEnd('*').Trim();
                firstName = firstName.Replace('*', '%');
            }

            if (lName.Length >= 1)
            {
                lastName = lName[0];
                lastName = lastName.TrimEnd('*').Trim();
                lastName = lastName.Replace('*', '%');
            }

            if (!firstName.StartsWith("\""))
                firstName += "%";
            if (!lastName.StartsWith("\""))
                lastName += "%";

            return p => SqlMethods.Like(p.FirstName, firstName) && SqlMethods.Like(p.LastName, lastName);
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:50,代码来源:PatientQueries.cs


示例16: Decode

        public void Decode(DcmDataset dataset, DcmPixelData oldPixelData, DcmPixelData newPixelData, DcmCodecParameters parameters)
        {
            DcmRleCodecParameters rleParams = parameters as DcmRleCodecParameters;

            if (rleParams == null)
                rleParams = GetDefaultParameters() as DcmRleCodecParameters;

            int pixelCount = oldPixelData.ImageWidth * oldPixelData.ImageHeight;
            int numberOfSegments = oldPixelData.BytesAllocated * oldPixelData.SamplesPerPixel;

            byte[] frameData = new byte[newPixelData.UncompressedFrameSize];

            for (int i = 0; i < oldPixelData.NumberOfFrames; i++)
            {
                IList<ByteBuffer> rleData = oldPixelData.GetFrameFragments(i);
                RLEDecoder decoder = new RLEDecoder(rleData);

                if (decoder.NumberOfSegments != numberOfSegments)
                    throw new DicomCodecException("Unexpected number of RLE segments!");

                for (int s = 0; s < numberOfSegments; s++)
                {
                    int sample = s / newPixelData.BytesAllocated;
                    int sabyte = s % newPixelData.BytesAllocated;

                    int pos, offset;

                    if (newPixelData.PlanarConfiguration == 0)
                    {
                        pos = sample * newPixelData.BytesAllocated;
                        offset = newPixelData.SamplesPerPixel * newPixelData.BytesAllocated;
                    }
                    else
                    {
                        pos = sample * newPixelData.BytesAllocated * pixelCount;
                        offset = newPixelData.BytesAllocated;
                    }

                    if (rleParams.ReverseByteOrder)
                        pos += sabyte;
                    else
                        pos += newPixelData.BytesAllocated - sabyte - 1;

                    decoder.DecodeSegment(s, frameData, pos, offset);
                }

                newPixelData.AddFrame(frameData);
            }
        }
开发者ID:GMZ,项目名称:mdcm,代码行数:49,代码来源:DcmRleCodec.cs


示例17: GetMatchingPatients

        public static IQueryable<Patient> GetMatchingPatients(MedicalISDataContext database, DcmDataset query, bool anonymousOnly = false)
        {
            var patients = from p in database.Patients select p;

            if( anonymousOnly == false )
                patients = patients.Where(FilterByPatientsName(query));

            patients = patients.Where(FilterByPatientsId(query));
            patients = patients.Where(FilterByPatientsBirthDate(query));
            patients = patients.Where(FilterByStudyPerformedDate(query));
            patients = patients.Where(FilterByStudyModalityDate(query));

            patients = patients.OrderByDescending(p => p.Studies.Max(s => s.PerformedDateTime));

            return patients;
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:16,代码来源:PatientQueries.cs


示例18: Match

		public bool Match(DcmDataset dataset) {
			if (_operator == DicomMatchOperator.Or) {
				foreach (IDicomMatchRule rule in _rules)
					if (rule.Match(dataset))
						return true;

				return false;
			}
			else {
				foreach (IDicomMatchRule rule in _rules)
					if (!rule.Match(dataset))
						return false;

				return true;
			}
		}
开发者ID:mcmssupereditor,项目名称:mdcm,代码行数:16,代码来源:DicomMatch.cs


示例19: FilterBySeriesDate

        private static Expression<Func<Series, bool>> FilterBySeriesDate(DcmDataset query)
        {
            Expression<Func<Series, bool>> allMatch = p => true;

            var studyQuery = query.GetElement(DicomTags.SeriesDate);

            if (studyQuery == null)
                return allMatch;

            var valueString = studyQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var dateTimeRange = DateTimeRangeQuery.Parse(valueString);

            return s => s.PerformedDateTime >= dateTimeRange.From && s.PerformedDateTime <= dateTimeRange.To;
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:18,代码来源:SeriesQueries.cs


示例20: FilterByPatientsBirthDate

        private static Expression<Func<Study, bool>> FilterByPatientsBirthDate(DcmDataset query)
        {
            Expression<Func<Study, bool>> allMatch = p => true;

            var patientQuery = query.GetElement(DicomTags.PatientsBirthDate);

            if (patientQuery == null)
                return allMatch;

            var valueString = patientQuery.GetValueString();

            if (String.IsNullOrWhiteSpace(valueString))
                return allMatch;

            var dateTimeRange = DateTimeRangeQuery.Parse(valueString);

            return s => s.Patient.BirthDateTime >= dateTimeRange.From && s.Patient.BirthDateTime <= dateTimeRange.To;
        }
开发者ID:curasystems,项目名称:dicomserver,代码行数:18,代码来源:StudyQueries.cs



注:本文中的Dicom.Data.DcmDataset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Data.DicomTag类代码示例发布时间:2022-05-24
下一篇:
C# Dicom.DicomTag类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap