Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2005/01/11 22:46:22 $
- Version: $Revision: 1.179 $
+ Date: $Date: 2005/01/11 23:06:35 $
+ Version: $Revision: 1.180 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
}
+/**
+ * \brief Accesses the info from 0002,0010 : Transfer Syntax and TS
+ * else 1.
+ * @return The full Transfer Syntax Name (as opposed to Transfer Syntax UID)
+ */
+std::string Document::GetTransferSyntaxName()
+{
+ // use the TS (TS : Transfer Syntax)
+ std::string transferSyntax = GetEntry(0x0002,0x0010);
+
+ if ( transferSyntax == GDCM_NOTLOADED )
+ {
+ gdcmVerboseMacro( "Transfer Syntax not loaded. " << std::endl
+ << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
+ return "Uncompressed ACR-NEMA";
+ }
+ if ( transferSyntax == GDCM_UNFOUND )
+ {
+ gdcmVerboseMacro( "Unfound Transfer Syntax (0002,0010)");
+ return "Uncompressed ACR-NEMA";
+ }
+
+ while ( ! isdigit((unsigned char)transferSyntax[transferSyntax.length()-1]) )
+ {
+ transferSyntax.erase(transferSyntax.length()-1, 1);
+ }
+ // we do it only when we need it
+ TS* ts = Global::GetTS();
+ std::string tsName = ts->GetValue( transferSyntax );
+
+ // Global::GetTS() is a global static you shall never try to delete it!
+ return tsName;
+}
+
/**
* \brief Group 0002 is always coded Little Endian
* whatever Transfer Syntax is
if ( !Group0002Parsed && group != 0x0002)
{
Group0002Parsed = true;
- // we just came out of group 0002
- // if Transfer syntax is Big Endian we have to change CheckSwap
+ // we just came out of group 0002
+ // if Transfer syntax is Big Endian we have to change CheckSwap
- TagKey key = DictEntry::TranslateToKey(0x0002, 0x0010);
- if ( !TagHT.count(key))
+ std::string ts = GetTransferSyntaxName();
+ if ( !Global::GetTS()->IsTransferSyntax(ts) )
{
- gdcmVerboseMacro("True DICOM File, with NO Tansfer Syntax ?!?");
+ gdcmVerboseMacro("True DICOM File, with NO Tansfer Syntax: " << ts );
return;
}
- // FIXME Strangely, this works with
- //'Implicit VR Transfer Syntax (GE Private)
-
- if ( ((ValEntry *)TagHT.find(key)->second)->GetValue()
- == "Explicit VR - Big Endian" )
- {
- gdcmVerboseMacro("Tansfer Syntax = Explicit VR - Big Endian");
- SwitchByteSwapCode();
- }
+ // FIXME Strangely, this works with
+ //'Implicit VR Transfer Syntax (GE Private)
+ if ( Global::GetTS()->GetSpecialTransferSyntax(ts) == TS::ExplicitVRBigEndian )
+ {
+ gdcmVerboseMacro("Tansfer Syntax = Explicit VR - Big Endian");
+ SwitchByteSwapCode();
+ }
}
}
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2005/01/11 22:46:22 $
- Version: $Revision: 1.82 $
+ Date: $Date: 2005/01/11 23:06:35 $
+ Version: $Revision: 1.83 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void LoadDocEntrySafe(DocEntry *entry);
TagDocEntryHT *BuildFlatHashTable();
-
+
+ /// Return the Transfer Syntax as a string
+ std::string GetTransferSyntaxName();
+
protected:
// Methods
// Constructor and destructor are protected to forbid end user
Program: gdcm
Module: $RCSfile: gdcmHeader.cxx,v $
Language: C++
- Date: $Date: 2005/01/11 20:49:44 $
- Version: $Revision: 1.230 $
+ Date: $Date: 2005/01/11 23:06:35 $
+ Version: $Revision: 1.231 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
return lutNbits;
}
-/**
- * \brief Accesses the info from 0002,0010 : Transfer Syntax and TS
- * else 1.
- * @return The full Transfer Syntax Name (as opposed to Transfer Syntax UID)
- */
-std::string Header::GetTransferSyntaxName()
-{
- // use the TS (TS : Transfer Syntax)
- std::string transferSyntax = GetEntry(0x0002,0x0010);
-
- if ( transferSyntax == GDCM_NOTLOADED )
- {
- gdcmVerboseMacro( "Transfer Syntax not loaded. " << std::endl
- << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE" );
- return "Uncompressed ACR-NEMA";
- }
- if ( transferSyntax == GDCM_UNFOUND )
- {
- gdcmVerboseMacro( "Unfound Transfer Syntax (0002,0010)");
- return "Uncompressed ACR-NEMA";
- }
-
- while ( ! isdigit((unsigned char)transferSyntax[transferSyntax.length()-1]) )
- {
- transferSyntax.erase(transferSyntax.length()-1, 1);
- }
- // we do it only when we need it
- TS* ts = Global::GetTS();
- std::string tsName = ts->GetValue( transferSyntax );
-
- //delete ts; /// \todo Seg Fault when deleted ?!
- return tsName;
-}
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmHeader.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.99 $
+ Date: $Date: 2005/01/11 23:06:35 $
+ Version: $Revision: 1.100 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
bool HasLUT();
int GetLUTNbits();
- /// Return the Transfer Syntax as a string
- std::string GetTransferSyntaxName();
-
/// Accessor to \ref Header::GrPixel
uint16_t GetGrPixel() { return GrPixel; }