使用DCM4CHE修改DICOM-tag参数

因客户有个检查图像包含两个部位 需在看图工具的两个tab页查看,看图工具根据dicom的uid进行分页,所以需修改其中的一个部位的uid:
方法代码:
dcm4che版本:5.16.3
参数:文件路径

import org.dcm4che3.data.Attributes; 
import org.dcm4che3.data.Tag;
import org.dcm4che3.data.VR;
import org.dcm4che3.io.DicomInputStream;
import org.dcm4che3.io.DicomOutputStream;

 public static void DicomSet(String filePath) throws IOException {
        DicomInputStream in = null;
        Attributes attr = null;
        in =new

        DicomInputStream(new File(filePath));
        attr =in.readDataset(-1,-1);
        //attr.setString(int tag,VR vr,String s)
        //attr.setString(Tag.你要改动的tag,VR值类型-建议用dicom阅览器找对应tag比较不容易弄错,String-你要修改的值)

        attr.setString(Tag.StudyInstanceUID,VR.SH,"1.2.276.0.7230010.3.1.2.2510383562.5660.1679039928.1138");

        DicomOutputStream dout = null;
        dout =new

        DicomOutputStream(new File(filePath));
        //Attribute写入,完成更改
        dout.writeDataset(in.getFileMetaInformation(),attr);
        //老老实实挨个关掉清理
        dout.finish();
        dout.flush();
        dout.close();
        in.close();
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值