从旧文件创建新的DICOM文件,并更改标签-dcm4che3

时间:2018-06-28 07:31:39

标签: java dcm4che

如何使用库dcm4che3更改DICOM文件的标签。

我通过dcm4che2创立了Way,但是我想使用dcm4che3

dcm4che2中:

File file = new File("/path/file.dcm");
DicomInputStream dis = new DicomInputStream(file);
DicomObject dcm = dis.readDicomObject();
DicomOutputStream dos = new DicomOutputStream(file);
dcm.putString(Tag, VR, "value");
dos.writeDicomFile(dcm);

dcm4che3中,我尝试过:

DicomInputStream dicomInputStream = new DicomInputStream(dicomFile);

Attributes attributes = new Attributes();
dicomInputStream.readAttributes(attributes, -1, -1);

DicomOutputStream dicomOutputStream = new DicomOutputStream(dicomFile);
attributes.setValue(TAG, VR, NEW-VALUE);

dicomOutputStream.writeCommand(attributes);

但是我不知道如何将dicomOutputStream转移到新的DICOM文件或覆盖当前的DICOM文件。

0 个答案:

没有答案