private string GetStringTagValue(MElementList elmlist, tag_t tag)
        {
            var strValue = string.Empty;

            try
            {
                using (MElementRef eref = elmlist.get_Element(tag))
                {
                    if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                    {
                        strValue = eref.get_string(0);
                    }
                    else
                    {
                        strValue = "";
                    }
                    return(strValue);
                }
            }
            catch (Exception e)
            {
                _logger.Error("DicomHeader.GetStringTagValue(): " + "get string for tag " + tag.ToString() + " pop up an exception--" + e.Message + ".");
                return(strValue);
            }
        }
        private string GetDateTimeTagValue(MElementList elmlist, tag_t tag)
        {
            var strValue = string.Empty;
            var strRet   = string.Empty;

            try
            {
                using (MElementRef eref = elmlist.get_Element(tag))
                {
                    if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                    {
                        strValue = eref.get_string(0);
                    }
                    if (!string.IsNullOrEmpty((strValue)))
                    {
                        strRet = System.DateTime.ParseExact(strValue, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture).ToString("yyyy-MM-dd");
                    }
                    return(strRet);
                }
            }
            catch (Exception e)
            {
                _logger.Error("DCMHeader.GetDateTimeTagValue(): " + "get datetime for tag " + tag.ToString() + " pop up an exception--" + e.Message + ".");
                strRet = System.DateTime.ParseExact(strValue, "yyyy.MM.dd", System.Globalization.CultureInfo.CurrentCulture).ToString("yyyy-MM-dd");
                return(strRet);
            }
        }
        /// <summary>
        /// For some tag with local language, e.g PatientName
        /// ISO_IR 192: use UTF8 encoding local string
        /// ISO_IR 100: use GB2312 encoding local string
        /// </summary>
        /// <param name="strValue"></param>
        /// <param name="elmlist"></param>
        /// <param name="tag"></param>
        private string GetLocalStringTagValue(MElementList elmlist, tag_t tag)
        {
            var strValue = string.Empty;

            try
            {
                String str_speccharacter = "";
                using (MElementRef intereref = elmlist.get_Element(tag_t.kSpecificCharacterSet))
                {
                    if (intereref != null && intereref.value_count != 0 && intereref.value_count != -1)
                    {
                        str_speccharacter = intereref.get_string(0);
                    }
                    else
                    {
                        str_speccharacter = "";
                    }
                }
                using (MElementRef eref = elmlist.get_Element(tag))
                {
                    Byte[] byte_patName = null;
                    if (str_speccharacter.Trim() == "ISO_IR 192")
                    {
                        if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                        {
                            byte_patName = eref.get_blob(0);
                        }
                        strValue = Encoding.UTF8.GetString(byte_patName);
                    }
                    else if (str_speccharacter.Trim() == "ISO_IR 100")
                    {
                        if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                        {
                            byte_patName = eref.get_blob(0);
                        }
                        strValue = Encoding.GetEncoding("GB2312").GetString(byte_patName);
                    }
                    else
                    {
                        if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                        {
                            strValue = eref.get_string(0);
                        }
                        else
                        {
                            strValue = " ";
                        }
                    }
                    return(strValue);
                }
            }
            catch (Exception e)
            {
                _logger.Error("DCMHeader.GetStringTagValue(): " + "get string for tag " + tag.ToString() + " pop up an exception--" + e.Message + ".");
                return(strValue);
            }
        }
Exemple #4
0
        public static int GetTag(string name)
        {
            if (name == null || name.Length < 1)
            {
                return(0);
            }
            tag_t t = (tag_t)Enum.Parse(typeof(tag_t), name);

            return((int)t);
        }
Exemple #5
0
        static unsafe void norx_absorb_block(norx_state_t *state, byte * @in, tag_t tag)
        {
            ulong        i;
            norx_word_t *S = state->S;

            S[15] ^= (norx_word_t)tag;
            norx_permute(state);

            for (i = 0; i < (((((32 * 16) - (32 * 4))) + (32 - 1)) / 32); ++i)
            {
                S[i] ^= load32(@in + i * (((32) + 7) / 8));
            }
        }
        private string GetUIDTagValue(MElementList elmlist, tag_t tag)
        {
            var strUID = string.Empty;

            using (MElementRef eref = elmlist.get_Element(tag))
            {
                if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                {
                    strUID = eref.get_uid(0);
                }
                return(strUID);
            }
        }
Exemple #7
0
 private void GetUIDTagValue(ref string strUID, MElementList elmlist, tag_t tag)
 {
     using (MElementRef eref = elmlist.get_Element(tag))
     {
         if (eref != null && eref.value_count != 0 && eref.value_count != -1)
         {
             strUID = eref.get_uid(0);
         }
         else
         {
             strUID = "";
         }
     }
 }
        private int GetIntTagValue(MElementList elmlist, tag_t tag)
        {
            var nValue = 0;

            try
            {
                using (MElementRef eref = elmlist.get_Element(tag))
                {
                    if (eref != null && eref.value_count != 0 && eref.value_count != -1)
                    {
                        nValue = eref.get_sint(0);
                    }
                    return(nValue);
                }
            }
            catch (Exception e)
            {
                _logger.Error("DCMHeader.GetIntTagValue(): " + "get int for tag " + tag.ToString() + " pop up an exception--" + e.Message + ".");
                return(nValue);
            }
        }
Exemple #9
0
 private void GetDateTimeTagValue(ref string strValue, MElementList elmlist, tag_t tag)
 {
     try
     {
         using (MElementRef eref = elmlist.get_Element(tag))
         {
             if (eref != null && eref.value_count != 0 && eref.value_count != -1)
             {
                 strValue = eref.get_string(0);
             }
             else
             {
                 strValue = " ";
             }
         }
     }
     catch (Exception e)
     {
         strValue = " ";
         _logger.Error("DCMHeader.GetDateTimeTagValue(): " + "get datetime for tag " + tag.ToString() + " pop up an exception--" + e.Message + ".");
     }
 }
Exemple #10
0
        static unsafe void norx_absorb_data(norx_state_t *state, byte * @in, ulong inlen, tag_t tag)
        {
            if (inlen > 0)
            {
                while (inlen >= (((((32 * 16) - (32 * 4))) + 7) / 8))
                {
                    norx_absorb_block(state, @in, tag);



                    inlen -= (((((32 * 16) - (32 * 4))) + 7) / 8);
                    @in   += (((((32 * 16) - (32 * 4))) + 7) / 8);
                }
                norx_absorb_lastblock(state, @in, inlen, tag);
            }
        }
Exemple #11
0
        static unsafe void norx_absorb_lastblock(norx_state_t *state, byte * @in, ulong inlen, tag_t tag)
        {
            byte *lastblock = stackalloc byte[(((((32 * 16) - (32 * 4))) + 7) / 8)];

            norx_pad(lastblock, @in, inlen);
            norx_absorb_block(state, lastblock, tag);
        }