J. Riesmeier wrote:Where do you define "dataset"? Its value should be the pointer returned by dcmff.getDataset().
Btw, the color space conversion flags are also available to dcmj2pnm ...
Code: Select all
color space conversion (compressed images only): +cp --conv-photometric convert if YCbCr photometric interpretation (default) +cl --conv-lossy convert YCbCr to RGB if lossy JPEG +cg --conv-guess convert to RGB if YCbCr is guessed by library +cgl --conv-guess-lossy convert to RGB if lossy JPEG and YCbCr is guessed by the underlying JPEG library +ca --conv-always always convert YCbCr to RGB +cn --conv-never never convert color space
This is my code to convert jpeg to dicom and where i get the dataset:
Image2Dcm i2d;
I2DOutputPlug *outPlug = new I2DOutputPlugSC();
I2DImgSource *inputPlug = new I2DJpegSource();
E_TransferSyntax writeXfer;
inputPlug->setImageFile(jpgFile);
DcmDataset *dataset = NULL;
OFCondition result = i2d.convert(inputPlug, outPlug, dataset, writeXfer);
// Saving output DICOM image
if (result.good())
{
dataset->putAndInsertString(DCM_PhotometricInterpretation,"RGB");
DcmFileFormat dcmff(dataset);
result = dcmff.saveFile(dcmFile, writeXfer);
}
//then the decompression code here