Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
const unsigned int gdcmDocument::HEADER_LENGTH_TO_READ = 256;
// Refer to gdcmDocument::SetMaxSizeLoadEntry()
const unsigned int gdcmDocument::HEADER_LENGTH_TO_READ = 256;
// Refer to gdcmDocument::SetMaxSizeLoadEntry()
-const unsigned int gdcmDocument::MAX_SIZE_LOAD_ELEMENT_VALUE = 0x7fffffff;// 4096;//
-const unsigned int gdcmDocument::MAX_SIZE_PRINT_ELEMENT_VALUE = 0x7fffffff;//64;
+const unsigned int gdcmDocument::MAX_SIZE_LOAD_ELEMENT_VALUE = 0xfff; // 4096
+const unsigned int gdcmDocument::MAX_SIZE_PRINT_ELEMENT_VALUE = 0x7fffffff;
//-----------------------------------------------------------------------------
// Constructor / Destructor
//-----------------------------------------------------------------------------
// Constructor / Destructor
// Load 'non string' values
std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);
// Load 'non string' values
std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);
LoadEntryVoidArea(0x0028,0x1200); // gray LUT
LoadEntryVoidArea(0x0028,0x1201); // R LUT
LoadEntryVoidArea(0x0028,0x1202); // G LUT
LoadEntryVoidArea(0x0028,0x1200); // gray LUT
LoadEntryVoidArea(0x0028,0x1201); // R LUT
LoadEntryVoidArea(0x0028,0x1202); // G LUT
std::cout << " gdcmDocument::IsReadable: Filetype " << Filetype
<< " " << "gdcmUnknown " << gdcmUnknown << std::endl; //JPR
dbg.Verbose(0, "gdcmDocument::IsReadable: wrong filetype");
return false;
}
std::cout << " gdcmDocument::IsReadable: Filetype " << Filetype
<< " " << "gdcmUnknown " << gdcmUnknown << std::endl; //JPR
dbg.Verbose(0, "gdcmDocument::IsReadable: wrong filetype");
return false;
}
* the current document. False either when the document contains
* no Transfer Syntax, or when the Tranfer Syntaxes don't match.
*/
* the current document. False either when the document contains
* no Transfer Syntax, or when the Tranfer Syntaxes don't match.
*/
// The entry might be present but not loaded (parsing and loading
// happen at differente stages): try loading and proceed with check...
// The entry might be present but not loaded (parsing and loading
// happen at differente stages): try loading and proceed with check...
// 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...
// 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...
// Anyway, it's to late check if the 'Preamble' was found ...
// And ... would it be a rich idea to check ?
// (some 'no Preamble' DICOM images exist !)
// Anyway, it's to late check if the 'Preamble' was found ...
// And ... would it be a rich idea to check ?
// (some 'no Preamble' DICOM images exist !)
//ACR -- or DICOM with no Preamble --
if( zero == 0x0008 || zero == 0x0800 || zero == 0x0002 || zero == 0x0200)
//ACR -- or DICOM with no Preamble --
if( zero == 0x0008 || zero == 0x0800 || zero == 0x0002 || zero == 0x0200)
//DICOM
fseek(fp, 126L, SEEK_CUR);
char dicm[4];
fread(dicm, (size_t)4, (size_t)1, fp);
if( memcmp(dicm, "DICM", 4) == 0 )
//DICOM
fseek(fp, 126L, SEEK_CUR);
char dicm[4];
fread(dicm, (size_t)4, (size_t)1, fp);
if( memcmp(dicm, "DICM", 4) == 0 )
/// \todo move the following lines (and a lot of others, to be written)
/// to a future function CheckAndCorrectHeader
/// \todo move the following lines (and a lot of others, to be written)
/// to a future function CheckAndCorrectHeader
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: call to"
" NewDocEntryByNumber failed.");
return NULL;
}
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: call to"
" NewDocEntryByNumber failed.");
return NULL;
}
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: AddEntry"
" failed allthough this is a creation.");
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: AddEntry"
" failed allthough this is a creation.");
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: removal"
" of previous DocEntry failed.");
return NULL;
}
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: removal"
" of previous DocEntry failed.");
return NULL;
}
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: adding"
" promoted ValEntry failed.");
{
dbg.Verbose(0, "gdcmDocument::ReplaceOrCreateByNumber: adding"
" promoted ValEntry failed.");
- a = GetDocEntryByNumber( Group, Elem);
- if (a == NULL) {
- a =NewBinEntryByNumber(Group, Elem);
- if (a == NULL)
- return NULL;
+ gdcmDocEntry* a = GetDocEntryByNumber( group, elem);
+ if (!a)
+ {
+ a = NewBinEntryByNumber(group, elem);
+ if (!a)
+ {
+ return 0;
+ }
- SetEntryByNumber(voidArea, lgth, Group, Elem);
- b->SetVoidArea(voidArea);
+ SetEntryByNumber(voidArea, lgth, group, elem);
+ //b->SetVoidArea(voidArea); //what if b == 0 !!
std::string gdcmDocument::GetEntryByName(TagName tagName)
{
gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
std::string gdcmDocument::GetEntryByName(TagName tagName)
{
gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName);
uint32_t gdcmDocument::ReadTagLength(uint16_t TestGroup, uint16_t TestElement)
{
long PositionOnEntry = ftell(fp);
uint32_t gdcmDocument::ReadTagLength(uint16_t TestGroup, uint16_t TestElement)
{
long PositionOnEntry = ftell(fp);