Skip to content

Commit

Permalink
Replaced calls of DcmXfer::isEncapsulated().
Browse files Browse the repository at this point in the history
Replaced calls of DcmXfer::isEncapsulated() and isNotEncapsulated()
by the new methods such as hasEncapsulatedFormat(), hasNativeFormat()
and isPixelDataCompressed(), because they are deprecated.

This is another step towards supporting the Encapsulated Uncompressed
Explicit VR Little Endian Transfer Syntax (see DCMTK Conformance #1000).
  • Loading branch information
jriesmeier committed May 25, 2024
1 parent d85d4ae commit 6e24fb9
Show file tree
Hide file tree
Showing 26 changed files with 116 additions and 107 deletions.
4 changes: 2 additions & 2 deletions dcmdata/apps/dcmcrle.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2002-2022, OFFIS e.V.
* Copyright (C) 2002-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -267,7 +267,7 @@ int main(int argc, char *argv[])
}

DcmXfer original_xfer(dataset->getOriginalXfer());
if (original_xfer.isEncapsulated())
if (original_xfer.isPixelDataCompressed())
{
OFLOG_INFO(dcmcrleLogger, "DICOM file is already compressed, converting to uncompressed transfer syntax first");
if (EC_Normal != dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL))
Expand Down
4 changes: 2 additions & 2 deletions dcmdata/apps/dump2dcm.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 1994-2023, OFFIS e.V.
* Copyright (C) 1994-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -1067,7 +1067,7 @@ int main(int argc, char *argv[])
if (fileformat.canWriteXfer(opt_xfer))
{
/* check whether pixel data is compressed */
if ((opt_writeMode == EWM_dataset) && DcmXfer(xfer).isEncapsulated())
if ((opt_writeMode == EWM_dataset) && DcmXfer(xfer).usesEncapsulatedFormat())
{
OFLOG_WARN(dump2dcmLogger, "encapsulated pixel data require file format, ignoring --write-dataset");
opt_writeMode = EWM_fileformat;
Expand Down
6 changes: 3 additions & 3 deletions dcmdata/apps/mdfdsman.cc
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ OFCondition MdfDatasetManager::saveFile(const char* file_name,
/* check whether transfer syntax is possible */
if ((opt_xfer == EXS_Unknown) || (dfile->canWriteXfer(opt_xfer)))
{
/* check whether pixel data is compressed */
if (opt_dataset && DcmXfer(opt_xfer).isEncapsulated())
/* check whether pixel data is encapsulated (e.g. compressed) */
if (opt_dataset && DcmXfer(opt_xfer).usesEncapsulatedFormat())
{
OFLOG_WARN(mdfdsmanLogger, "encapsulated pixel data requires file format, ignoring --write-dataset");
opt_dataset = OFFalse;
Expand Down Expand Up @@ -714,7 +714,7 @@ OFCondition MdfDatasetManager::checkPixelDataInsertion(DcmElement* elem)
const DcmRepresentationParameter* dontCare = NULL;
pix->getCurrentRepresentationKey(ts, dontCare);
DcmXfer xfer(ts);
if (xfer.isEncapsulated())
if (xfer.usesEncapsulatedFormat())
{
OFLOG_ERROR(mdfdsmanLogger, "Cannot replace encapsulated Pixel Data (not implemented)");
return EC_IllegalParameter;
Expand Down
4 changes: 2 additions & 2 deletions dcmdata/apps/xml2dcm.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2003-2022, OFFIS e.V.
* Copyright (C) 2003-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -350,7 +350,7 @@ int main(int argc, char *argv[])
if (fileformat.canWriteXfer(opt_xfer))
{
/* check whether pixel data is compressed */
if ((opt_writeMode == EWM_dataset) && DcmXfer(xfer).isEncapsulated())
if ((opt_writeMode == EWM_dataset) && DcmXfer(xfer).usesEncapsulatedFormat())
{
OFLOG_WARN(xml2dcmLogger, "encapsulated pixel data require file format, ignoring --write-dataset");
opt_writeMode = EWM_fileformat;
Expand Down
6 changes: 3 additions & 3 deletions dcmdata/libi2d/i2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ OFCondition Image2Dcm::readAndInsertPixelDataFirstFrame(
if (m_frameLength > 0) compressionRatio = uncompressedSize / m_frameLength;

DcmXfer transport(outputTS);
if (transport.isEncapsulated())
if (transport.usesEncapsulatedFormat())
{
m_offsetList.clear();
insertEncapsulatedPixelDataFirstFrame(dset, pixData, m_frameLength, outputTS);
Expand Down Expand Up @@ -786,7 +786,7 @@ OFCondition Image2Dcm::readAndInsertPixelDataNextFrame(
cond = makeOFCondition(OFM_dcmdata, 18, OF_error, "Image2Dcm: value of vertical PixelAspectRatio not equal for all frames of the multi-frame image");
return cond;
}
if ((!transport.isEncapsulated()) && (next_frameLength != m_frameLength))
if (transport.isPixelDataUncompressed() && (next_frameLength != m_frameLength))
{
// in the case of uncompressed images, all frames must have exactly the same size.
// for compressed images, where we store the compressed bitstream as a pixel item, this does not matter.
Expand All @@ -804,7 +804,7 @@ OFCondition Image2Dcm::readAndInsertPixelDataNextFrame(
// We will divide this by the number of frames later.
m_compressionRatio += compressionRatio;

if (transport.isEncapsulated())
if (transport.usesEncapsulatedFormat())
{
cond = insertEncapsulatedPixelDataNextFrame(pixData, next_frameLength);
delete[] pixData;
Expand Down
16 changes: 8 additions & 8 deletions dcmdata/libsrc/dcdatset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ OFCondition DcmDataset::chooseRepresentation(const E_TransferSyntax repType,
// check if we are attempting to compress but the image contains
// floating point or double floating point pixel data, which our codecs don't support.
if ((tagExists(DCM_FloatPixelData, OFTrue) || tagExists(DCM_DoubleFloatPixelData, OFTrue)) &&
(fromrep.isEncapsulated() || torep.isEncapsulated()))
(fromrep.isPixelDataCompressed() || torep.isPixelDataCompressed()))
{
DCMDATA_ERROR("DcmDataset: Unable to compress/decompress floating point pixel data, cannot change representation");
l_error = EC_CannotChangeRepresentation;
Expand Down Expand Up @@ -791,11 +791,11 @@ OFCondition DcmDataset::chooseRepresentation(const E_TransferSyntax repType,
// If there are no pixel data elements in the dataset, issue a warning
if (! pixelDataEncountered)
{
if (torep.isEncapsulated() && ! fromrep.isEncapsulated())
if (torep.isPixelDataCompressed() && fromrep.isPixelDataUncompressed())
{
DCMDATA_WARN("DcmDataset: No pixel data present, nothing to compress");
}
if (! torep.isEncapsulated() && fromrep.isEncapsulated())
if (torep.isPixelDataUncompressed() && fromrep.isPixelDataCompressed())
{
DCMDATA_WARN("DcmDataset: No pixel data present, nothing to decompress");
}
Expand Down Expand Up @@ -886,7 +886,7 @@ OFCondition DcmDataset::doPostReadChecks()
if (findAndGetElement(DCM_PixelData, pixData).good())
{
Uint32 valueLength = pixData->getLengthField();
if (xf.isEncapsulated())
if (xf.usesEncapsulatedFormat())
{
if (valueLength != DCM_UndefinedLength)
{
Expand All @@ -897,8 +897,8 @@ OFCondition DcmDataset::doPostReadChecks()
/* encapsulated pixel data (always encoded with undefined */
/* length). Print and return an error. */
DCMDATA_ERROR("Found explicit length Pixel Data in top level "
<< "dataset with transfer syntax " << xf.getXferName()
<< ": Only undefined length permitted");
<< "dataset with transfer syntax " << xf.getXferName()
<< ": Only undefined length permitted");
result = EC_PixelDataExplLengthIllegal;
}
else
Expand All @@ -907,8 +907,8 @@ OFCondition DcmDataset::doPostReadChecks()
/* and behave like as we have the same case as for an */
/* icon image, which is always uncompressed (see above). */
DCMDATA_WARN("Found explicit length Pixel Data in top level "
<< "dataset with transfer syntax " << xf.getXferName()
<< ": Only undefined length permitted (ignored on explicit request)");
<< "dataset with transfer syntax " << xf.getXferName()
<< ": Only undefined length permitted (ignored on explicit request)");
}
}
}
Expand Down
Loading

0 comments on commit 6e24fb9

Please sign in to comment.