示例#1
0
        private string GetVR(UInt16 theGroupNumber, UInt16 theElementNumber, string theTag, PrivateCodeDictionary thePrivateCodeDictionary, VREncodingMode theTagVREncodingMode)
        {
            // For Tag 'Item (FFFE,E000)' return "Delimination"
            if (theTag.Equals("(FFFE,E000)"))
            {
                return("DL");
            }

            // For Tag 'Item Delimitation Item (FFFE,E00D)' return "Delimination"
            if (theTag.Equals("(FFFE,E00D)"))
            {
                return("DL");
            }

            // For Tag 'Sequence Delimitation Item (FFFE,E0DD)' return "Delimination"
            if (theTag.Equals("(FFFE,E0DD)"))
            {
                return("DL");
            }

            if (theTagVREncodingMode == VREncodingMode.ExplicitVR)
            {
                // Explicit VR Encoding (value representation type is contained in stream)
                // =======================================================================
                byte b4 = mBinaryReader.ReadByte();
                byte b5 = mBinaryReader.ReadByte();

                return(string.Format("{0}{1}", (char)b4, (char)b5));
            }
            else
            {
                // Implicit VR Encoding (value representation type must be retrieved from dictionary)
                // ==================================================================================

                // For Tag 'Private Creator Code' return "Long String"
                if ((theGroupNumber % 2) == 1 && (theElementNumber <= 0xFF))
                {
                    return("LO");
                }

                // For 'Even Group Number' and 'Implicit VR Encoding', VR information has to come from public dictionary
                if ((theGroupNumber % 2) == 0)
                {
                    return(PublicDICOMDictionary.GetVR(theTag));
                }

                // For 'Odd Group Number' and 'Implicit VR Encoding', VR information has to come from private dictionary
                if ((theGroupNumber % 2) == 1)
                {
                    return(thePrivateCodeDictionary.GetVR(theTag));
                }
            }

            // Should never be reached...
            return("UN");
        }
示例#2
0
        private string GetTagName(UInt16 theGroupNumber, UInt16 theElementNumber, string theTag, PrivateCodeDictionary thePrivateCodeDictionary)
        {
            // Tag 'Item (FFFE,E000)'
            if (theTag.Equals("(FFFE,E000)"))
            {
                return("Item");
            }

            // Tag 'Item Delimitation Item (FFFE,E00D)'
            if (theTag.Equals("(FFFE,E00D)"))
            {
                return("Item Delimitation Item");
            }

            // Tag 'Sequence Delimitation Item (FFFE,E0DD)'
            if (theTag.Equals("(FFFE,E0DD)"))
            {
                return("Sequence Delimitation Item");
            }

            // For 'Even Group Number', DICOM attribute name has to come from public dictionary
            if ((theGroupNumber % 2) == 0)
            {
                return(PublicDICOMDictionary.GetTagName(theTag));
            }

            // For Tag 'Private Creator Code' return "Private Creator"
            if ((theGroupNumber % 2) == 1 && (theElementNumber <= 0xFF))
            {
                return("Private Creator");
            }

            // For 'Odd Group Number', DICOM attribute name has to come from private dictionary
            if ((theGroupNumber % 2) == 1)
            {
                return(thePrivateCodeDictionary.GetTagName(theTag));
            }

            // Should never be reached...
            return("???");
        }