#include <gdcmDataEntry.h>
Inheritance diagram for gdcm::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) |
Writes 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 FIXME : warn the user there was a problem ! | |
uint32_t | GetValueCount (void) const |
returns the number of elementary values | |
bool | IsValueCountValid () const |
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. | |
DictEntry * | GetDictEntry () |
Gets the DicEntry of the current Dicom entry. | |
const uint16_t & | GetGroup () const |
Returns the Dicom Group number of the current Dicom entry. | |
const uint16_t & | GetElement () const |
Returns the Dicom Element number of the current Dicom entry. | |
TagKey | GetKey () const |
Returns the 'key' of the current Dicom entry. | |
std::string const & | GetName () const |
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 () const |
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 const &v) |
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. | |
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 () const |
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 first one of an Item (fffe,e000) | |
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 (DictEntry *e) |
Contructs a DataEntry with a RefCounter from DictEntry. | |
static DataEntry * | New (DocEntry *d) |
Contructs a DataEntry with a RefCounter from DocEntry. | |
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 (DictEntry *e) | |
Constructor for a given DictEntry. | |
DataEntry (DocEntry *d) | |
Constructor for a given DocEntry. | |
~DataEntry () | |
Canonical destructor. | |
void | NewBinArea (void) |
Creates a DataEntry owned BinArea (remove previous one if any). | |
void | DeleteBinArea (void) |
Removes the BinArea, if owned by the DataEntry. | |
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 |
Correspond 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. | |
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 36 of file gdcmDataEntry.h.
|
values for current pixel status of a DataEntry (internal use only)
Definition at line 86 of file gdcmDataEntry.h. 00087 { 00088 FLAG_NONE = 0x00, 00089 FLAG_PIXELDATA = 0x01 00090 };
|
|
values for current state of a DataEntry (internal use only)
Definition at line 77 of file gdcmDataEntry.h. 00078 { 00079 STATE_LOADED = 0x00, 00080 STATE_NOTLOADED = 0x01, 00081 STATE_UNFOUND = 0x02, 00082 STATE_UNREAD = 0x03 00083 };
|
|
Constructor for a given DictEntry.
Definition at line 40 of file gdcmDataEntry.cxx. References BinArea, Flag, FLAG_NONE, SelfArea, State, and STATE_LOADED. 00041 : DocEntry(e) 00042 { 00043 State = STATE_LOADED; 00044 Flag = FLAG_NONE; 00045 00046 BinArea = 0; 00047 SelfArea = true; 00048 }
|
|
Constructor for a given DocEntry.
Definition at line 54 of file gdcmDataEntry.cxx. References BinArea, Copy(), Flag, FLAG_NONE, and SelfArea. 00055 : DocEntry(e->GetDictEntry()) 00056 { 00057 Flag = FLAG_NONE; 00058 BinArea = 0; 00059 SelfArea = true; 00060 00061 Copy(e); 00062 }
|
|
Canonical destructor.
Definition at line 67 of file gdcmDataEntry.cxx. References DeleteBinArea(). 00068 { 00069 DeleteBinArea(); 00070 }
|
|
Compute the full length of the elementary DataEntry (not only value length) depending on the VR.
Implements gdcm::DocEntry. Definition at line 585 of file gdcmDataEntry.cxx. References gdcm::DocEntry::GetFullLength(). 00586 { 00587 return GetFullLength(); 00588 }
|
|
Copies all the attributes from an other DocEntry.
Reimplemented from gdcm::DocEntry. Definition at line 471 of file gdcmDataEntry.cxx. References BinArea, gdcm::DocEntry::Copy(), CopyBinArea(), Flag, gdcm::DocEntry::GetLength(), and State. Referenced by gdcm::FileHelper::CopyDataEntry(), DataEntry(), gdcm::File::DoTheLoadingJob(), and gdcm::FileHelper::SetWriteToLibido(). 00472 { 00473 DocEntry::Copy(doc); 00474 00475 DataEntry *entry = dynamic_cast<DataEntry *>(doc); 00476 if ( entry ) 00477 { 00478 State = entry->State; 00479 Flag = entry->Flag; 00480 CopyBinArea(entry->BinArea,entry->GetLength()); 00481 } 00482 }
|
|
Inserts the value (non string) into the current DataEntry.
Definition at line 96 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), NewBinArea(), gdcm::DocEntry::SetLength(), State, and STATE_LOADED. Referenced by Copy(), and gdcm::DicomDirMeta::WriteContent(). 00097 { 00098 DeleteBinArea(); 00099 00100 uint32_t lgh = length + length%2; 00101 SetLength(lgh); 00102 00103 if( area && length > 0 ) 00104 { 00105 NewBinArea(); 00106 memcpy(BinArea,area,length); 00107 if( length!=lgh ) 00108 BinArea[length]=0; 00109 00110 State = STATE_LOADED; 00111 } 00112 }
|
|
|
Removes the BinArea, if owned by the DataEntry.
Definition at line 601 of file gdcmDataEntry.cxx. References BinArea, and SelfArea. Referenced by CopyBinArea(), NewBinArea(), SetBinArea(), SetString(), and ~DataEntry(). 00602 { 00603 if (BinArea && SelfArea) 00604 { 00605 delete[] BinArea; 00606 BinArea = NULL; 00607 } 00608 }
|
|
|
|
Returns the area value of the current Dicom Entry when it's not string-translatable (e.g : LUT table, overlay, icon).
Definition at line 59 of file gdcmDataEntry.h. Referenced by gdcm::File::DoTheLoadingJob(), gdcm::DocEntrySet::GetEntryBinArea(), gdcm::Document::LoadEntryBinArea(), and Print(). 00059 { return BinArea; }
|
|
Gets the DicEntry of the current Dicom entry.
Definition at line 48 of file gdcmDocEntry.h. Referenced by gdcm::FileHelper::CopyDataEntry(), gdcm::DocEntryArchive::Push(), and gdcm::FileHelper::SetWriteToLibido(). 00048 { return DicomDict; }
|
|
Returns the Dicom Element number of the current Dicom entry.
Definition at line 54 of file gdcmDocEntry.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsItemStarter(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), Print(), gdcm::Document::ReadNextDocEntry(), and gdcm::DocEntry::WriteContent(). 00054 { return DicomDict->GetElement();}
|
|
returns the 'pixel data flag'
Definition at line 110 of file gdcmDataEntry.h. 00110 { return Flag; }
|
|
Gets the full length of the elementary DocEntry (not only value length) depending on the VR.
Definition at line 178 of file gdcmDocEntry.cxx. References gdcm::DocEntry::GetReadLength(), gdcm::DocEntry::GetVR(), and gdcm::DocEntry::IsImplicitVR(). Referenced by ComputeFullLength(). 00179 { 00180 uint32_t l = GetReadLength(); 00181 if ( IsImplicitVR() ) 00182 { 00183 l = l + 8; // 2 (gr) + 2 (el) + 4 (lgth) 00184 } 00185 else 00186 { 00187 if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" ) 00188 { 00189 l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth) 00190 } 00191 else 00192 { 00193 l = l + 8; // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth) 00194 } 00195 } 00196 return l; 00197 }
|
|
Returns the Dicom Group number of the current Dicom entry.
Definition at line 51 of file gdcmDocEntry.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::Document::FixDocEntryFoundLength(), gdcm::Document::IsDocEntryAnInteger(), gdcm::DocEntry::IsItemDelimitor(), gdcm::DocEntry::IsItemStarter(), gdcm::DocEntry::IsSequenceDelimitor(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), Print(), gdcm::Document::ReadNextDocEntry(), gdcm::Document::SkipToNextDocEntry(), gdcm::DocEntry::WriteContent(), and WriteContent(). 00051 { return DicomDict->GetGroup(); }
|
|
Returns the 'key' of the current Dicom entry.
Definition at line 57 of file gdcmDocEntry.h. Referenced by gdcm::ElementSet::AddEntry(), gdcm::Document::ParseDES(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::Validator::SetInput(), and WriteContent(). 00057 { return DicomDict->GetKey(); }
|
|
Returns the actual value length of the current Dicom entry.
Definition at line 96 of file gdcmDocEntry.h. Referenced by gdcm::Document::Backtrack(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), Copy(), gdcm::Document::DoTheLoadingDocumentJob(), gdcm::DocEntrySet::GetEntryLength(), gdcm::File::GetPixelAreaLength(), GetString(), GetValue(), GetValueCount(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), NewBinArea(), Print(), gdcm::Document::SkipDocEntry(), gdcm::DocEntry::WriteContent(), and WriteContent(). 00096 { 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 118 of file gdcmDataEntry.h. Referenced by Print(). 00118 { return MaxSizePrintEntry; }
|
|
Returns the 'Name' '(e.g. "Patient's Name") found in the Dicom Dictionnary of the current Dicom Header Entry.
Definition at line 61 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Print(). 00061 { return DicomDict->GetName(); }
|
|
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 79 of file gdcmDocEntry.h. Referenced by gdcm::Document::Backtrack(), gdcm::File::DoTheLoadingJob(), gdcm::File::GetPixelOffset(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), gdcm::SeqEntry::SeqEntry(), and gdcm::Document::SkipToNextDocEntry(). 00079 { 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 88 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::GetFullLength(), gdcm::Document::ParseDES(), gdcm::Document::ParseSQ(), gdcm::SeqEntry::Print(), gdcm::DocEntry::Print(), gdcm::Document::SkipToNextDocEntry(), and gdcm::SeqEntry::WriteContent(). 00088 { return ReadLength; }
|
|
Get the reference counting.
Definition at line 56 of file gdcmRefCounter.h. 00057 { 00058 return RefCount; 00059 }
|
|
Returns the state (Loaded, NotLoaded, ...) of the DataEntry.
Definition at line 96 of file gdcmDataEntry.h. 00096 { return State; }
|
|
returns as a string (when possible) the value of the DataEntry
Definition at line 393 of file gdcmDataEntry.cxx. References BinArea, gdcm::DocEntry::GetLength(), GetValueCount(), gdcm::DocEntry::GetVR(), and StrArea. Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::CheckVM(), gdcm::DocEntrySet::GetEntryString(), gdcm::Document::ParseDES(), Print(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), and userSuppliedLessThanFunction(). 00394 { 00395 static std::ostringstream s; 00396 const VRKey &vr = GetVR(); 00397 00398 s.str(""); 00399 StrArea=""; 00400 00401 if( !BinArea ) 00402 return StrArea; 00403 00404 // When short integer(s) are stored, convert the following (n * 2) characters 00405 // as a displayable string, the values being separated by a back-slash 00406 00407 if( vr == "US" || vr == "SS" ) 00408 { 00409 uint16_t *data=(uint16_t *)BinArea; 00410 00411 for (unsigned int i=0; i < GetValueCount(); i++) 00412 { 00413 if( i!=0 ) 00414 s << '\\'; 00415 s << data[i]; 00416 } 00417 StrArea=s.str(); 00418 } 00419 // See above comment on multiple short integers (mutatis mutandis). 00420 else if( vr == "UL" || vr == "SL" ) 00421 { 00422 uint32_t *data=(uint32_t *)BinArea; 00423 00424 for (unsigned int i=0; i < GetValueCount(); i++) 00425 { 00426 if( i!=0 ) 00427 s << '\\'; 00428 s << data[i]; 00429 } 00430 StrArea=s.str(); 00431 } 00432 else if( vr == "FL" ) 00433 { 00434 float *data=(float *)BinArea; 00435 00436 for (unsigned int i=0; i < GetValueCount(); i++) 00437 { 00438 if( i!=0 ) 00439 s << '\\'; 00440 s << data[i]; 00441 } 00442 StrArea=s.str(); 00443 } 00444 else if( vr == "FD" ) 00445 { 00446 double *data=(double *)BinArea; 00447 00448 for (unsigned int i=0; i < GetValueCount(); i++) 00449 { 00450 if( i!=0 ) 00451 s << '\\'; 00452 s << data[i]; 00453 } 00454 StrArea=s.str(); 00455 } 00456 else 00457 { 00458 StrArea.append((const char *)BinArea,GetLength()); 00459 // to avoid gdcm propagate oddities in lengthes 00460 if ( GetLength()%2) 00461 StrArea.append(" ",1); 00462 } 00463 return StrArea; 00464 }
|
|
returns, as a double (?!?) one of the values (when entry is multivaluated), identified by its index. Returns 0.0 if index is wrong FIXME : warn the user there was a problem !
Definition at line 168 of file gdcmDataEntry.cxx. References BinArea, gdcmErrorMacro, gdcm::DocEntry::GetLength(), GetValueCount(), gdcm::Global::GetVR(), gdcm::DocEntry::GetVR(), and gdcm::VR::IsVROfStringRepresentable(). Referenced by gdcm::File::GetBitsAllocated(), gdcm::File::GetBitsStored(), gdcm::File::GetHighBitPosition(), gdcm::File::GetPlanarConfiguration(), gdcm::File::GetRescaleIntercept(), gdcm::File::GetRescaleSlope(), gdcm::File::GetSamplesPerPixel(), gdcm::File::GetXOrigin(), gdcm::File::GetXSize(), gdcm::File::GetXSpacing(), gdcm::File::GetYOrigin(), gdcm::File::GetYSize(), gdcm::File::GetYSpacing(), gdcm::File::GetZOrigin(), gdcm::File::GetZSize(), gdcm::File::GetZSpacing(), and gdcm::File::IsSignedPixelData(). 00169 { 00170 if( !BinArea ) 00171 { 00172 gdcmErrorMacro("BinArea not set. Can't get the value"); 00173 return 0.0; 00174 } 00175 00176 uint32_t count = GetValueCount(); 00177 if( id > count ) 00178 { 00179 gdcmErrorMacro("Index (" << id << ")is greater than the data size"); 00180 return 0.0; 00181 } 00182 00183 // FIX the API : user *knows* that entry contains a US 00184 // and he receives a double ?!? 00185 00186 const VRKey &vr = GetVR(); 00187 if( vr == "US" || vr == "SS" ) 00188 return ((uint16_t *)BinArea)[id]; 00189 else if( vr == "UL" || vr == "SL" ) 00190 return ((uint32_t *)BinArea)[id]; 00191 else if( vr == "FL" ) 00192 return ((float *)BinArea)[id]; 00193 else if( vr == "FD" ) 00194 return ((double *)BinArea)[id]; 00195 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00196 { 00197 if( GetLength() ) 00198 { 00199 // Don't use std::string to accelerate processing 00200 double val; 00201 char *tmp = new char[GetLength()+1]; 00202 memcpy(tmp,BinArea,GetLength()); 00203 tmp[GetLength()]=0; 00204 00205 if( count == 0 ) 00206 { 00207 val = atof(tmp); 00208 } 00209 else 00210 { 00211 count = id; 00212 char *beg = tmp; 00213 for(uint32_t i=0;i<GetLength();i++) 00214 { 00215 if( tmp[i] == '\\' ) 00216 { 00217 if( count == 0 ) 00218 { 00219 tmp[i] = 0; 00220 break; 00221 } 00222 else 00223 { 00224 count--; 00225 beg = &(tmp[i+1]); 00226 } 00227 } 00228 } 00229 val = atof(beg); 00230 } 00231 00232 delete[] tmp; 00233 return val; 00234 } 00235 else 00236 return 0.0; 00237 } 00238 else 00239 return BinArea[id]; 00240 }
|
|
returns the number of elementary values
Definition at line 292 of file gdcmDataEntry.cxx. References BinArea, gdcm::DocEntry::GetLength(), gdcm::Global::GetVR(), gdcm::DocEntry::GetVR(), and gdcm::VR::IsVROfStringRepresentable(). Referenced by GetString(), GetValue(), gdcm::File::GetXOrigin(), gdcm::File::GetXSpacing(), gdcm::File::GetYOrigin(), gdcm::File::GetZOrigin(), IsValueCountValid(), and SetValue(). 00293 { 00294 const VRKey &vr = GetVR(); 00295 if( vr == "US" || vr == "SS" ) 00296 return GetLength()/sizeof(uint16_t); 00297 else if( vr == "UL" || vr == "SL" ) 00298 return GetLength()/sizeof(uint32_t); 00299 else if( vr == "FL" || vr == "OF" ) 00300 return GetLength()/4 ; // FL has a *4* length! sizeof(float); 00301 else if( vr == "FD" ) 00302 return GetLength()/8; // FD has a *8* length! sizeof(double); 00303 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00304 { 00305 // Some element in DICOM are allowed to be empty 00306 if( !GetLength() ) 00307 return 0; 00308 // Don't use std::string to accelerate processing 00309 uint32_t count = 1; 00310 for(uint32_t i=0;i<GetLength();i++) 00311 { 00312 if( BinArea[i] == '\\') 00313 count++; 00314 } 00315 return count; 00316 } 00317 return GetLength(); 00318 }
|
|
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 71 of file gdcmDocEntry.h. Referenced by gdcm::CheckVM(), and IsValueCountValid(). 00071 { return DicomDict->GetVM(); }
|
|
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 66 of file gdcmDocEntry.h. Referenced by gdcm::CheckVM(), gdcm::Document::ComputeGroup0002Length(), gdcm::DicomDirMeta::ComputeGroup0002Length(), gdcm::FileHelper::CopyDataEntry(), gdcm::File::DoTheLoadingJob(), gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntry::GetFullLength(), GetString(), GetValue(), GetValueCount(), gdcm::DocEntrySet::InsertEntryBinArea(), gdcm::DocEntrySet::InsertEntryString(), gdcm::Document::IsDocEntryAnInteger(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::Document::ParseDES(), gdcm::DocEntry::Print(), Print(), SetString(), SetValue(), and gdcm::DocEntry::WriteContent(). 00066 { return DicomDict->GetVR(); }
|
|
true if Entry value properly loaded
Definition at line 104 of file gdcmDataEntry.h. 00104 { return State == STATE_LOADED; }
|
|
Tells us if the current Dicom entry was checked as ImplicitVr.
Definition at line 112 of file gdcmDocEntry.h. References gdcm::ImplicitVR. Referenced by gdcm::DocEntry::GetFullLength(), and gdcm::SeqEntry::SeqEntry(). 00112 { return ImplicitVR; }
|
|
tells us if entry is the last one of a 'no length' SequenceItem (fffe,e00d)
Definition at line 203 of file gdcmDocEntry.cxx. References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup(). Referenced by gdcm::Document::ParseDES(). 00204 { 00205 return (GetGroup() == 0xfffe && GetElement() == 0xe00d); 00206 }
|
|
tells us if entry is the first one of an Item (fffe,e000)
Definition at line 212 of file gdcmDocEntry.cxx. References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup(). Referenced by gdcm::Document::ParseDES(). 00213 { 00214 return (GetGroup() == 0xfffe && GetElement() == 0xe000); 00215 }
|
|
true when value Entry not loaded
Definition at line 98 of file gdcmDataEntry.h. Referenced by gdcm::DocEntrySet::GetEntryString(), and Print(). 00098 { return State == STATE_NOTLOADED; }
|
|
true id Entry is a Pixel Data entry
Definition at line 112 of file gdcmDataEntry.h. Referenced by Print(). 00112 { return (Flag &FLAG_PIXELDATA) != 0; }
|
|
True if Entry owns its BinArea.
Definition at line 74 of file gdcmDataEntry.h. Referenced by gdcm::File::DoTheLoadingJob(). 00074 { return SelfArea; }
|
|
tells us if entry is the last one of a 'no length' Sequence (fffe,e0dd)
Definition at line 221 of file gdcmDocEntry.cxx. References gdcm::DocEntry::GetElement(), and gdcm::DocEntry::GetGroup(). Referenced by gdcm::Document::ParseSQ(). 00222 { 00223 return (GetGroup() == 0xfffe && GetElement() == 0xe0dd); 00224 }
|
|
true if Entry not found
Definition at line 100 of file gdcmDataEntry.h. Referenced by gdcm::DocEntrySet::GetEntryString(), and Print(). 00100 { return State == STATE_UNFOUND; }
|
|
true if Entry not read
Definition at line 102 of file gdcmDataEntry.h. Referenced by gdcm::DocEntrySet::GetEntryString(), and Print(). 00102 { return State == STATE_UNREAD; }
|
|
Checks if the multiplicity of the value follows Dictionary VM.
Definition at line 245 of file gdcmDataEntry.cxx. References GetValueCount(), and gdcm::DocEntry::GetVM(). Referenced by gdcm::File::GetXOrigin(), gdcm::File::GetYOrigin(), and gdcm::File::GetZOrigin(). 00246 { 00247 uint32_t vm; 00248 const std::string &strVM = GetVM(); 00249 uint32_t vc = GetValueCount(); 00250 bool valid = vc == 0; 00251 if( valid ) 00252 return true; 00253 00254 // FIXME : what shall we do with VM = "2-n", "3-n", etc 00255 00256 if( strVM == "1-n" ) 00257 { 00258 // make sure there is at least one ??? FIXME 00259 valid = vc >= 1; 00260 } 00261 else 00262 { 00263 std::istringstream os; 00264 os.str( strVM ); 00265 os >> vm; 00266 // Two cases: 00267 // vm respects the one from the dict 00268 // vm is 0 (we need to check if this element is allowed to be empty) FIXME 00269 00270 // note (JPR) 00271 // ---- 00272 // Entries whose type is 1 are mandatory, with a mandatory value. 00273 // Entries whose type is 1c are mandatory-inside-a-Sequence, 00274 // with a mandatory value. 00275 // Entries whose type is 2 are mandatory, with an optional value. 00276 // Entries whose type is 2c are mandatory-inside-a-Sequence, 00277 // with an optional value. 00278 // Entries whose type is 3 are optional. 00279 00280 // case vc == 0 is only applicable for 'type 2' entries. 00281 // Problem : entry type may depend on the modality and/or the Sequence 00282 // it's embedded in ! 00283 // (Get the information in the 'Conformance Statements' ...) 00284 valid = vc == vm; 00285 } 00286 return valid; 00287 }
|
|
Tells us if the VM of the current Dicom entry is Unknown.
Definition at line 120 of file gdcmDocEntry.h. 00120 { return DicomDict->IsVMUnknown(); }
|
|
Tells us if the VR of the current Dicom entry is Unknown.
Definition at line 116 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::WriteContent(). 00116 { return DicomDict->IsVRUnknown(); }
|
|
Contructs a DataEntry with a RefCounter from DocEntry.
Definition at line 44 of file gdcmDataEntry.h. 00044 {return new DataEntry(d);}
|
|
Contructs a DataEntry with a RefCounter from DictEntry.
Definition at line 42 of file gdcmDataEntry.h. Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyDataEntry(), gdcm::File::DoTheLoadingJob(), gdcm::DicomDirObject::FillObject(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DicomDir::SetElement(), gdcm::FileHelper::SetMandatoryEntry(), and gdcm::FileHelper::SetWriteToLibido(). 00042 {return new DataEntry(e);}
|
|
Creates a DataEntry owned BinArea (remove previous one if any).
Definition at line 593 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), gdcm::DocEntry::GetLength(), and SelfArea. Referenced by CopyBinArea(), SetString(), and SetValue(). 00594 { 00595 DeleteBinArea(); 00596 if( GetLength() > 0 ) 00597 BinArea = new uint8_t[GetLength()]; 00598 SelfArea = true; 00599 }
|
|
Prints a DataEntry (Dicom entry).
Reimplemented from gdcm::DocEntry. Definition at line 620 of file gdcmDataEntry.cxx. References BinArea, gdcm::Util::CreateCleanString(), gdcm::GDCM_BINLOADED, gdcm::GDCM_NOTLOADED, gdcm::GDCM_PIXELDATA, gdcm::GDCM_UNFOUND, gdcm::GDCM_UNREAD, GetBinArea(), gdcm::DocEntry::GetElement(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetLength(), GetMaxSizePrintEntry(), GetString(), gdcm::Global::GetTS(), gdcm::Global::GetVR(), gdcm::DocEntry::GetVR(), gdcm::Util::IsCleanArea(), IsNotLoaded(), IsPixelData(), IsUnfound(), IsUnread(), gdcm::VR::IsVROfStringRepresentable(), gdcm::DocEntry::Print(), and gdcm::Base::PrintLevel. 00621 { 00622 os << "D "; 00623 DocEntry::Print(os); 00624 00625 uint16_t g = GetGroup(); 00626 if (g == 0xfffe) // delimiters have NO value 00627 { 00628 return; // just to avoid identing all the remaining code 00629 } 00630 00631 std::ostringstream s; 00632 TSAtr v; 00633 00634 if( BinArea ) 00635 { 00636 v = GetString(); 00637 const VRKey &vr = GetVR(); 00638 00639 if( vr == "US" || vr == "SS" ) 00640 s << " [" << GetString() << "]"; 00641 else if( vr == "UL" || vr == "SL" ) 00642 s << " [" << GetString() << "]"; 00643 else if ( vr == "FL" ) 00644 s << " [" << GetString() << "]"; 00645 else if ( vr == "FD" ) 00646 s << " [" << GetString() << "]"; 00647 else 00648 { 00649 if(Global::GetVR()->IsVROfStringRepresentable(vr)) 00650 { 00651 // replace non printable characters by '.' 00652 std::string cleanString = Util::CreateCleanString(v); 00653 if ( cleanString.length() <= GetMaxSizePrintEntry() 00654 || PrintLevel >= 3 00655 || IsNotLoaded() ) 00656 // FIXME : when IsNotLoaded(), you create a Clean String ?!? 00657 // FIXME : PrintLevel<2 *does* print the values 00658 // (3 is only for extra offsets printing) 00659 // What do you wanted to do ? JPR 00660 { 00661 s << " [" << cleanString << "]"; 00662 } 00663 else 00664 { 00665 s << " [gdcm::too long for print (" << cleanString.length() << ") ]"; 00666 } 00667 } 00668 else 00669 { 00670 // A lot of Private elements (with no VR) contain actually 00671 // only printable characters; 00672 // Let's deal with them as is they were VR std::string representable 00673 00674 if ( Util::IsCleanArea( GetBinArea(), GetLength() ) ) 00675 { 00676 // FIXME : since the 'Area' *is* clean, just use 00677 // a 'CreateString' method, to save CPU time. 00678 std::string cleanString = 00679 Util::CreateCleanString( BinArea,GetLength() ); 00680 s << " [" << cleanString << "]"; 00681 } 00682 else 00683 { 00684 s << " [" << GDCM_BINLOADED << ";" 00685 << "length = " << GetLength() << "]"; 00686 } 00687 } 00688 } 00689 } 00690 else 00691 { 00692 if( IsNotLoaded() ) 00693 s << " [" << GDCM_NOTLOADED << "]"; 00694 else if( IsUnfound() ) 00695 s << " [" << GDCM_UNFOUND << "]"; 00696 else if( IsUnread() ) 00697 s << " [" << GDCM_UNREAD << "]"; 00698 else if ( GetLength() == 0 ) 00699 s << " []"; 00700 } 00701 00702 if( IsPixelData() ) 00703 s << " (" << GDCM_PIXELDATA << ")"; 00704 00705 // Display the UID value (instead of displaying only the rough code) 00706 // First 'clean' trailing character (space or zero) 00707 if(BinArea) 00708 { 00709 const uint16_t &gr = GetGroup(); 00710 const uint16_t &elt = GetElement(); 00711 TS *ts = Global::GetTS(); 00712 00713 if (gr == 0x0002) 00714 { 00715 // Any more to be displayed ? 00716 if ( elt == 0x0010 || elt == 0x0002 ) 00717 { 00718 if ( v.length() != 0 ) // for brain damaged headers 00719 { 00720 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00721 { 00722 v.erase(v.length()-1, 1); 00723 } 00724 } 00725 s << " ==>\t[" << ts->GetValue(v) << "]"; 00726 } 00727 } 00728 else if (gr == 0x0008) 00729 { 00730 if ( elt == 0x0016 || elt == 0x1150 ) 00731 { 00732 if ( v.length() != 0 ) // for brain damaged headers 00733 { 00734 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00735 { 00736 v.erase(v.length()-1, 1); 00737 } 00738 } 00739 s << " ==>\t[" << ts->GetValue(v) << "]"; 00740 } 00741 } 00742 else if (gr == 0x0004) 00743 { 00744 if ( elt == 0x1510 || elt == 0x1512 ) 00745 { 00746 if ( v.length() != 0 ) // for brain damaged headers 00747 { 00748 if ( ! isdigit((unsigned char)v[v.length()-1]) ) 00749 { 00750 v.erase(v.length()-1, 1); 00751 } 00752 } 00753 s << " ==>\t[" << ts->GetValue(v) << "]"; 00754 } 00755 } 00756 } 00757 00758 os << s.str(); 00759 }
|
|
Register the object.
Definition at line 44 of file gdcmRefCounter.h. Referenced by gdcm::SQItem::AddEntry(), gdcm::ElementSet::AddEntry(), gdcm::Dict::AddEntry(), gdcm::SeqEntry::AddSQItem(), gdcm::SeqEntry::Copy(), gdcm::DicomDir::Copy(), gdcm::DocEntry::DocEntry(), gdcm::FileHelper::FileHelper(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntryArchive::Push(), gdcm::Dict::ReplaceEntry(), and gdcm::SeqEntry::SetDelimitationItem(). 00044 { RefCount++; }
|
|
Sets the value (non string) of the current DataEntry.
Definition at line 82 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), SelfArea, State, and STATE_LOADED. Referenced by gdcm::FileHelper::CheckMandatoryElements(), gdcm::File::DoTheLoadingJob(), gdcm::Document::LoadDocEntry(), gdcm::Document::LoadEntryBinArea(), gdcm::DocEntrySet::SetEntryBinArea(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB(). 00083 { 00084 DeleteBinArea(); 00085 00086 BinArea = area; 00087 SelfArea = self; 00088 00089 State = STATE_LOADED; 00090 }
|
|
sets the 'pixel data flag'
Definition at line 108 of file gdcmDataEntry.h. Referenced by gdcm::ElementSet::Print(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB(). 00108 { Flag = flag; }
|
|
Sets to TRUE the ImplicitVr flag of the current Dicom entry.
Definition at line 108 of file gdcmDocEntry.h. References gdcm::ImplicitVR. Referenced by gdcm::Document::ReadNextDocEntry(). 00108 { ImplicitVR = true; }
|
|
Sets both 'Read Length' and 'Usable Length' of the current Dicom entry.
Definition at line 92 of file gdcmDocEntry.h. Referenced by gdcm::Document::Backtrack(), gdcm::FileHelper::CheckMandatoryElements(), CopyBinArea(), gdcm::Document::FixDocEntryFoundLength(), gdcm::DocEntrySet::SetEntryBinArea(), SetString(), gdcm::FileHelper::SetWriteToRaw(), and gdcm::FileHelper::SetWriteToRGB(). 00092 { Length = l; }
|
|
Header Elements too long will not be printed.
Definition at line 120 of file gdcmDataEntry.h. 00121 { MaxSizePrintEntry = size; }
|
|
Sets the offset of the Dicom entry.
Definition at line 105 of file gdcmDocEntry.h. Referenced by gdcm::Document::Backtrack(), gdcm::DicomDirObject::FillObject(), gdcm::Document::ReadNextDocEntry(), and gdcm::DicomDir::SetElement(). 00105 { Offset = of; }
|
|
Sets the print level for the Dicom Header Elements.
Definition at line 47 of file gdcmBase.h. Referenced by gdcm::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), and gdcm::DicomDir::Print(). 00047 { PrintLevel = level; }
|
|
Sets only 'Read Length' (*not* 'Usable Length') of the current Dicom entry.
Definition at line 83 of file gdcmDocEntry.h. Referenced by gdcm::Document::FixDocEntryFoundLength(). 00083 { ReadLength = l; }
|
|
Sets SelfArea.
Definition at line 72 of file gdcmDataEntry.h. Referenced by gdcm::File::DoTheLoadingJob(). 00072 { SelfArea = area; }
|
|
Sets the state (Loaded, NotLoaded, UnFound, ...) of the DataEntry.
Definition at line 94 of file gdcmDataEntry.h. Referenced by gdcm::Document::LoadDocEntry(), and gdcm::Document::LoadEntryBinArea(). 00094 { State = state; }
|
|
Sets the 'value' of a DataEntry, passed as a std::string.
Definition at line 323 of file gdcmDataEntry.cxx. References BinArea, DeleteBinArea(), gdcm::DocEntry::GetVR(), NewBinArea(), gdcm::DocEntry::SetLength(), State, STATE_LOADED, and gdcm::Util::Tokenize(). Referenced by gdcm::DicomDir::Anonymize(), gdcm::FileHelper::CheckMandatoryElements(), gdcm::FileHelper::CheckMandatoryEntry(), gdcm::FileHelper::CopyMandatoryEntry(), gdcm::DicomDirObject::FillObject(), gdcm::DicomDir::SetElement(), gdcm::DocEntrySet::SetEntryString(), gdcm::FileHelper::SetMandatoryEntry(), gdcm::FileHelper::SetWriteFileTypeToExplicitVR(), gdcm::FileHelper::SetWriteFileTypeToImplicitVR(), gdcm::FileHelper::SetWriteFileTypeToJPEG(), gdcm::FileHelper::SetWriteToLibido(), gdcm::FileHelper::SetWriteToNoLibido(), gdcm::FileHelper::SetWriteToRaw(), gdcm::FileHelper::SetWriteToRGB(), gdcm::File::Write(), and gdcm::DicomDirMeta::WriteContent(). 00324 { 00325 DeleteBinArea(); 00326 00327 const VRKey &vr = GetVR(); 00328 if ( vr == "US" || vr == "SS" ) 00329 { 00330 std::vector<std::string> tokens; 00331 Util::Tokenize (value, tokens, "\\"); 00332 SetLength(tokens.size()*sizeof(uint16_t)); 00333 NewBinArea(); 00334 00335 uint16_t *data = (uint16_t *)BinArea; 00336 for (unsigned int i=0; i<tokens.size();i++) 00337 data[i] = atoi(tokens[i].c_str()); 00338 tokens.clear(); 00339 } 00340 else if ( vr == "UL" || vr == "SL" ) 00341 { 00342 std::vector<std::string> tokens; 00343 Util::Tokenize (value, tokens, "\\"); 00344 SetLength(tokens.size()*sizeof(uint32_t)); 00345 NewBinArea(); 00346 00347 uint32_t *data = (uint32_t *)BinArea; 00348 for (unsigned int i=0; i<tokens.size();i++) 00349 data[i] = atoi(tokens[i].c_str()); 00350 tokens.clear(); 00351 } 00352 else if ( vr == "FL" ) 00353 { 00354 std::vector<std::string> tokens; 00355 Util::Tokenize (value, tokens, "\\"); 00356 SetLength(tokens.size()*sizeof(float)); 00357 NewBinArea(); 00358 00359 float *data = (float *)BinArea; 00360 for (unsigned int i=0; i<tokens.size();i++) 00361 data[i] = (float)atof(tokens[i].c_str()); 00362 tokens.clear(); 00363 } 00364 else if ( vr == "FD" ) 00365 { 00366 std::vector<std::string> tokens; 00367 Util::Tokenize (value, tokens, "\\"); 00368 SetLength(tokens.size()*sizeof(double)); 00369 NewBinArea(); 00370 00371 double *data = (double *)BinArea; 00372 for (unsigned int i=0; i<tokens.size();i++) 00373 data[i] = atof(tokens[i].c_str()); 00374 tokens.clear(); 00375 } 00376 else 00377 { 00378 if( value.size() > 0 ) 00379 { 00380 size_t l = value.size(); 00381 SetLength(l + l%2); 00382 NewBinArea(); 00383 memcpy(BinArea, value.c_str(), l); 00384 if (l%2) 00385 BinArea[l] = '\0'; 00386 } 00387 } 00388 State = STATE_LOADED; 00389 }
|
|
Inserts the elementary (non string) value into the current DataEntry.
Definition at line 119 of file gdcmDataEntry.cxx. References BinArea, gdcmErrorMacro, GetValueCount(), gdcm::Global::GetVR(), gdcm::DocEntry::GetVR(), gdcm::VR::IsVROfStringRepresentable(), NewBinArea(), State, and STATE_LOADED. 00120 { 00121 if( !BinArea ) 00122 NewBinArea(); 00123 State = STATE_LOADED; 00124 00125 if( id > GetValueCount() ) 00126 { 00127 gdcmErrorMacro("Index (" << id << ")is greater than the data size"); 00128 return; 00129 } 00130 00131 const VRKey &vr = GetVR(); 00132 if( vr == "US" || vr == "SS" ) 00133 { 00134 uint16_t *data = (uint16_t *)BinArea; 00135 data[id] = (uint16_t)val; 00136 } 00137 else if( vr == "UL" || vr == "SL" ) 00138 { 00139 uint32_t *data = (uint32_t *)BinArea; 00140 data[id] = (uint32_t)val; 00141 } 00142 else if( vr == "FL" ) 00143 { 00144 float *data = (float *)BinArea; 00145 data[id] = (float)val; 00146 } 00147 else if( vr == "FD" ) 00148 { 00149 double *data = (double *)BinArea; 00150 data[id] = (double)val; 00151 } 00152 else if( Global::GetVR()->IsVROfStringRepresentable(vr) ) 00153 { 00154 gdcmErrorMacro("SetValue on String representable not implemented yet"); 00155 } 00156 else 00157 { 00158 BinArea[id] = (uint8_t)val; 00159 } 00160 }
|
|
Sets the 'Value Multiplicity' of the current Dicom entry.
Definition at line 74 of file gdcmDocEntry.h. 00074 { DicomDict->SetVM(v); }
|
|
Unregister the object.
Definition at line 48 of file gdcmRefCounter.h. Referenced by gdcm::SeqEntry::ClearSQItem(), gdcm::DicomDir::Copy(), gdcm::DocEntrySet::GetDictEntry(), gdcm::CommandManager::InSetCommand(), gdcm::DocEntrySet::NewDataEntry(), gdcm::DocEntrySet::NewSeqEntry(), gdcm::Document::ReadNextDocEntry(), gdcm::SQItem::RemoveEntry(), gdcm::ElementSet::RemoveEntry(), gdcm::SeqEntry::SetDelimitationItem(), gdcm::DocEntry::~DocEntry(), and gdcm::FileHelper::~FileHelper().
|
|
Writes the 'value' area of a DataEntry.
Reimplemented from gdcm::DocEntry. Definition at line 489 of file gdcmDataEntry.cxx. References BinArea, gdcm::binary_write(), gdcmDebugMacro, gdcm::VR::GetAtomicElementLength(), gdcm::DocEntry::GetGroup(), gdcm::DocEntry::GetKey(), gdcm::DocEntry::GetLength(), gdcm::Global::GetVR(), and gdcm::DocEntry::WriteContent(). 00490 { 00491 DocEntry::WriteContent(fp, filetype); 00492 00493 if ( GetGroup() == 0xfffe ) 00494 { 00495 return; //delimitors have NO value 00496 } 00497 00498 // --> We only deal with Little Endian writting. 00499 // --> forget Big Endian Transfer Syntax writting! 00500 // Next DICOM version will give it up ... 00501 00502 // WARNING - For Implicit VR private element, 00503 // we have *no choice* but considering them as 00504 // something like 'OB' values. 00505 // we rewrite them as we found them on disc. 00506 // Some trouble will occur if element was 00507 // *actually* OW, if image was produced 00508 // on Big endian based processor, read and writen 00509 // on Little endian based processor 00510 // and, later on, somebody needs 00511 // this 'OW' Implicit VR private element (?!?) 00512 // (Same stuff, mutatis mutandis, for Little/Big) 00513 00514 // 8/16 bits Pixels problem should be solved automatiquely, 00515 // since we ensure the VR (OB vs OW) is conform to Pixel size. 00516 00517 uint8_t *data = BinArea; //safe notation 00518 size_t l = GetLength(); 00519 gdcmDebugMacro("in DataEntry::WriteContent " << GetKey() << " AtomicLength: " 00520 << Global::GetVR()->GetAtomicElementLength(this->GetVR() ) // << " BinArea in :" << &BinArea 00521 ); 00522 if (BinArea) // the binArea was *actually* loaded 00523 { 00524 #if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) 00525 unsigned short vrLgth = 00526 Global::GetVR()->GetAtomicElementLength(this->GetVR()); 00527 unsigned int i; 00528 switch(vrLgth) 00529 { 00530 case 1: 00531 { 00532 binary_write (*fp, data, l ); 00533 break; 00534 } 00535 case 2: 00536 { 00537 uint16_t *data16 = (uint16_t *)data; 00538 for(i=0;i<l/vrLgth;i++) 00539 binary_write( *fp, data16[i]); 00540 break; 00541 } 00542 case 4: 00543 { 00544 uint32_t *data32 = (uint32_t *)data; 00545 for(i=0;i<l/vrLgth;i++) 00546 binary_write( *fp, data32[i]); 00547 break; 00548 } 00549 case 8: 00550 { 00551 double *data64 = (double *)data; 00552 for(i=0;i<l/vrLgth;i++) 00553 binary_write( *fp, data64[i]); 00554 break; 00555 } 00556 } 00557 #else 00558 binary_write (*fp, data, l ); 00559 #endif //GDCM_WORDS_BIGENDIAN 00560 00561 } 00562 else 00563 { 00564 // nothing was loaded, but we need to skip space on disc 00565 if (l != 0) 00566 { 00567 // --> WARNING : nothing is written; 00568 // --> the initial data (on the the source image) is lost 00569 // --> user is *not* informed ! 00570 gdcmDebugMacro ("Nothing was loaded, but we need to skip space on disc. " 00571 << "Length =" << l << " for " << GetKey() ); 00572 fp->seekp(l, std::ios::cur); 00573 } 00574 } 00575 // to avoid gdcm to propagate oddities 00576 // (length was already modified) 00577 if (l%2) 00578 fp->seekp(1, std::ios::cur); 00579 }
|
|
memory area to hold 'non std::string' representable values (ie : Lookup Tables, overlays, icons)
Definition at line 135 of file gdcmDataEntry.h. Referenced by Copy(), CopyBinArea(), DataEntry(), DeleteBinArea(), GetString(), GetValue(), GetValueCount(), NewBinArea(), Print(), SetBinArea(), SetString(), SetValue(), and WriteContent(). |
|
pointer to the underlying Dicom dictionary element
Definition at line 133 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::DocEntry(), and gdcm::DocEntry::~DocEntry(). |
|
0 for straight entries, FLAG_PIXELDATA for Pixel Data entries
Definition at line 144 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 145 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Copy(), gdcm::DocEntry::DocEntry(), and gdcm::SeqEntry::SeqEntry(). |
|
Correspond to the real length of the data This length might always be even.
Definition at line 137 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Copy(), gdcm::DocEntry::DocEntry(), and gdcm::SeqEntry::SeqEntry(). |
|
Size threshold above which an element is printed.
Definition at line 149 of file gdcmDataEntry.h. |
|
Offset from the beginning of file for direct user access.
Definition at line 148 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Copy(), gdcm::DocEntry::DocEntry(), and gdcm::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::SQItem::Print(), gdcm::SeqEntry::Print(), gdcm::FileHelper::Print(), gdcm::ElementSet::Print(), gdcm::DocEntry::Print(), gdcm::DictEntry::Print(), gdcm::DicomDirStudy::Print(), gdcm::DicomDirSerie::Print(), gdcm::DicomDirPatient::Print(), gdcm::DicomDirMeta::Print(), gdcm::DicomDir::Print(), and Print(). |
|
Length to read in the file to obtain data.
Definition at line 140 of file gdcmDocEntry.h. Referenced by gdcm::DocEntry::Copy(), gdcm::DocEntry::DocEntry(), and gdcm::SeqEntry::SeqEntry(). |
|
Whether DataEntry has its own BinArea or not.
Definition at line 137 of file gdcmDataEntry.h. Referenced by DataEntry(), DeleteBinArea(), NewBinArea(), and SetBinArea(). |
|
Entry status:STATE_NOTLOADED,STATE_UNFOUND,STATE_UNREAD,STATE_LOADED.
Definition at line 146 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 140 of file gdcmDataEntry.h. Referenced by GetString(). |