I'm trying to implement on the fly (de)compression with the following code framework:
Code: Select all
DcmSCU scu;
...
if (fileformat.loadFile(sLocation, EXS_Unknown, EGL_recalcGL, DCM_MaxReadLength, ERM_fileOnly).good())
{
...
if (fileformat.getDataset()->chooseRepresentation(EXS_LittleEndianImplicit, NULL).bad() && fileformat.getDataset()->canWriteXfer(EXS_LittleEndianImplicit))
{
BOOST_LOG_SEV(lg, error) << "Conversion failed.";
}
else
{
BOOST_LOG_SEV(lg, info) << "Conversion succeeded.";
}
...
DcmDataset* ds = fileformat.getDataset();
result = scu.sendSTORERequest(0, NULL, ds, rspStatusCode);
If I delete 'if (fileformat.getDataset()->chooseRepresentation(EXS_LittleEndianImplicit, NULL).bad() && fileformat.getDataset()->canWriteXfer(EXS_LittleEndianImplicit))' and recompile, the object is sent over correctly.2022-08-07 09:31:05.588 DEBUG: ===================== OUTGOING DIMSE MESSAGE ====================
2022-08-07 09:31:05.588 DEBUG: Message Type : C-STORE RQ
2022-08-07 09:31:05.588 DEBUG: Presentation Context ID : 3
2022-08-07 09:31:05.588 DEBUG: Message ID : 2
2022-08-07 09:31:05.588 DEBUG: Affected SOP Class UID : CTImageStorage
2022-08-07 09:31:05.588 DEBUG: Affected SOP Instance UID : 1.2.752.37.1.1.157718784.20101210.6.6407
2022-08-07 09:31:05.588 DEBUG: Data Set : present
2022-08-07 09:31:05.588 DEBUG: Priority : medium
2022-08-07 09:31:05.588 DEBUG: ======================= END DIMSE MESSAGE =======================
2022-08-07 09:31:05.588 WARN: DIMSE Warning: (SCU,STORESCP): sendMessage: unable to convert dataset from 'JPEG Lossless, Non-hierarchical, 1st Order Prediction' transfer syntax to 'JPEG Lossless, Non-hierarchical, 1st Order Prediction'
2022-08-07 09:31:05.588 ERROR: Failed sending C-STORE request: 0006:020e DIMSE Failed to send message
2022-08-07 09:31:05.592 DEBUG: DcmMetaInfo::checkAndReadPreamble() TransferSyntax="Little Endian Explicit"
2022-08-07 09:31:05.592 DEBUG: DcmDataset::read() TransferSyntax="JPEG Lossless, Non-hierarchical, 1st Order Prediction"
2022-08-07 09:31:05.593 DEBUG: Start of Image
2022-08-07 09:31:05.593 DEBUG: Start Of Frame 0xc3: width=512, height=512, components=1
2022-08-07 09:31:05.593 DEBUG: Component 0: 1hx1v q=0
2022-08-07 09:31:05.593 DEBUG: Miscellaneous marker 0xfe, length 14
2022-08-07 09:31:05.593 DEBUG: Define Huffman Table 0x00
2022-08-07 09:31:05.593 DEBUG: Start Of Scan: 1 components
2022-08-07 09:31:05.593 DEBUG: Component 0: dc=0 ac=0
2022-08-07 09:31:05.593 DEBUG: Ss=1, Se=0, Ah=0, Al=0
2022-08-07 09:31:05.597 DEBUG: End Of Image
Am I missing something?
Thanks!