Exemple #1
0
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML containing the medical image study series.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            if (_acquisitionDateTime == null)
            {
                _acquisitionDateTime = new HealthServiceDateTime();
            }

            _acquisitionDateTime.ParseXml(navigator.SelectSingleNode("acquisition-datetime"));

            _description = XPathHelper.GetOptNavValue(navigator, "description");

            _images.Clear();

            XPathNodeIterator imageIterator = navigator.Select("images");

            foreach (XPathNavigator imageNav in imageIterator)
            {
                MedicalImageStudySeriesImage image = new MedicalImageStudySeriesImage();
                image.ParseXml(imageNav);
                _images.Add(image);
            }

            _institutionName    = XPathHelper.GetOptNavValue <Organization>(navigator, "institution-name");
            _referringPhysician = XPathHelper.GetOptNavValue <PersonItem>(navigator, "referring-physician");
            _modality           = XPathHelper.GetOptNavValue <CodableValue>(navigator, "modality");
            _bodyPart           = XPathHelper.GetOptNavValue <CodableValue>(navigator, "body-part");
            _previewBlobName    = XPathHelper.GetOptNavValue(navigator, "preview-blob-name");
            _seriesInstanceUID  = XPathHelper.GetOptNavValue(navigator, "series-instance-uid");
        }
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the medical image study data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a medical image study node.
        /// </exception>
        ///
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            Validator.ThrowIfArgumentNull(typeSpecificXml, nameof(typeSpecificXml), Resources.ParseXmlNavNull);

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("medical-image-study");

            Validator.ThrowInvalidIfNull(itemNav, Resources.MedicalImageStudyUnexpectedNode);

            if (_when == null)
            {
                _when = new HealthServiceDateTime();
            }

            _when.ParseXml(itemNav.SelectSingleNode("when"));
            _patientName = XPathHelper.GetOptNavValue(itemNav, "patient-name");
            _description = XPathHelper.GetOptNavValue(itemNav, "description");

            _series.Clear();
            foreach (XPathNavigator imageStudySeriesNav in itemNav.Select("series"))
            {
                MedicalImageStudySeriesV2 imageStudySeries = new MedicalImageStudySeriesV2();
                imageStudySeries.ParseXml(imageStudySeriesNav);
                _series.Add(imageStudySeries);
            }

            _reason          = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "reason");
            _previewBlobName = XPathHelper.GetOptNavValue(itemNav, "preview-blob-name");

            _keyImages.Clear();
            foreach (XPathNavigator imageNav in itemNav.Select("key-images"))
            {
                MedicalImageStudySeriesImage image = new MedicalImageStudySeriesImage();
                image.ParseXml(imageNav);
                _keyImages.Add(image);
            }

            _studyInstanceUID   = XPathHelper.GetOptNavValue(itemNav, "study-instance-uid");
            _referringPhysician = XPathHelper.GetOptNavValue <PersonItem>(itemNav, "referring-physician");
            _accessionNumber    = XPathHelper.GetOptNavValue(itemNav, "accession-number");
        }