1 /*=========================================================================
4 Module: $RCSfile: gdcmBinEntry.cxx,v $
6 Date: $Date: 2004/10/12 04:35:44 $
7 Version: $Revision: 1.33 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmBinEntry.h"
20 #include "gdcmDebug.h"
25 //-----------------------------------------------------------------------------
26 // Constructor / Destructor
29 * \brief Constructor from a given BinEntry
31 BinEntry::BinEntry(DictEntry* e) : ValEntry(e)
37 * \brief Constructor from a given BinEntry
38 * @param e Pointer to existing Doc entry
40 BinEntry::BinEntry(DocEntry* e) : ValEntry(e->GetDictEntry())
42 UsableLength = e->GetLength();
43 ReadLength = e->GetReadLength();
44 ImplicitVR = e->IsImplicitVR();
45 Offset = e->GetOffset();
46 PrintLevel = e->GetPrintLevel();
48 //SQDepthLevel = e->GetDepthLevel();
50 BinArea = 0; // let's be carefull !
54 * \brief Canonical destructor.
61 BinArea = 0; // let's be carefull !
66 //-----------------------------------------------------------------------------
69 * \brief canonical Printer
72 void BinEntry::Print(std::ostream &os)
76 void* binArea = GetBinArea();
79 //s << " [" << GDCM_BINLOADED
80 s << " [" << GetValue()
81 << "; length = " << GetLength() << "]";
85 if ( GetLength() == 0 )
91 //s << " [gdcm::Binary data NOT loaded]";
92 s << " [" <<GetValue() << "]";
100 * \brief canonical Writer
101 * @param fp already open file pointer
102 * @param filetype type of the file to be written
104 void BinEntry::Write(FILE* fp, FileType filetype)
106 DocEntry::Write(fp, filetype);
107 void* binArea = GetBinArea();
108 int lgr = GetLength();
111 // there is a 'non string' LUT, overlay, etc
112 fwrite ( binArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
116 // nothing was loaded, but we need to skip space on disc
117 fseek(fp,(size_t)lgr,SEEK_CUR);
120 //-----------------------------------------------------------------------------
124 /// \brief Sets the value (non string) of the current Dicom Header Entry
125 void BinEntry::SetBinArea( uint8_t* area )
132 //-----------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------
138 //-----------------------------------------------------------------------------
139 } // end namespace gdcm