Beispiel #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");
        }