本文整理汇总了Java中org.dcm4che2.data.DicomObject.putString方法的典型用法代码示例。如果您正苦于以下问题:Java DicomObject.putString方法的具体用法?Java DicomObject.putString怎么用?Java DicomObject.putString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dcm4che2.data.DicomObject
的用法示例。
在下文中一共展示了DicomObject.putString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recodeImages
import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
/**
* Recodes the images from the source transfer syntax, as read from the src
* file, to the specified destination syntax.
*/
public void recodeImages(File src, File dest) throws IOException {
ImageReader reader = new DicomImageReaderSpi().createReaderInstance();
ImageWriter writer = new DicomImageWriterSpi().createWriterInstance();
FileImageInputStream input = new FileImageInputStream(src);
reader.setInput(input);
if (dest.exists()) {
dest.delete();
}
FileImageOutputStream output = new FileImageOutputStream(dest);
writer.setOutput(output);
DicomStreamMetaData streamMeta = (DicomStreamMetaData) reader.getStreamMetadata();
DicomObject ds = streamMeta.getDicomObject();
DicomStreamMetaData writeMeta = (DicomStreamMetaData) writer.getDefaultStreamMetadata(null);
DicomObject newDs = new BasicDicomObject();
ds.copyTo(newDs);
writeMeta.setDicomObject(newDs);
int frames = ds.getInt(Tag.NumberOfFrames, 1);
LookupTable lut = prepareBitStrip(writeMeta, reader);
newDs.putString(Tag.TransferSyntaxUID, VR.UI, destinationSyntax.uid());
if (overwriteObject != null) {
overwriteObject.copyTo(newDs);
}
writer.prepareWriteSequence(writeMeta);
for (int i = 0; i < frames; i++) {
WritableRaster r = (WritableRaster) reader.readRaster(i, null);
ColorModel cm = ColorModelFactory.createColorModel(ds);
BufferedImage bi = new BufferedImage(cm, r, false, null);
if (lut != null) {
lut.lookup(bi.getRaster(), bi.getRaster());
}
IIOImage iioimage = new IIOImage(bi, null, null);
writer.writeToSequence(iioimage, null);
}
writer.endWriteSequence();
output.close();
input.close();
}
示例2: createDefaultDicom
import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
public static DicomObject createDefaultDicom()
{
DicomObject def = new BasicDicomObject();
// smallest possible dicom object ?
def.putString(Tag.TransferSyntaxUID, VR.UI, DicomTypes.EXPLICIT_VR_LITTLE_ENDIAN);
return def;
}
示例3: testDicomSetGetField
import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
protected void testDicomSetGetField(DicomObject dicom, int tagNr, VR vr, String value) throws IOException
{
dicom.putString(tagNr, vr, value);
DicomElement el = dicom.get(tagNr);
// use DicomWrapper
String tagWrapValue = DicomWrapper.element2String(el, null);
// use DicomElement
String tagDirectValue = dicom.getString(tagNr);
String tagFieldStr = ("#" + tagNr + "'" + DicomUtil.getTagName(tagNr) + "',VR=" + vr);
Assert.assertEquals("Field value (DicomWrapper) doesn't match:" + tagFieldStr, value, tagWrapValue);
Assert.assertEquals("Field value (DicomElement) doesn't match:" + tagFieldStr, value, tagDirectValue);
// Check VR Type against database:
VR configType = DicomTags.getDefault().getVRofTag(tagNr);
// Config meta type 'OX' can match against 'OB' and 'OW'. Dicom Tags themself never have 'OX'.
if (configType == VRType.OX.vr())
{
if ((vr == VRType.OB.vr()) || (vr == VRType.OW.vr()))
{
; // ok
}
else
{
Assert.assertEquals("VR type 'OX' (from tag:" + tagFieldStr + ") configuration doesn't either 'OB' or 'OW'.", vr,
configType);
}
}
else
{
Assert.assertEquals("VR type (from tag:" + tagFieldStr + ") configuration doesn't match used type.", vr, configType);
}
}
示例4: changeFields
import org.dcm4che2.data.DicomObject; //导入方法依赖的package包/类
static void changeFields(DicomObject dcm)
{
System.out.printf("Changing tag:%s\n", Integer.toHexString(Tag.PatientName));
dcm.putString(Tag.PatientName, VR.PN, "newName");
dcm.putString(Tag.PatientID, VR.LO, "newID");
}