当前位置: 首页>>代码示例>>Java>>正文


Java DicomElement.tag方法代码示例

本文整理汇总了Java中org.dcm4che2.data.DicomElement.tag方法的典型用法代码示例。如果您正苦于以下问题:Java DicomElement.tag方法的具体用法?Java DicomElement.tag怎么用?Java DicomElement.tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.dcm4che2.data.DicomElement的用法示例。


在下文中一共展示了DicomElement.tag方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
@Override
public boolean matches(DicomElement el)
{
    if (el == null)
    {
        return false; // unless the value should/must be null/empty
                      // string,etc.
    }

    if (el.tag() != tagNr)
        return false;

    String valStr = DicomWrapper.element2String(el, null);
    int result = StringUtil.compare(valStr, theValue, ignoreCase);
    logger.debugPrintf("MinMaxFilter:Checking: <%s>('%s'=='%s') == %d \n",
            DicomUtil.getTagName(tagNr), valStr, theValue, result);

    return (result == 0);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:20,代码来源:DicomTagFilters.java

示例2: setDateTo01jan1900

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void setDateTo01jan1900(DicomElement el, boolean skipIfNotSet) throws Exception
{
    int tagNr = el.tag();
    Date date = DicomWrapper.element2Date(el);

    if (date == null)
    {
        if (skipIfNotSet)
            return;

        date = Presentation.now();

        // already anonimized: field is null!
        logger.warnPrintf("setDateTo01jan1900(): Date is already NULL (element=%s)\n", el.toString());
    }

    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date);
    int year = 1900;
    int month = Calendar.JANUARY; // cal.get(Calendar.Calendar.MONTH);
    int day = 1; // cal.get(Calendar.DAY_OF_MONTH);
    cal.set(year, month, day);
    date = cal.getTime();
    dicom.setDateValue(tagNr, date);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:26,代码来源:DicomProcessor.java

示例3: setDateTo01jan1950

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void setDateTo01jan1950(DicomElement el, boolean skipIfNotSet) throws Exception
{
    int tagNr = el.tag();
    Date date = DicomWrapper.element2Date(el);

    if (date == null)
    {
        if (skipIfNotSet)
            return;

        date = Presentation.now();

        // already anonimized: field is null!
        logger.warnPrintf("setDateTo01jan1950():Date is already NULL (element=%s)\n", el.toString());
        return;
    }
    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date);
    int year = 1950;
    int month = Calendar.JANUARY; // cal.get(Calendar.Calendar.MONTH);
    int day = 1; // cal.get(Calendar.DAY_OF_MONTH);
    cal.set(year, month, day);
    date = cal.getTime();
    dicom.setDateValue(tagNr, date);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:26,代码来源:DicomProcessor.java

示例4: setDateTo01Jan

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void setDateTo01Jan(DicomElement el, boolean skipIfNotSet) throws Exception
{
    int tagNr = el.tag();
    Date date = DicomWrapper.element2Date(el);

    if (date == null)
    {
        if (skipIfNotSet)
            return;

        date = Presentation.now();

        // already anonimized: field is null!
        logger.warnPrintf("setDateTo01Jan():Date is already NULL (element=%s)\n", el.toString());
    }

    GregorianCalendar cal = new GregorianCalendar();
    cal.setTime(date);
    int year = cal.get(Calendar.YEAR);
    int month = Calendar.JANUARY;// Note January is Month 0!
    // month=cal.get(Calendar.Calendar.MONTH);
    int day = 1; // cal.get(Calendar.DAY_OF_MONTH);
    cal.set(year, month, day);
    date = cal.getTime();
    dicom.setDateValue(tagNr, date);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:27,代码来源:DicomProcessor.java

示例5: doEncryptTag

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void doEncryptTag(DicomElement el) throws Exception
{
    int tagNr = el.tag();
    VRType vrType = VRType.valueOf(el.vr());

    if (vrType.isString())
    {
        String newValue = null;
        String strValue = DicomWrapper.element2String(el, null);
        newValue = crypter.encryptToBase64(strValue);
        dicom.setTag(tagNr, newValue);
        logger.debugPrintf("> CRYPT RESULT:%s\n", dicom.getElement(tagNr));
    }
    // else if (vrType.isBinary()) {} // could encrypt bytes here.
    else
    {
        // number values could be encrypted and stored as encrypted
        // numerical value;
        throw new Exception("Cannot encrypt non String tags!:" + el);
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:22,代码来源:DicomProcessor.java

示例6: hashUIDTag

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
/**
 * Hash the UID and convert the hash bytes back to an UID like (dotted decimal) String.
 */
protected void hashUIDTag(DicomElement el) throws Exception
{
    int tagNr = el.tag();
    VRType vrType = VRType.valueOf(el.vr());

    if (vrType.isString())
    {
        String uid = DicomWrapper.element2String(el, null);
        // 32 bytes hash (SHA-256 = 256 bits)
        byte hashBytes[] = hash(uid);
        String hashedUid = hashToUidString(hashBytes);

        dicom.setTag(tagNr, hashedUid);
        logger.debugPrintf("> HASH UID RESULT:%s\n", dicom.getElement(tagNr));
    }
    else
        throw new Exception("Cannot hash non String tags (yet) !:" + el);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:22,代码来源:DicomProcessor.java

示例7: doEncryptAndHashUIDTag

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void doEncryptAndHashUIDTag(DicomElement el) throws Exception
{
    int tagNr = el.tag();
    VRType vrType = VRType.valueOf(el.vr());

    if (vrType.isString())
    {
        byte cryptBytes[] = null;
        String strValue = DicomWrapper.element2String(el, null);

        // first encrypt, then hash, then UID encode.
        cryptBytes = crypter.encrypt(strValue);
        byte hashBytes[] = hash(cryptBytes);
        String hashedUid = hashToUidString(hashBytes);

        dicom.setTag(tagNr, hashedUid);
        logger.debugPrintf("> CRYPT&HASH UID RESULT:%s\n", dicom.getElement(tagNr));
    }
    // else if (vrType.isBinary()) {} // could encrypt bytes here.
    else
    {
        // number values could be encrypted and stored as encrypted
        // numerical value;
        throw new Exception("Cannot encrypt non String tags!:" + el);
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:27,代码来源:DicomProcessor.java

示例8: listHeader

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
public Boolean listHeader(DicomObject object, String tagGE, Object valueToFind) {
Boolean found =false;
String tagValue="";
   Iterator iter = object.datasetIterator();
   if(tagGE.length()!=0){
   tagGE = "("+tagGE+")";
   }
   while(iter.hasNext()) {
      DicomElement element = (DicomElement) iter.next();

      int tag = element.tag();
      
      try {
 
         String tagAddr = TagUtils.toString(tag);
  
        	if(!tagAddr.contains(tagGE)){
        		
        	}

         tagValue = object.getString(tag);
         
        	 String valueToFinding = (String) valueToFind;
         
        	 if(tagAddr.equals(tagGE) && tagValue.equals(valueToFinding)){
             found=true;
   
         }
      }catch (Exception e) {
    	  	continue;
 } 
      
   } 
   return found;
}
 
开发者ID:NCIP,项目名称:national-biomedical-image-archive,代码行数:36,代码来源:FindDicomFiles.java

示例9: setTimeToZero

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void setTimeToZero(DicomElement el, boolean skipIfNotSet) throws Exception
{
    int tagNr = el.tag();
    Date date = DicomWrapper.element2Date(el);

    if (date == null)
    {
        if (skipIfNotSet)
            return;

        date = Presentation.now();

        // already anonimized: field is null!
        logger.warnPrintf("setTimeToZero():Date is already NULL (zero bytes:element='%s')\n", el.toString());
        return;
    }

    GregorianCalendar cal = new GregorianCalendar();
    // cal.setTime(date);// clean date; s
    int hours = 0;
    int min = 0;
    int secs = 0;
    // int frac=0;

    int year = 1900;
    int month = Calendar.JANUARY; // cal.get(Calendar.Calendar.MONTH);
    int day = 1; // cal.get(Calendar.DAY_OF_MONTH);
    cal.set(year, month, day, hours, min, secs);
    date = cal.getTime();
    dicom.setDateValue(tagNr, date);
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:32,代码来源:DicomProcessor.java

示例10: hashTag

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
/**
 * Hashes String value to base64 encoded hash
 */
protected void hashTag(DicomElement el) throws Exception
{
    int tagNr = el.tag();
    VRType vrType = VRType.valueOf(el.vr());

    if (vrType.isString())
    {
        String strVal = DicomWrapper.element2String(el, null);

        String hashStr = null;

        if (strVal == null)
        {
            logger.warnPrintf("hashTag(): Tag Value is NULL:%s\n", DicomUtil.getTagName(el.tag()));
            hashStr = null;// Element has been cleared already, keep null
                           // value.
        }
        else
        {
            // Note: Using base64 encoding increases String size by 33% (6
            // i.s.o 8 bits/byte)
            // 256 bits hash is 32 bytes -> +/48 bytes.
            hashStr = hashToBase64(strVal);
        }

        dicom.setTag(tagNr, hashStr);
        logger.debugPrintf("> HASH RESULT:%s\n", dicom.getElement(tagNr));
    }
    else
        throw new Exception("Cannot hash non String tags (yet) !:" + el);

}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:36,代码来源:DicomProcessor.java

示例11: doHashEncryptTag

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
protected void doHashEncryptTag(DicomElement el) throws Exception
{
    int tagNr = el.tag();
    VRType vrType = VRType.valueOf(el.vr());

    if (vrType.isString())
    {
        byte cryptBytes[] = null;
        String strValue = DicomWrapper.element2String(el, null);
        if (strValue == null)
        {
            logger.warnPrintf("> CRYPT&HASH Stage (I) : Ignoring NULL Value for:%s\n", el);
        }
        else
        {
            // first encrypt: increases byte size!
            cryptBytes = crypter.encrypt(strValue);
            logger.debugPrintf("> CRYPT&HASH Stage (I) :%s\n", StringUtil.toHexString(cryptBytes));
            // hash encrypted result and store as base64 string.

            byte cryptHashBytes[] = hasher.hash(cryptBytes, true, this.getHashSalt(), procOptions.prefixHashSalt);
            String cryptHashStr = StringUtil.base64Encode(cryptHashBytes);

            dicom.setTag(tagNr, cryptHashStr);
            logger.debugPrintf("> CRYPT&HASH Stage (IIa):%s\n", StringUtil.toHexString(cryptBytes));
            logger.debugPrintf("> CRYPT&HASH Stage (IIb):%s\n", dicom.getElement(tagNr));
        }
    }
    // else if (vrType.isBinary()) {} // could encrypt bytes here.
    else
    {
        // number values could be encrypted and stored as encrypted
        // numerical value;
        throw new Exception("Cannot encrypt non String tags!:" + el);
    }
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:37,代码来源:DicomProcessor.java

示例12: visit

import org.dcm4che2.data.DicomElement; //导入方法依赖的package包/类
@Override
public boolean visit(DicomElement dicomEl)
{
    int tagNr = dicomEl.tag();

    TagProcessingOption opt = tagOptions.getOption(tagNr, TagProcessingOption.DELETE);
    logger.debugPrintf("> Option: %s on %s (%s/'%s')\n", opt, dicomEl, DicomUtil.getTagName(tagNr), tagOptions.getTagDescription(tagNr));

    try
    {
        switch (opt)
        {
            case KEEP:
                // nothing.
                break;
            case DELETE:
            {
                doDeleteTag(dicomEl);
                break;
            }
            case CLEAR:
            {
                doClearTag(dicomEl);
                break;
            }
            case HASH:
            {
                hashTag(dicomEl);
                break;
            }
            case HASH_UID:
            {
                hashUIDTag(dicomEl);
                break;
            }
            case ENCRYPT:
            {
                doEncryptTag(dicomEl);
                break;
            }
            case ENCRYPT_HASH:
            {
                doHashEncryptTag(dicomEl);
                break;
            }
            case ENCRYPT_HASH_UID:
            {
                doEncryptAndHashUIDTag(dicomEl);
                break;
            }

            case SET_DATE_TO_01JAN:
            {
                setDateTo01Jan(dicomEl, true);
                break;
            }
            case SET_DATE_TO_01JAN1900:
            {
                setDateTo01jan1900(dicomEl, true);
                break;
            }
            case SET_TIME_TO_0000HOURS:
            {
                setTimeToZero(dicomEl, true);
                break;
            }
            default:
            {
                logger.errorPrintf("Unknown Tag Option:%s", opt);
                break;
            }
        }
    }
    catch (Exception e)
    {
        logger.logException(ClassLogger.ERROR, this, e, "Exception:%s\n", e);
    }

    return true;
}
 
开发者ID:NLeSC,项目名称:escxnat,代码行数:81,代码来源:DicomProcessor.java


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