#include <gdcmDataEntry.h>
Inheritance diagram for GDCM_NAME_SPACE::DataEntry:
Public Types | |
enum | TValueState { STATE_LOADED = 0x00, STATE_NOTLOADED = 0x01, STATE_UNFOUND = 0x02, STATE_UNREAD = 0x03 } |
values for current state of a DataEntry (internal use only) More... | |
enum | TValueFlag { FLAG_NONE = 0x00, FLAG_PIXELDATA = 0x01 } |
values for current pixel status of a DataEntry (internal use only) More... | |
Public Member Functions | |
void | Print (std::ostream &os=std::cout, std::string const &indent="") |
Prints a DataEntry (Dicom entry). | |
virtual void | WriteContent (std::ofstream *fp, FileType filetype, bool insideMetaElements) |
Writes the 'common part' + the 'value' area of a DataEntry. | |
uint32_t | ComputeFullLength () |
Compute the full length of the elementary DataEntry (not only value length) depending on the VR. | |
uint8_t * | GetBinArea () |
Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon). | |
void | SetBinArea (uint8_t *area, bool self=true) |
Sets the value (non string) of the current DataEntry. | |
void | CopyBinArea (uint8_t *area, uint32_t length) |
Inserts the value (non string) into the current DataEntry. | |
void | SetValue (const uint32_t &id, const double &val) |
Inserts the elementary (non string) value into the current DataEntry. | |
double | GetValue (const uint32_t &id) const |
returns, as a double one of the values (when entry is multivaluated), identified by its index. Returns 0.0 if index is wrong | |
uint32_t | GetValueCount () const |
returns the number of elementary values | |
bool | IsValueCountValid () |
Checks if the multiplicity of the value follows Dictionary VM. | |
void | SetString (std::string const &value) |
Sets the 'value' of a DataEntry, passed as a std::string. | |
std::string const & | GetString () const |
returns as a string (when possible) the value of the DataEntry | |
void | SetSelfArea (bool area) |
Sets SelfArea. | |
bool | IsSelfArea () |
True if Entry owns its BinArea. | |
void | SetState (const TValueState &state) |
Sets the state (Loaded, NotLoaded, UnFound, ...) of the DataEntry. | |
const TValueState & | GetState () const |
Returns the state (Loaded, NotLoaded, ...) of the DataEntry. | |
bool | IsNotLoaded () |
true when value Entry not loaded | |
bool | IsUnfound () |
true if Entry not found | |
bool | IsUnread () |
true if Entry not read | |
bool | IsGoodValue () |
true if Entry value properly loaded | |
void | SetFlag (const TValueFlag &flag) |
sets the 'pixel data flag' | |
const TValueFlag & | GetFlag () const |
returns the 'pixel data flag' | |
bool | IsPixelData () |
true id Entry is a Pixel Data entry | |
virtual void | Copy (DocEntry *doc) |
Copies all the attributes from an other DocEntry. | |
bool | GetDSValue (std::vector< double > &valueVector) |
Gets a std::vector of 'double' holding the value(s) of a DS DataEntry. | |
DictEntry * | GetDictEntry () |
Gets the DicEntry of the current Dicom entry. | |
uint16_t const & | GetGroup () const |
Returns the Dicom Group number of the current Dicom entry. | |
uint16_t const & | GetElement () const |
Returns the Dicom Element number of the current Dicom entry. | |
TagKey const & | GetKey () const |
Returns the 'key' of the current Dicom entry. | |
std::string const & | GetName () |
Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry. | |
VRKey const & | GetVR () const |
Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry. | |
std::string const & | GetVM () |
Returns the 'Value Multiplicity' (e.g. "1", "6", "1-n", "3-n"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry. | |
void | SetVM (TagName &) |
Sets the 'Value Multiplicity' of the current Dicom entry. | |
const size_t & | GetOffset () const |
Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry. | |
void | SetReadLength (uint32_t l) |
Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry. | |
const uint32_t & | GetReadLength () const |
Returns the 'read length' of the current Dicom entry. | |
virtual void | SetLength (uint32_t l) |
Sets both 'Read Length' and 'Usable Length' of the current Dicom entry. | |
const uint32_t & | GetLength () const |
Returns the actual value length of the current Dicom entry. | |
uint32_t | GetFullLength () |
Gets the full length of the elementary DocEntry (not only value length) depending on the VR. | |
void | SetOffset (size_t of) |
Sets the offset of the Dicom entry. | |
void | SetImplicitVR () |
Sets to TRUE the ImplicitVr flag of the current Dicom entry. | |
void | SetVR (VRKey const &vr) |
void | SetTag (TagKey const &key) |
bool | IsImplicitVR () const |
Tells us if the current Dicom entry was checked as ImplicitVr. | |
bool | IsVRUnknown () const |
Tells us if the VR of the current Dicom entry is Unknown. | |
bool | IsVMUnknown () |
Tells us if the VM of the current Dicom entry is Unknown. | |
bool | IsItemDelimitor () |
tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d) | |
bool | IsItemStarter () |
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd) | |
bool | IsSequenceDelimitor () |
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd) | |
void | Delete () |
Delete the object. | |
void | Register () |
Register the object. | |
void | Unregister () |
Unregister the object. | |
const unsigned long & | GetRefCount () const |
Get the reference counting. | |
void | SetPrintLevel (int level) |
Sets the print level for the Dicom Header Elements. | |
int | GetPrintLevel () |
Gets the print level for the Dicom Entries. | |
Static Public Member Functions | |
static DataEntry * | New (DocEntry *d) |
Contructs a DataEntry with a RefCounter from DocEntry. | |
static DataEntry * | New (uint16_t group, uint16_t elem, VRKey const &vr) |
Contructs a DataEntry with a RefCounter from elementary items. | |
static const uint32_t & | GetMaxSizePrintEntry () |
returns the size threshold above which an element value will NOT be *printed* in order no to polute the screen output | |
static void | SetMaxSizePrintEntry (const uint32_t &size) |
Header Elements too long will not be printed. | |
Protected Member Functions | |
DataEntry (DocEntry *d) | |
Constructor for a given DocEntry. | |
DataEntry (uint16_t group, uint16_t elem, VRKey const &vr) | |
Constructor for a given DataEntry. | |
~DataEntry () | |
Canonical destructor. | |
void | NewBinArea () |
Creates a DataEntry owned BinArea (remove previous one if any and relevant StrArea if any). | |
void | DeleteBinArea () |
Removes the BinArea, if owned by the DataEntry, and the relevant StrArea if any. | |
Protected Attributes | |
uint8_t * | BinArea |
memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons) | |
bool | SelfArea |
Whether DataEntry has its own BinArea or not. | |
std::string * | StrArea |
std::string representable value of the Entry. Parts of a multivaluated data are separated by back-slash | |
DictEntry * | DicomDict |
pointer to the underlying Dicom dictionary element | |
uint32_t | Length |
Corresponds to the real length of the data This length might always be even. | |
uint32_t | ReadLength |
Length to read in the file to obtain data. | |
bool | ImplicitVR |
Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary. | |
size_t | Offset |
Offset from the beginning of file for direct user access. | |
VRKey | VR |
Value Representation (to avoid accessing Dicom Dict every time!). | |
TagKey | Key |
Dicom TagKey. Contains Dicom Group number and Dicom Element number (to avoid accessing Dicom Dict every time !) // JPRx. | |
int | PrintLevel |
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level. | |
Private Member Functions | |
gdcmTypeMacro (DataEntry) | |
Private Attributes | |
TValueFlag | Flag |
0 for straight entries, FLAG_PIXELDATA for Pixel Data entries | |
TValueState | State |
Entry status:STATE_NOTLOADED,STATE_UNFOUND,STATE_UNREAD,STATE_LOADED. | |
Static Private Attributes | |
static uint32_t | MaxSizePrintEntry = MAX_SIZE_PRINT_ELEMENT_VALUE |
Size threshold above which an element is printed. |
Definition at line 37 of file gdcmDataEntry.h.
|
values for current pixel status of a DataEntry (internal use only)
Definition at line 91 of file gdcmDataEntry.h. 00092 { 00093 FLAG_NONE = 0x00, 00094 FLAG_PIXELDATA = 0x01 00095 };
|
|
values for current state of a DataEntry (internal use only)
Definition at line 82 of file gdcmDataEntry.h. 00083 { 00084 STATE_LOADED = 0x00, 00085 STATE_NOTLOADED = 0x01, 00086 STATE_UNFOUND = 0x02, 00087 STATE_UNREAD = 0x03 00088 };
|
|
Constructor for a given DocEntry.
Definition at line 64 of file gdcmDataEntry.cxx. References BinArea, Copy(), Flag, FLAG_NONE, and SelfArea. 00065 : DocEntry(e->GetDictEntry()) 00066 : DocEntry(e->GetGroup(),e->GetElement(), e->GetVR() ) 00067 { 00068 Flag = FLAG_NONE; 00069 BinArea = 0; 00070 00071 SelfArea = true; 00072 00073 Copy(e); 00074 }
|
|
Constructor for a given DataEntry.
Definition at line 48 of file gdcmDataEntry.cxx. References BinArea, Flag, FLAG_NONE, SelfArea, State, STATE_LOADED, and StrArea. 00050 : DocEntry(group,elem,vr) 00051 { 00052 State = STATE_LOADED; 00053 Flag = FLAG_NONE; 00054 00055 StrArea = 0; 00056 BinArea = 0; 00057 SelfArea = true; 00058 }
|
|
Canonical destructor.
Definition at line 79 of file gdcmDataEntry.cxx. References DeleteBinArea(). 00080 { 00081 DeleteBinArea(); 00082 00083 }
|
|
Compute the full length of the elementary DataEntry (not only value length) depending on the VR.
Implements GDCM_NAME_SPACE::DocEntry. Definition at line 647 of file gdcmDataEntry.cxx. References GDCM_NAME_SPACE::DocEntry::GetFullLength(). 00648 { 00649 return GetFullLength(); 00650 }
|
|
Copies all the attributes from an other DocEntry.
Reimplemented from GDCM_NAME_SPACE::DocEntry. Definition at line 531 of file gdcmDataEntry.cxx. References BinArea, GDCM_NAME_SPACE::DocEntry::Copy(), CopyBinArea(), Flag, GDCM_NAME_SPACE::DocEntry::GetLength(), and State. Referenced by GDCM_NAME_SPACE::FileHelper::CopyDataEntry(), DataEntry(), and GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(). 00532 { 00533 DocEntry::Copy(doc); 00534 00535 DataEntry *entry = dynamic_cast<DataEntry *>(doc); 00536 if ( entry ) 00537 { 00538 State = entry->State; 00539 Flag = entry->Flag; 00540 CopyBinArea(entry->BinArea,entry->GetLength()); 00541 } 00542 }
|
|
Inserts the value (non string) into the current DataEntry.
Definition at line 109 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), NewBinArea(), GDCM_NAME_SPACE::DocEntry::SetLength(), State, and STATE_LOADED. Referenced by Copy(), and GDCM_NAME_SPACE::DicomDirMeta::WriteContent(). 00110 { 00111 DeleteBinArea(); 00112 00113 uint32_t lgh = length + length%2; 00114 SetLength(lgh); 00115 00116 if( area && length > 0 ) 00117 { 00118 NewBinArea(); 00119 memcpy(BinArea,area,length); 00120 if( length!=lgh ) 00121 BinArea[length]=0; 00122 00123 State = STATE_LOADED; 00124 } 00125 }
|
|
|
Removes the BinArea, if owned by the DataEntry, and the relevant StrArea if any.
Definition at line 665 of file gdcmDataEntry.cxx. References SelfArea, and StrArea. Referenced by CopyBinArea(), NewBinArea(), SetBinArea(), SetString(), and ~DataEntry(). 00666 { 00667 if (BinArea && SelfArea) 00668 { 00669 delete[] BinArea; 00670 BinArea = NULL; 00671 } 00672 if (StrArea) 00673 { 00674 delete StrArea; 00675 StrArea = 0; 00676 } 00677 }
|
|
|
|
Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon).
Definition at line 64 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::DocEntrySet::GetEntryBinArea(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), and Print(). 00064 { return BinArea; }
|
|
Gets the DicEntry of the current Dicom entry.
Definition at line 49 of file gdcmDocEntry.h. 00049 { return DicomDict; }
|
|
Gets a std::vector of 'double' holding the value(s) of a DS DataEntry.
Definition at line 343 of file gdcmDataEntry.cxx. References GetString(), GDCM_NAME_SPACE::DocEntry::GetVR(), and GDCM_NAME_SPACE::Util::Tokenize(). 00344 { 00346 std::vector<std::string> tokens; 00347 00348 if (GetVR() != "DS") // never trust a user ! 00349 return false; 00350 00351 Util::Tokenize ( GetString().c_str(), tokens, "\\" ); 00352 00353 int nbValues= tokens.size(); 00354 if (nbValues == 0) 00355 return false; 00356 00357 for (int loop=0; loop<nbValues; loop++) 00358 valueVector.push_back(atof(tokens[loop].c_str())); 00359 00360 return true; 00361 }
|
|
Returns the Dicom Element number of the current Dicom entry.
Definition at line 56 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GetValue(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::DocEntry::WriteContent(). 00056 { return Key[1];}
|
|
returns the 'pixel data flag'
Definition at line 115 of file gdcmDataEntry.h. 00115 { return Flag; }
|
|
Gets the full length of the elementary DocEntry (not only value length) depending on the VR.
Definition at line 227 of file gdcmDocEntry.cxx. References GDCM_NAME_SPACE::DocEntry::GetReadLength(), GDCM_NAME_SPACE::DocEntry::GetVR(), and GDCM_NAME_SPACE::DocEntry::IsImplicitVR(). Referenced by ComputeFullLength(). 00228 { 00229 uint32_t l = GetReadLength(); 00230 if ( IsImplicitVR() ) 00231 { 00232 l = l + 8; // 2 (gr) + 2 (el) + 4 (lgth) 00233 } 00234 else 00235 { 00236 if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" ) 00237 { 00238 l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth) 00239 } 00240 else 00241 { 00242 l = l + 8; // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth) 00243 } 00244 } 00245 return l; 00246 }
|
|
Returns the Dicom Group number of the current Dicom entry.
Definition at line 52 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GetValue(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), GDCM_NAME_SPACE::DocEntry::Print(), Print(), GDCM_NAME_SPACE::DocEntryArchive::Push(), GDCM_NAME_SPACE::Document::SkipToNextDocEntry(), GDCM_NAME_SPACE::DocEntry::WriteContent(), and WriteContent(). 00052 { return Key[0]; }
|
|
Returns the 'key' of the current Dicom entry.
Definition at line 60 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::ElementSet::AddEntry(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::Document::ParseDES(), GDCM_NAME_SPACE::DocEntryArchive::Push(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), GDCM_NAME_SPACE::Validator::SetInput(), and WriteContent(). 00060 { return Key; }
|
|
Returns the actual value length of the current Dicom entry.
Definition at line 102 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), Copy(), GDCM_NAME_SPACE::Document::DoTheLoadingDocumentJob(), GDCM_NAME_SPACE::DocEntrySet::GetEntryLength(), GDCM_NAME_SPACE::File::GetPixelAreaLength(), GetValue(), GetValueCount(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), NewBinArea(), Print(), GDCM_NAME_SPACE::Document::SkipDocEntry(), GDCM_NAME_SPACE::DocEntry::WriteContent(), and WriteContent(). 00102 { return Length; }
|
|
returns the size threshold above which an element value will NOT be *printed* in order no to polute the screen output
Definition at line 123 of file gdcmDataEntry.h. Referenced by Print(). 00123 { return MaxSizePrintEntry; }
|
|
Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.
Definition at line 192 of file gdcmDocEntry.cxx. References GDCM_NAME_SPACE::DocEntry::DicomDict, GDCM_NAME_SPACE::GDCM_UNKNOWN, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::Dict::GetEntry(), GDCM_NAME_SPACE::DictEntry::GetName(), GDCM_NAME_SPACE::DocEntry::Key, and GDCM_NAME_SPACE::RefCounter::Register(). Referenced by GDCM_NAME_SPACE::DocEntry::Print(). 00193 { 00194 if (DicomDict == 0) 00195 DicomDict = 00196 Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]); 00197 if (DicomDict == 0) 00198 return GDCM_UNKNOWN; 00199 else 00200 { 00201 DicomDict->Register(); 00202 return DicomDict->GetName(); 00203 } 00204 }
|
|
Returns offset (since the beginning of the file, including the File Preamble, if any) of the value of the current Dicom entry.
Definition at line 85 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::File::DoTheLoadingJob(), GDCM_NAME_SPACE::File::GetPixelOffset(), GDCM_NAME_SPACE::Document::LoadEntryBinArea(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::SeqEntry::SeqEntry(), and GDCM_NAME_SPACE::Document::SkipToNextDocEntry(). 00085 { return Offset; }
|
|
Gets the print level for the Dicom Entries.
Definition at line 50 of file gdcmBase.h. 00050 { return PrintLevel; }
|
|
Returns the 'read length' of the current Dicom entry.
Definition at line 94 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::GetFullLength(), GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::Document::SkipToNextDocEntry(), and GDCM_NAME_SPACE::SeqEntry::WriteContent(). 00094 { return ReadLength; }
|
|
Get the reference counting.
Definition at line 59 of file gdcmRefCounter.h. 00060 { 00061 return RefCount; 00062 }
|
|
Returns the state (Loaded, NotLoaded, ...) of the DataEntry.
Definition at line 101 of file gdcmDataEntry.h. 00101 { return State; }
|
|
returns as a string (when possible) the value of the DataEntry
Definition at line 436 of file gdcmDataEntry.cxx. References BinArea, GetValueCount(), GDCM_NAME_SPACE::DocEntry::GetVR(), and StrArea. Referenced by GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::CheckVM(), GetDSValue(), GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), GDCM_NAME_SPACE::File::GetRescaleSlopeIntercept(), GDCM_NAME_SPACE::File::GetSpacing(), Print(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), GDCM_NAME_SPACE::FileHelper::SetWriteToNoLibido(), and userSuppliedLessThanFunction(). 00437 { 00438 static std::ostringstream s; 00439 const VRKey &vr = GetVR(); 00440 s.str(""); 00441 00442 if (!StrArea) 00443 StrArea = new std::string(); 00444 else 00445 *StrArea=""; 00446 00447 if( !BinArea ) 00448 return *StrArea; 00449 // When short integer(s) are stored, convert the following (n * 2) characters 00450 // as a displayable string, the values being separated by a back-slash 00451 if( vr == "US" ) 00452 { 00453 uint16_t *data=(uint16_t *)BinArea; 00454 for (unsigned int i=0; i < GetValueCount(); i++) 00455 { 00456 if( i!=0 ) 00457 s << '\\'; 00458 s << data[i]; 00459 } 00460 *StrArea=s.str(); 00461 } 00462 else if (vr == "SS" ) 00463 { 00464 int16_t *data=(int16_t *)BinArea; 00465 for (unsigned int i=0; i < GetValueCount(); i++) 00466 { 00467 if( i!=0 ) 00468 s << '\\'; 00469 s << data[i]; 00470 } 00471 *StrArea=s.str(); 00472 } // See above comment on multiple short integers (mutatis mutandis). 00473 else if( vr == "UL" ) 00474 { 00475 uint32_t *data=(uint32_t *)BinArea; 00476 for (unsigned int i=0; i < GetValueCount(); i++) 00477 { 00478 if( i!=0 ) 00479 s << '\\'; 00480 s << data[i]; 00481 } 00482 *StrArea=s.str(); 00483 } 00484 else if( vr == "SL" ) 00485 { 00486 int32_t *data=(int32_t *)BinArea; 00487 for (unsigned int i=0; i < GetValueCount(); i++) 00488 { 00489 if( i!=0 ) 00490 s << '\\'; 00491 s << data[i]; 00492 } 00493 *StrArea=s.str(); 00494 } else if( vr == "FL" ) 00495 { 00496 float *data=(float *)BinArea; 00497 for (unsigned int i=0; i < GetValueCount(); i++) 00498 { 00499 if( i!=0 ) 00500 s << '\\'; 00501 s << data[i]; 00502 } 00503 *StrArea=s.str(); 00504 } 00505 else if( vr == "FD" ) 00506 { 00507 double *data=(double *)BinArea; 00508 for (unsigned int i=0; i < GetValueCount(); i++) 00509 { 00510 if( i!=0 ) 00511 s << '\\'; 00512 s << data[i]; 00513 } 00514 *StrArea=s.str(); 00515 } 00516 else 00517 { 00518 StrArea->append((const char *)BinArea,GetLength()); 00519 // to avoid gdcm to propagate oddities in lengthes 00520 if ( GetLength()%2) 00521 StrArea->append(" ",1); } 00522 return *StrArea; 00523 }
|
|
returns, as a double one of the values (when entry is multivaluated), identified by its index. Returns 0.0 if index is wrong
Definition at line 180 of file gdcmDataEntry.cxx. References BinArea, gdcmErrorMacro, GDCM_NAME_SPACE::DocEntry::GetElement(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetLength(), GetValueCount(), GDCM_NAME_SPACE::Global::GetVR(), and GDCM_NAME_SPACE::DocEntry::GetVR(). Referenced by GDCM_NAME_SPACE::File::GetBitsAllocated(), GDCM_NAME_SPACE::File::GetBitsStored(), GDCM_NAME_SPACE::File::GetHighBitPosition(), GDCM_NAME_SPACE::File::GetPlanarConfiguration(), GDCM_NAME_SPACE::File::GetRescaleIntercept(), GDCM_NAME_SPACE::File::GetSamplesPerPixel(), GDCM_NAME_SPACE::File::GetTSize(), GDCM_NAME_SPACE::File::GetXSize(), GDCM_NAME_SPACE::File::GetXSpacing(), GDCM_NAME_SPACE::File::GetYSize(), GDCM_NAME_SPACE::File::GetYSpacing(), GDCM_NAME_SPACE::File::GetZOrigin(), GDCM_NAME_SPACE::File::GetZSize(), GDCM_NAME_SPACE::File::GetZSpacing(), and GDCM_NAME_SPACE::File::IsSignedPixelData(). 00181 { 00182 if( !BinArea ) 00183 { 00184 if (GetLength() != 0) // avoid stupid messages 00186 gdcmErrorMacro("BinArea not set " << std::hex 00187 << GetGroup() << " " << GetElement() 00188 << " Can't get the value"); 00189 return 0.0; 00190 } 00191 00192 uint32_t count = GetValueCount(); 00193 if( id > count ) 00194 { 00195 gdcmErrorMacro("Index (" << id << ") is greater than the data size"); 00196 return 0.0; 00197 } 00198 00199 // if user *knows* that entry contains a US, 00200 // he just has to cast the double he receives 00201 00202 const VRKey &vr = GetVR(); 00203 00204 if( vr == "US" || vr == "SS" ) 00205 return ((uint16_t *)BinArea)[id]; 00206 else if( vr == "UL" || vr == "SL" ) 00207 return ((uint32_t *)BinArea)[id]; 00208 else if( vr == "FL" ) 00209 return ((float *)BinArea)[id]; 00210 else if( vr == "FD" ) 00211 return ((double *)BinArea)[id]; 00212 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00213 { 00214 // this is for VR = "DS", ... 00215 if( GetLength() ) 00216 { 00217 // Don't use std::string to accelerate processing 00218 double val; 00219 char *tmp = new char[GetLength()+1]; 00220 memcpy(tmp,BinArea,GetLength()); 00221 tmp[GetLength()]=0; 00222 00223 if( count == 0 ) 00224 { 00225 val = atof(tmp); 00226 } 00227 else 00228 { 00229 count = id; 00230 char *beg = tmp; 00231 for(uint32_t i=0;i<GetLength();i++) 00232 { 00233 if( tmp[i] == '\\' ) 00234 { 00235 if( count == 0 ) 00236 { 00237 tmp[i] = 0; 00238 break; 00239 } 00240 else 00241 { 00242 count--; 00243 beg = &(tmp[i+1]); 00244 } 00245 } 00246 } 00247 val = atof(beg); 00248 } 00249 00250 delete[] tmp; 00251 return val; 00252 } 00253 else 00254 return 0.0; 00255 } 00256 else 00257 return BinArea[id]; 00258 }
|
|
returns the number of elementary values
Definition at line 310 of file gdcmDataEntry.cxx. References BinArea, GDCM_NAME_SPACE::DocEntry::GetLength(), GDCM_NAME_SPACE::Global::GetVR(), and GDCM_NAME_SPACE::DocEntry::GetVR(). Referenced by GetString(), GetValue(), GDCM_NAME_SPACE::File::GetXOrigin(), GDCM_NAME_SPACE::File::GetXSpacing(), GDCM_NAME_SPACE::File::GetYOrigin(), GDCM_NAME_SPACE::File::GetYSpacing(), GDCM_NAME_SPACE::File::GetZOrigin(), IsValueCountValid(), and SetValue(). 00311 { 00312 const VRKey &vr = GetVR(); 00313 if( vr == "US" || vr == "SS" ) 00314 return GetLength()/sizeof(uint16_t); 00315 else if( vr == "UL" || vr == "SL" ) 00316 return GetLength()/sizeof(uint32_t); 00317 else if( vr == "FL" || vr == "OF" ) 00318 return GetLength()/4 ; // FL has a *4* length! sizeof(float); 00319 else if( vr == "FD" ) 00320 return GetLength()/8; // FD has a *8* length! sizeof(double); 00321 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00322 { 00323 // Some element in DICOM are allowed to be empty 00324 if( !GetLength() ) 00325 return 0; 00326 // Don't use std::string to accelerate processing 00327 uint32_t count = 1; 00328 for(uint32_t i=0;i<GetLength();i++) 00329 { 00330 if( BinArea[i] == '\\') 00331 count++; 00332 } 00333 return count; 00334 } 00335 return GetLength(); 00336 }
|
|
Returns the 'Value Multiplicity' (e.g. "1", "6", "1-n", "3-n"), found in the Dicom entry or in the Dicom Dictionnary of the current Dicom entry.
Definition at line 209 of file gdcmDocEntry.cxx. References GDCM_NAME_SPACE::DocEntry::DicomDict, GDCM_NAME_SPACE::GDCM_UNKNOWN, GDCM_NAME_SPACE::DictSet::GetDefaultPubDict(), GDCM_NAME_SPACE::Global::GetDicts(), GDCM_NAME_SPACE::Dict::GetEntry(), GDCM_NAME_SPACE::DictEntry::GetVM(), GDCM_NAME_SPACE::DocEntry::Key, and GDCM_NAME_SPACE::RefCounter::Register(). Referenced by GDCM_NAME_SPACE::CheckVM(), and IsValueCountValid(). 00210 { 00211 if (DicomDict == 0) 00212 DicomDict = 00213 Global::GetDicts()->GetDefaultPubDict()->GetEntry(Key[0],Key[1]); 00214 if (DicomDict == 0) 00215 return GDCM_UNKNOWN; 00216 else 00217 { 00218 DicomDict->Register(); 00219 return DicomDict->GetVM(); 00220 } 00221 }
|
|
Returns the 'Value Representation' (e.g. "PN" : Person Name, "SL" : Signed Long), found in the Dicom header or in the Dicom Dictionnary, of the current Dicom entry.
Definition at line 70 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::CheckVM(), GDCM_NAME_SPACE::Document::ComputeGroup0002Length(), GDCM_NAME_SPACE::DicomDirMeta::ComputeGroup0002Length(), GDCM_NAME_SPACE::FileHelper::CopyDataEntry(), GDCM_NAME_SPACE::File::DoTheLoadingJob(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GetDSValue(), GDCM_NAME_SPACE::DocEntry::GetFullLength(), GetString(), GetValue(), GetValueCount(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryBinArea(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::Document::IsDocEntryAnInteger(), GDCM_NAME_SPACE::Document::LoadDocEntry(), GDCM_NAME_SPACE::Document::ParseDES(), GDCM_NAME_SPACE::DocEntry::Print(), Print(), SetString(), SetValue(), and GDCM_NAME_SPACE::DocEntry::WriteContent(). 00070 { return VR; }
|
|
true if Entry value properly loaded
Definition at line 109 of file gdcmDataEntry.h. 00109 { return State == STATE_LOADED; }
|
|
Tells us if the current Dicom entry was checked as ImplicitVr.
Definition at line 129 of file gdcmDocEntry.h. References GDCM_NAME_SPACE::ImplicitVR. Referenced by GDCM_NAME_SPACE::DocEntry::GetFullLength(), and GDCM_NAME_SPACE::SeqEntry::SeqEntry(). 00129 { return ImplicitVR; }
|
|
tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)
Definition at line 143 of file gdcmDocEntry.h. 00144 {return (GetGroup() == 0xfffe && GetElement() == 0xe00d);}
|
|
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
Definition at line 147 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::ParseDES(). 00147 { if (GetGroup() != 0xfffe) return false; 00148 return (GetElement() == 0xe000); }
|
|
true when value Entry not loaded
Definition at line 103 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::DocEntrySet::GetEntryString(), and Print(). 00103 { return State == STATE_NOTLOADED; }
|
|
true id Entry is a Pixel Data entry
Definition at line 117 of file gdcmDataEntry.h. 00117 { return (Flag &FLAG_PIXELDATA) != 0; }
|
|
True if Entry owns its BinArea.
Definition at line 79 of file gdcmDataEntry.h. 00079 { return SelfArea; }
|
|
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
Definition at line 151 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::ParseSQ(). 00151 { return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);}
|
|
true if Entry not found
Definition at line 105 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 00105 { return State == STATE_UNFOUND; }
|
|
true if Entry not read
Definition at line 107 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::DocEntrySet::GetEntryString(). 00107 { return State == STATE_UNREAD; }
|
|
Checks if the multiplicity of the value follows Dictionary VM.
Definition at line 263 of file gdcmDataEntry.cxx. References GetValueCount(), and GDCM_NAME_SPACE::DocEntry::GetVM(). Referenced by GDCM_NAME_SPACE::File::GetXOrigin(), GDCM_NAME_SPACE::File::GetYOrigin(), and GDCM_NAME_SPACE::File::GetZOrigin(). 00264 { 00265 uint32_t vm; 00266 const std::string &strVM = GetVM(); 00267 uint32_t vc = GetValueCount(); 00268 bool valid = vc == 0; 00269 if( valid ) 00270 return true; 00271 00272 // FIXME : what shall we do with VM = "2-n", "3-n", etc 00273 00274 if( strVM == "1-n" ) 00275 { 00276 // make sure there is at least one ??? FIXME 00277 valid = vc >= 1; 00278 } 00279 else 00280 { 00281 std::istringstream os; 00282 os.str( strVM ); 00283 os >> vm; 00284 // Two cases: 00285 // vm respects the one from the dict 00286 // vm is 0 (we need to check if this element is allowed to be empty) FIXME 00287 00288 // note (JPR) 00289 // ---- 00290 // Entries whose type is 1 are mandatory, with a mandatory value. 00291 // Entries whose type is 1c are mandatory-inside-a-Sequence, 00292 // with a mandatory value. 00293 // Entries whose type is 2 are mandatory, with an optional value. 00294 // Entries whose type is 2c are mandatory-inside-a-Sequence, 00295 // with an optional value. 00296 // Entries whose type is 3 are optional. 00297 00298 // case vc == 0 is only applicable for 'type 2' entries. 00299 // Problem : entry type may depend on the modality and/or the Sequence 00300 // it's embedded in ! 00301 // (Get the information in the 'Conformance Statements' ...) 00302 valid = vc == vm; 00303 } 00304 return valid; 00305 }
|
|
Tells us if the VM of the current Dicom entry is Unknown.
Definition at line 139 of file gdcmDocEntry.h. References GDCM_NAME_SPACE::GDCM_UNKNOWN. 00139 { return GetVM() == GDCM_UNKNOWN; }
|
|
Tells us if the VR of the current Dicom entry is Unknown.
Definition at line 134 of file gdcmDocEntry.h. References GDCM_NAME_SPACE::GDCM_VRUNKNOWN. Referenced by GDCM_NAME_SPACE::DocEntry::WriteContent(). 00134 { return VR == GDCM_VRUNKNOWN; }
|
|
Contructs a DataEntry with a RefCounter from elementary items.
Definition at line 47 of file gdcmDataEntry.h. 00048 {return new DataEntry(group,elem,vr);}
|
|
Contructs a DataEntry with a RefCounter from DocEntry.
Definition at line 45 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyDataEntry(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), GDCM_NAME_SPACE::DocEntrySet::NewDataEntry(), GDCM_NAME_SPACE::DicomDir::SetElement(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), and GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(). 00045 {return new DataEntry(d);}
|
|
Creates a DataEntry owned BinArea (remove previous one if any and relevant StrArea if any).
Definition at line 656 of file gdcmDataEntry.cxx. References DeleteBinArea(), GDCM_NAME_SPACE::DocEntry::GetLength(), and SelfArea. Referenced by CopyBinArea(), SetString(), and SetValue(). 00657 { 00658 DeleteBinArea(); 00659 if( GetLength() > 0 ) 00660 BinArea = new uint8_t[GetLength()]; 00661 SelfArea = true; 00662 }
|
|
Prints a DataEntry (Dicom entry).
Reimplemented from GDCM_NAME_SPACE::DocEntry. Definition at line 689 of file gdcmDataEntry.cxx. References GDCM_NAME_SPACE::Util::CreateCleanString(), GDCM_NAME_SPACE::GDCM_BINLOADED, GetBinArea(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetLength(), GetMaxSizePrintEntry(), GetString(), GDCM_NAME_SPACE::Global::GetVR(), GDCM_NAME_SPACE::DocEntry::GetVR(), GDCM_NAME_SPACE::Util::IsCleanArea(), IsNotLoaded(), GDCM_NAME_SPACE::DocEntry::Print(), and GDCM_NAME_SPACE::Base::PrintLevel. 00690 { 00691 os << "D "; 00692 DocEntry::Print(os); 00693 00694 uint16_t g = GetGroup(); 00695 if (g == 0xfffe) // delimiters have NO value 00696 { 00697 return; // just to avoid identing all the remaining code 00698 } 00699 00700 std::ostringstream s; 00701 TSAtr v; 00702 00703 if( BinArea ) 00704 { 00705 v = GetString(); 00706 const VRKey &vr = GetVR(); 00707 00708 if( vr == "US" || vr == "SS" || vr == "UL" || vr == "SL" 00709 || vr == "FL" || vr == "FD") 00710 s << " [" << GetString() << "]"; 00711 else 00712 { 00713 if(Global::GetVR()->IsVROfStringRepresentable(vr)) 00714 { 00715 // replace non printable characters by '.' 00716 std::string cleanString = Util::CreateCleanString(v); 00717 if ( cleanString.length() <= GetMaxSizePrintEntry() 00718 || PrintLevel >= 3 00719 || IsNotLoaded() ) 00720 // FIXME : when IsNotLoaded(), you create a Clean String ?!? 00721 // FIXME : PrintLevel<2 *does* print the values 00722 // (3 is only for extra offsets printing) 00723 // What do you wanted to do ? JPR 00724 { 00725 s << " [" << cleanString << "]"; 00726 } 00727 else 00728 { 00729 s << " [GDCM_NAME_SPACE::too long for print (" << cleanString.length() << ") ]"; 00730 } 00731 } 00732 else 00733 { 00734 // A lot of Private elements (with no VR) contain actually 00735 // only printable characters; 00736 // Let's deal with them as is they were VR std::string representable 00737 00738 if ( Util::IsCleanArea( GetBinArea(), GetLength() ) ) 00739 { 00740 // FIXME : since the 'Area' *is* clean, just use 00741 // a 'CreateString' method, to save CPU time. 00742 std::string cleanString = 00743 Util::CreateCleanString( BinArea,GetLength() ); 00744 s << " [" << cleanString << "]"; 00745 } 00746 else 00747 { 00748 s << " [" << GDCM_BINLOADED << ";" 00749 << "length = " << GetLength() << "]"; 00750 } 00751 } 00752 } 00753 } 00754 else 00755 { 00756 if( IsNotLoaded() ) 00757 s << " [" << GDCM_NOTLOADED << "]"; 00758 else if( IsUnfound() ) 00759 s << " [" << GDCM_UNFOUND << "]"; 00760 else if( IsUnread() ) 00761 s << " [" << GDCM_UNREAD << "]"; 00762 else if ( GetLength() == 0 ) 00763 s << " []"; 00764 } 00765 00766 if( IsPixelData() ) 00767 s << " (" << GDCM_PIXELDATA << ")"; 00768 00769 // Display the UID value (instead of displaying only the rough code) 00770 // First 'clean' trailing character (space or zero) 00771 if(BinArea) 00772 { 00773 const uint16_t &gr = GetGroup(); 00774 const uint16_t &elt = GetElement(); 00775 TS *ts = Global::GetTS(); 00776 00777 if (gr == 0x0002) 00778 { 00779 // Any more to be displayed ? 00780 if ( elt == 0x0010 || elt == 0x0002 ) 00781 { 00782 if ( v.length() != 0 ) // for brain damaged headers 00783 { 00784 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00785 { 00786 v.erase(v.length()-1, 1); 00787 } 00788 } 00789 s << " ==>\t[" << ts->GetValue(v) << "]"; 00790 } 00791 } 00792 else if (gr == 0x0008) 00793 { 00794 if ( elt == 0x0016 || elt == 0x1150 ) 00795 { 00796 if ( v.length() != 0 ) // for brain damaged headers 00797 { 00798 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00799 { 00800 v.erase(v.length()-1, 1); 00801 } 00802 } 00803 s << " ==>\t[" << ts->GetValue(v) << "]"; 00804 } 00805 } 00806 else if (gr == 0x0004) 00807 { 00808 if ( elt == 0x1510 || elt == 0x1512 ) 00809 { 00810 if ( v.length() != 0 ) // for brain damaged headers 00811 { 00812 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00813 { 00814 v.erase(v.length()-1, 1); 00815 } 00816 } 00817 s << " ==>\t[" << ts->GetValue(v) << "]"; 00818 } 00819 } 00820 } 00821 00822 os << s.str(); 00823 }
|
|
Register the object.
Definition at line 46 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::SQItem::AddEntry(), GDCM_NAME_SPACE::SeqEntry::AddSQItem(), GDCM_NAME_SPACE::SeqEntry::Copy(), GDCM_NAME_SPACE::DicomDir::Copy(), GDCM_NAME_SPACE::FileHelper::FileHelper(), GDCM_NAME_SPACE::DocEntrySet::GetDictEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), GDCM_NAME_SPACE::DocEntrySet::InsertEntryString(), GDCM_NAME_SPACE::CommandManager::InSetCommand(), GDCM_NAME_SPACE::DocEntryArchive::Push(), and GDCM_NAME_SPACE::SeqEntry::SetDelimitationItem(). 00046 { RefCount++; }
|
|
Sets the value (non string) of the current DataEntry.
Definition at line 95 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), SelfArea, State, and STATE_LOADED. Referenced by GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::Document::LoadDocEntry(), and GDCM_NAME_SPACE::DocEntrySet::SetEntryBinArea(). 00096 { 00097 DeleteBinArea(); 00098 00099 BinArea = area; 00100 SelfArea = self; 00101 00102 State = STATE_LOADED; 00103 }
|
|
sets the 'pixel data flag'
Definition at line 113 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::ElementSet::Print(). 00113 { Flag = flag; }
|
|
Sets to TRUE the ImplicitVr flag of the current Dicom entry.
Definition at line 115 of file gdcmDocEntry.h. References GDCM_NAME_SPACE::ImplicitVR. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(). 00115 { ImplicitVR = true; }
|
|
Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.
Definition at line 98 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), CopyBinArea(), GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(), GDCM_NAME_SPACE::DocEntrySet::SetEntryBinArea(), and SetString(). 00098 { Length = l; }
|
|
Header Elements too long will not be printed.
Definition at line 125 of file gdcmDataEntry.h. 00126 { MaxSizePrintEntry = size; }
|
|
Sets the offset of the Dicom entry.
Definition at line 112 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::Backtrack(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), GDCM_NAME_SPACE::Document::ReadNextDocEntry(), and GDCM_NAME_SPACE::DicomDir::SetElement(). 00112 { Offset = of; }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::FileHelper::Print(), and GDCM_NAME_SPACE::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.
Definition at line 89 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::Document::FixDocEntryFoundLength(). 00089 { ReadLength = l; }
|
|
Sets SelfArea.
Definition at line 77 of file gdcmDataEntry.h. 00077 { SelfArea = area; }
|
|
Sets the state (Loaded, NotLoaded, UnFound, ...) of the DataEntry.
Definition at line 99 of file gdcmDataEntry.h. Referenced by GDCM_NAME_SPACE::Document::LoadDocEntry(), and GDCM_NAME_SPACE::Document::LoadEntryBinArea(). 00099 { State = state; }
|
|
Sets the 'value' of a DataEntry, passed as a std::string.
Definition at line 367 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), GDCM_NAME_SPACE::DocEntry::GetVR(), NewBinArea(), GDCM_NAME_SPACE::DocEntry::SetLength(), State, STATE_LOADED, and GDCM_NAME_SPACE::Util::Tokenize(). Referenced by GDCM_NAME_SPACE::DicomDir::Anonymize(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryElements(), GDCM_NAME_SPACE::FileHelper::CheckMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::CopyMandatoryEntry(), GDCM_NAME_SPACE::DicomDirObject::FillObject(), GDCM_NAME_SPACE::DocEntrySet::SetEntryString(), GDCM_NAME_SPACE::FileHelper::SetMandatoryEntry(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToExplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToImplicitVR(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG(), GDCM_NAME_SPACE::FileHelper::SetWriteFileTypeToJPEG2000(), GDCM_NAME_SPACE::FileHelper::SetWriteToLibido(), GDCM_NAME_SPACE::FileHelper::SetWriteToNoLibido(), GDCM_NAME_SPACE::FileHelper::SetWriteToRGB(), GDCM_NAME_SPACE::File::Write(), and GDCM_NAME_SPACE::DicomDirMeta::WriteContent(). 00368 { 00369 DeleteBinArea(); 00370 const VRKey &vr = GetVR(); 00371 if ( vr == "US" || vr == "SS" ) 00372 { 00373 std::vector<std::string> tokens; 00374 Util::Tokenize (value, tokens, "\\"); 00375 SetLength(tokens.size()*sizeof(uint16_t)); 00376 NewBinArea(); 00377 00378 uint16_t *data = (uint16_t *)BinArea; 00379 for (unsigned int i=0; i<tokens.size();i++) 00380 data[i] = atoi(tokens[i].c_str()); 00381 tokens.clear(); 00382 } 00383 else if ( vr == "UL" || vr == "SL" ) 00384 { 00385 std::vector<std::string> tokens; 00386 Util::Tokenize (value, tokens, "\\"); 00387 SetLength(tokens.size()*sizeof(uint32_t)); 00388 NewBinArea(); 00389 00390 uint32_t *data = (uint32_t *)BinArea; 00391 for (unsigned int i=0; i<tokens.size();i++) 00392 data[i] = atoi(tokens[i].c_str()); 00393 tokens.clear(); 00394 } 00395 else if ( vr == "FL" ) 00396 { 00397 std::vector<std::string> tokens; 00398 Util::Tokenize (value, tokens, "\\"); 00399 SetLength(tokens.size()*sizeof(float)); 00400 NewBinArea(); 00401 00402 float *data = (float *)BinArea; 00403 for (unsigned int i=0; i<tokens.size();i++) 00404 data[i] = (float)atof(tokens[i].c_str()); 00405 tokens.clear(); 00406 } 00407 else if ( vr == "FD" ) 00408 { 00409 std::vector<std::string> tokens; 00410 Util::Tokenize (value, tokens, "\\"); 00411 SetLength(tokens.size()*sizeof(double)); 00412 NewBinArea(); 00413 00414 double *data = (double *)BinArea; 00415 for (unsigned int i=0; i<tokens.size();i++) 00416 data[i] = atof(tokens[i].c_str()); 00417 tokens.clear(); 00418 } 00419 else 00420 { 00421 size_t l = value.size(); 00422 SetLength(l + l%2); 00423 NewBinArea(); 00424 memcpy(BinArea, value.c_str(), l); 00425 if (l%2) // padded with blank except for UI 00426 if ( vr == "UI" ) 00427 BinArea[l] = '\0'; 00428 else 00429 BinArea[l] = ' '; 00430 } 00431 State = STATE_LOADED; 00432 }
|
|
Sets the 'Value Representation' of the current Dicom entry
Definition at line 123 of file gdcmDocEntry.h. 00123 { Key = key; }
|
|
Inserts the elementary (non string) value into the current DataEntry.
Definition at line 132 of file gdcmDataEntry.cxx. References BinArea, gdcmErrorMacro, GetValueCount(), GDCM_NAME_SPACE::Global::GetVR(), GDCM_NAME_SPACE::DocEntry::GetVR(), NewBinArea(), State, and STATE_LOADED. 00133 { 00134 if( !BinArea ) 00135 NewBinArea(); 00136 State = STATE_LOADED; 00137 00138 if( id > GetValueCount() ) 00139 { 00140 gdcmErrorMacro("Index (" << id << ") is greater than the data size"); 00141 return; 00142 } 00143 00144 const VRKey &vr = GetVR(); 00145 if( vr == "US" || vr == "SS" ) 00146 { 00147 uint16_t *data = (uint16_t *)BinArea; 00148 data[id] = (uint16_t)val; 00149 } 00150 else if( vr == "UL" || vr == "SL" ) 00151 { 00152 uint32_t *data = (uint32_t *)BinArea; 00153 data[id] = (uint32_t)val; 00154 } 00155 else if( vr == "FL" ) 00156 { 00157 float *data = (float *)BinArea; 00158 data[id] = (float)val; 00159 } 00160 else if( vr == "FD" ) 00161 { 00162 double *data = (double *)BinArea; 00163 data[id] = (double)val; 00164 } 00165 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00166 { 00167 gdcmErrorMacro("SetValue on String representable not implemented yet"); 00168 } 00169 else 00170 { 00171 BinArea[id] = (uint8_t)val; 00172 } 00173 }
|
|
Sets the 'Value Multiplicity' of the current Dicom entry.
Definition at line 80 of file gdcmDocEntry.h.
|
|
Sets the 'Value Representation' of the current Dicom entry
Definition at line 119 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::File::DoTheLoadingJob(), and GDCM_NAME_SPACE::DocEntry::WriteContent(). 00119 { VR = vr; }
|
|
Unregister the object.
Definition at line 50 of file gdcmRefCounter.h. Referenced by GDCM_NAME_SPACE::Document::ReadNextDocEntry(), GDCM_NAME_SPACE::SQItem::RemoveEntry(), GDCM_NAME_SPACE::ElementSet::RemoveEntry(), and GDCM_NAME_SPACE::FileHelper::~FileHelper(). 00051 { 00052 //std::cout <<"================Unreg " << typeid(*this).name() << std::endl; 00053 RefCount--; 00054 if(RefCount<=0) 00055 delete this; 00056 }
|
|
Writes the 'common part' + the 'value' area of a DataEntry.
Reimplemented from GDCM_NAME_SPACE::DocEntry. Definition at line 549 of file gdcmDataEntry.cxx. References GDCM_NAME_SPACE::binary_write(), gdcmDebugMacro, GDCM_NAME_SPACE::VR::GetAtomicElementLength(), GDCM_NAME_SPACE::DocEntry::GetGroup(), GDCM_NAME_SPACE::DocEntry::GetKey(), GDCM_NAME_SPACE::DocEntry::GetLength(), GDCM_NAME_SPACE::Global::GetVR(), and GDCM_NAME_SPACE::DocEntry::WriteContent(). 00551 { 00552 // writes the 'common part' 00553 DocEntry::WriteContent(fp, filetype, insideMetaElements); 00554 00555 if ( GetGroup() == 0xfffe ) 00556 { 00557 return; //delimitors have NO value 00558 } 00559 00560 // --> We only deal with Little Endian writting. 00561 // --> forget Big Endian Transfer Syntax writting! 00562 // Next DICOM version will give it up ... 00563 00564 // WARNING - For Implicit VR private element, 00565 // we have *no choice* but considering them as 00566 // something like 'OB' values. 00567 // we rewrite them as we found them on disc. 00568 // Some trouble will occur if element was 00569 // *actually* OW, if image was produced 00570 // on Big endian based processor, read and writen 00571 // on Little endian based processor 00572 // and, later on, somebody needs 00573 // this 'OW' Implicit VR private element (?!?) 00574 // (Same stuff, mutatis mutandis, for Little/Big) 00575 00576 // 8/16 bits Pixels problem should be solved automatiquely, 00577 // since we ensure the VR (OB vs OW) is conform to Pixel size. 00578 00579 uint8_t *data = BinArea; //safe notation 00580 size_t l = GetLength(); 00581 // gdcmDebugMacro("in DataEntry::WriteContent " << GetKey() << " AtomicLength: " 00582 // << Global::GetVR()->GetAtomicElementLength(this->GetVR() ) // << " BinArea in :" << &BinArea 00583 // ); 00584 if (BinArea) // the binArea was *actually* loaded 00585 { 00586 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) 00587 unsigned short vrLgth = 00588 Global::GetVR()->GetAtomicElementLength(this->GetVR()); 00589 unsigned int i; 00590 switch(vrLgth) 00591 { 00592 case 1: 00593 { 00594 binary_write (*fp, data, l ); 00595 break; 00596 } 00597 case 2: 00598 { 00599 uint16_t *data16 = (uint16_t *)data; 00600 for(i=0;i<l/vrLgth;i++) 00601 binary_write( *fp, data16[i]); 00602 break; 00603 } 00604 case 4: 00605 { 00606 uint32_t *data32 = (uint32_t *)data; 00607 for(i=0;i<l/vrLgth;i++) 00608 binary_write( *fp, data32[i]); 00609 break; 00610 } 00611 case 8: 00612 { 00613 double *data64 = (double *)data; 00614 for(i=0;i<l/vrLgth;i++) 00615 binary_write( *fp, data64[i]); 00616 break; 00617 } 00618 } 00619 #else 00620 binary_write (*fp, data, l ); 00621 #endif //GDCM_WORDS_BIGENDIAN 00622 00623 } 00624 else 00625 { 00626 // nothing was loaded, but we need to skip space on disc 00627 if (l != 0) 00628 { 00629 // --> WARNING : nothing is written; 00630 // --> the initial data (on the the source image) is lost 00631 // --> user is *not* informed ! 00632 gdcmDebugMacro ("Nothing was loaded, but we need to skip space on disc. " 00633 << "Length =" << l << " for " << GetKey() ); 00634 fp->seekp(l, std::ios::cur); // At Write time, for unloaded elems 00635 } 00636 } 00637 // to avoid gdcm to propagate oddities 00638 // (length was already modified) 00639 if (l%2) 00640 fp->seekp(1, std::ios::cur); // At Write time, for non even length elems 00641 }
|
|
memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons)
Definition at line 143 of file gdcmDataEntry.h. Referenced by Copy(), CopyBinArea(), DataEntry(), GetString(), GetValue(), GetValueCount(), SetBinArea(), SetString(), and SetValue(). |
|
pointer to the underlying Dicom dictionary element
Definition at line 161 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::DocEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), GDCM_NAME_SPACE::DocEntry::GetVM(), and GDCM_NAME_SPACE::DocEntry::~DocEntry(). |
|
0 for straight entries, FLAG_PIXELDATA for Pixel Data entries
Definition at line 153 of file gdcmDataEntry.h. Referenced by Copy(), and DataEntry(). |
|
Even when reading explicit vr files, some elements happen to be implicit. Flag them here since we can't use the entry->vr without breaking the underlying dictionary.
Definition at line 173 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::Copy(), GDCM_NAME_SPACE::DocEntry::DocEntry(), and GDCM_NAME_SPACE::SeqEntry::SeqEntry(). |
|
Dicom TagKey. Contains Dicom Group number and Dicom Element number (to avoid accessing Dicom Dict every time !) // JPRx.
Definition at line 183 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::DocEntry(), GDCM_NAME_SPACE::DocEntry::GetName(), and GDCM_NAME_SPACE::DocEntry::GetVM(). |
|
Corresponds to the real length of the data This length might always be even.
Definition at line 165 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::Copy(), GDCM_NAME_SPACE::DocEntry::DocEntry(), and GDCM_NAME_SPACE::SeqEntry::SeqEntry(). |
|
Size threshold above which an element is printed.
Definition at line 158 of file gdcmDataEntry.h. |
|
Offset from the beginning of file for direct user access.
Definition at line 176 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::Copy(), GDCM_NAME_SPACE::DocEntry::DocEntry(), and GDCM_NAME_SPACE::SeqEntry::SeqEntry(). |
|
Amount of printed details for each Dicom Entries : 0 : stands for the least detail level.
Definition at line 55 of file gdcmBase.h. Referenced by GDCM_NAME_SPACE::SeqEntry::Print(), GDCM_NAME_SPACE::FileHelper::Print(), GDCM_NAME_SPACE::ElementSet::Print(), GDCM_NAME_SPACE::DocEntry::Print(), GDCM_NAME_SPACE::DictEntry::Print(), GDCM_NAME_SPACE::DicomDirStudy::Print(), GDCM_NAME_SPACE::DicomDirSerie::Print(), GDCM_NAME_SPACE::DicomDirPatient::Print(), GDCM_NAME_SPACE::DicomDirMeta::Print(), GDCM_NAME_SPACE::DicomDir::Print(), and Print(). |
|
Length to read in the file to obtain data.
Definition at line 168 of file gdcmDocEntry.h. Referenced by GDCM_NAME_SPACE::DocEntry::Copy(), GDCM_NAME_SPACE::DocEntry::DocEntry(), and GDCM_NAME_SPACE::SeqEntry::SeqEntry(). |
|
Whether DataEntry has its own BinArea or not.
Definition at line 145 of file gdcmDataEntry.h. Referenced by DataEntry(), DeleteBinArea(), NewBinArea(), and SetBinArea(). |
|
Entry status:STATE_NOTLOADED,STATE_UNFOUND,STATE_UNREAD,STATE_LOADED.
Definition at line 155 of file gdcmDataEntry.h. Referenced by Copy(), CopyBinArea(), DataEntry(), SetBinArea(), SetString(), and SetValue(). |
|
std::string representable value of the Entry. Parts of a multivaluated data are separated by back-slash
Definition at line 149 of file gdcmDataEntry.h. Referenced by DataEntry(), DeleteBinArea(), and GetString(). |
|
Value Representation (to avoid accessing Dicom Dict every time!).
Definition at line 179 of file gdcmDocEntry.h. |