-
-/**
- * \brief Internal function that checks whether the Transfer Syntax given
- * as argument is the one present in the current document.
- * @param syntaxToCheck The transfert syntax we need to check against.
- * @return True when SyntaxToCheck corresponds to the Transfer Syntax of
- * the current document. False either when the document contains
- * no Transfer Syntax, or when the Tranfer Syntaxes doesn't match.
- */
-bool gdcmDocument::IsGivenTransferSyntax(std::string const & syntaxToCheck)
-{
- gdcmDocEntry *entry = GetDocEntryByNumber(0x0002, 0x0010);
- if ( !entry )
- {
- return false;
- }
-
- // The entry might be present but not loaded (parsing and loading
- // happen at different stages): try loading and proceed with check...
- LoadDocEntrySafe(entry);
- if (gdcmValEntry* valEntry = dynamic_cast< gdcmValEntry* >(entry) )
- {
- std::string transfer = valEntry->GetValue();
- // The actual transfer (as read from disk) might be padded. We
- // first need to remove the potential padding. We can make the
- // weak assumption that padding was not executed with digits...
- if ( transfer.length() == 0 ) { // for brain damaged headers
- return false;
- }
- while ( ! isdigit(transfer[transfer.length()-1]) )
- {
- transfer.erase(transfer.length()-1, 1);
- }
- if ( transfer == syntaxToCheck )
- {
- return true;
- }
- }
- return false;
-}
-
-/**
- * \brief Determines if the Transfer Syntax of the present document
- * corresponds to a Implicit Value Representation of
- * Little Endian.
- * \sa \ref gdcmDocument::IsGivenTransferSyntax.
- * @return True when ImplicitVRLittleEndian found. False in all other cases.
- */
-bool gdcmDocument::IsImplicitVRLittleEndianTransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a ExplicitVRLittleEndian one.
- * @return True when ExplicitVRLittleEndian found. False in all other cases.
- */
-bool gdcmDocument::IsExplicitVRLittleEndianTransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a DeflatedExplicitVRLittleEndian one.
- * @return True when DeflatedExplicitVRLittleEndian found. False in all other cases.
- */
-bool gdcmDocument::IsDeflatedExplicitVRLittleEndianTransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1_99);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a Explicit VR Big Endian one.
- * @return True when big endian found. False in all other cases.
- */
-bool gdcmDocument::IsExplicitVRBigEndianTransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_2);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a JPEGBaseLineProcess1 one.
- * @return True when JPEGBaseLineProcess1found. False in all other cases.
- */
-bool gdcmDocument::IsJPEGBaseLineProcess1TransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_50);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a JPEGExtendedProcess2-4 one.
- * @return True when JPEGExtendedProcess2-4 found. False in all other cases.
- */
-bool gdcmDocument::IsJPEGExtendedProcess2_4TransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_51);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a JPEGExtendeProcess3-5 one.
- * @return True when JPEGExtendedProcess3-5 found. False in all other cases.
- */
-bool gdcmDocument::IsJPEGExtendedProcess3_5TransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_52);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a JPEGSpectralSelectionProcess6-8 one.
- * @return True when JPEGSpectralSelectionProcess6-8 found. False in all
- * other cases.
- */
-bool gdcmDocument::IsJPEGSpectralSelectionProcess6_8TransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_53);
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a RLE Lossless one.
- * @return True when RLE Lossless found. False in all
- * other cases.
- */
-bool gdcmDocument::IsRLELossLessTransferSyntax()
-{
- return IsGivenTransferSyntax(UI1_2_840_10008_1_2_5);
-}
-
-/**
- * \brief Determines if Transfer Syntax was already encountered
- * and if it corresponds to a JPEG Lossless one.
- * @return True when RLE Lossless found. False in all
- * other cases.
- */
-
-bool gdcmDocument::IsJPEGLossless()
-{
- return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_55)
- || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_57)
- || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_70) );
-}
-
-/**
- * \brief Determines if the Transfer Syntax was already encountered
- * and if it corresponds to a JPEG2000 one
- * @return True when JPEG2000 (Lossly or LossLess) found. False in all
- * other cases.
- */
-bool gdcmDocument::IsJPEG2000()
-{
- return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_90)
- || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_91) );
-}
-