}
public void transcode(File src, File dest) throws IOException {
Attributes fmi;
Attributes dataset;
DicomInputStream dis = new DicomInputStream(src);
try {
dis.setIncludeBulkData(IncludeBulkData.URI);
fmi = dis.readFileMetaInformation();
dataset = dis.readDataset(-1, -1);
} finally {
dis.close();
}
Object pixeldata = dataset.getValue(Tag.PixelData);
Compressor compressor = null;
DicomOutputStream dos = null;
try {
String tsuid = this.tsuid;
if (pixeldata != null) {
if (tstype.isPixeldataEncapsulated()) {
tsuid = adjustTransferSyntax(tsuid,
dataset.getInt(Tag.BitsStored, 8));
compressor = new Compressor(dataset, dis.getTransferSyntax());
compressor.compress(tsuid,
params.toArray(new Property[params.size()]));
} else if (pixeldata instanceof Fragments)
Decompressor.decompress(dataset, dis.getTransferSyntax());
}
if (nofmi)
fmi = null;
else if (retainfmi && fmi != null)
fmi.setString(Tag.TransferSyntaxUID, VR.UI, tsuid);