2 //-----------------------------------------------------------------------------
3 #include "gdcmHeader.h"
7 #include <cctype> // for isalpha
13 //-----------------------------------------------------------------------------
14 // Constructor / Destructor
19 * @param exception_on_error
20 * @param enable_sequences = true to allow the header
21 * to be parsed *inside* the SeQuences,
22 * when they have an actual length
23 * @param ignore_shadow = true if user wants to skip shadow groups
24 * during parsing, to save memory space
26 gdcmHeader::gdcmHeader(const char *InFilename,
27 bool exception_on_error,
28 bool enable_sequences,
30 gdcmParser(InFilename,exception_on_error,enable_sequences,ignore_shadow)
33 // for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
34 // We may encounter the 'RETired' (0x0028, 0x0200) tag
35 // (Image Location") . This Element contains the number of
36 // the group that contains the pixel data (hence the "Pixel Data"
37 // is found by indirection through the "Image Location").
38 // Inside the group pointed by "Image Location" the searched element
39 // is conventionally the element 0x0010 (when the norm is respected).
40 // When the "Image Location" is absent we default to group 0x7fe0.
42 // This IS the right place for the code
44 std::string ImageLocation = GetEntryByNumber(0x0028, 0x0200);
45 if ( ImageLocation == GDCM_UNFOUND ) { // Image Location
46 GrPixel = 0x7fe0; // default value
48 GrPixel = (guint16) atoi( ImageLocation.c_str() );
50 if (GrPixel == 0xe07f) // sometimes Image Location value doesn't follow
51 GrPixel = 0x7fe0; // the supposed processor endianity.
52 // see gdcmData/cr172241.dcm
53 if (GrPixel != 0x7fe0)
54 // This is a kludge for old dirty Philips imager.
59 TagKey key = gdcmDictEntry::TranslateToKey(GrPixel, NumPixel);
60 countGrPixel = GetEntry().count(key);
66 * @param exception_on_error
68 gdcmHeader::gdcmHeader(bool exception_on_error) :
69 gdcmParser(exception_on_error)
75 * \brief Canonical destructor.
77 gdcmHeader::~gdcmHeader (void) {
80 //-----------------------------------------------------------------------------
84 //-----------------------------------------------------------------------------
89 * \brief This predicate, based on hopefully reasonable heuristics,
90 * decides whether or not the current gdcmParser was properly parsed
91 * and contains the mandatory information for being considered as
92 * a well formed and usable Dicom/Acr File.
93 * @return true when gdcmParser is the one of a reasonable Dicom/Acr file,
96 bool gdcmHeader::IsReadable(void) {
97 if(!gdcmParser::IsReadable()) {
100 std::string res = GetEntryByNumber(0x0028, 0x0005);
101 if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
102 return false; // Image Dimensions
103 if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
104 return false; // "Bits Allocated"
105 if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
106 return false; // "Bits Stored"
107 if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
108 return false; // "High Bit"
109 if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
110 return false; // "Pixel Representation" i.e. 'Sign'
115 * \ingroup gdcmHeader
116 * \brief Determines if the Transfer Syntax was already encountered
117 * and if it corresponds to a JPEGBaseLineProcess1 one.
118 * @return True when JPEGBaseLineProcess1found. False in all other cases.
120 bool gdcmHeader::IsJPEGBaseLineProcess1TransferSyntax(void) {
121 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
124 LoadHeaderEntrySafe(Element);
126 std::string Transfer = Element->GetValue();
127 if ( Transfer == "1.2.840.10008.1.2.4.50" )
133 * \ingroup gdcmHeader
134 * \brief Determines if the Transfer Syntax was already encountered
135 * and if it corresponds to a JPEGExtendedProcess2-4 one.
136 * @return True when JPEGExtendedProcess2-4 found. False in all other cases.
138 bool gdcmHeader::IsJPEGExtendedProcess2_4TransferSyntax(void) {
139 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
142 LoadHeaderEntrySafe(Element);
143 return ( Element->GetValue() == "1.2.840.10008.1.2.4.51" );
147 * \ingroup gdcmHeader
148 * \brief Determines if the Transfer Syntax was already encountered
149 * and if it corresponds to a JPEGExtendeProcess3-5 one.
150 * @return True when JPEGExtendedProcess3-5 found. False in all other cases.
152 bool gdcmHeader::IsJPEGExtendedProcess3_5TransferSyntax(void) {
153 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
156 LoadHeaderEntrySafe(Element);
158 std::string Transfer = Element->GetValue();
159 if ( Transfer == "1.2.840.10008.1.2.4.52" )
165 * \ingroup gdcmHeader
166 * \brief Determines if the Transfer Syntax was already encountered
167 * and if it corresponds to a JPEGSpectralSelectionProcess6-8 one.
168 * @return True when JPEGSpectralSelectionProcess6-8 found. False in all
171 bool gdcmHeader::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) {
172 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
175 LoadHeaderEntrySafe(Element);
177 std::string Transfer = Element->GetValue();
178 if ( Transfer == "1.2.840.10008.1.2.4.53" )
184 * \ingroup gdcmHeader
185 * \brief Determines if the Transfer Syntax was already encountered
186 * and if it corresponds to a RLE Lossless one.
187 * @return True when RLE Lossless found. False in all
190 bool gdcmHeader::IsRLELossLessTransferSyntax(void) {
191 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
194 LoadHeaderEntrySafe(Element);
196 std::string Transfer = Element->GetValue();
197 if ( Transfer == "1.2.840.10008.1.2.5" ) {
204 * \ingroup gdcmHeader
205 * \brief Determines if Transfer Syntax was already encountered
206 * and if it corresponds to a JPEG Lossless one.
207 * @return True when RLE Lossless found. False in all
210 bool gdcmHeader::IsJPEGLossless(void) {
211 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
212 // faire qq chose d'intelligent a la place de ça
215 LoadHeaderEntrySafe(Element);
217 const char * Transfert = Element->GetValue().c_str();
218 if ( memcmp(Transfert+strlen(Transfert)-2 ,"70",2)==0) return true;
219 if ( memcmp(Transfert+strlen(Transfert)-2 ,"55",2)==0) return true;
220 if (Element->GetValue() == "1.2.840.10008.1.2.4.57") return true;
226 * \ingroup gdcmHeader
227 * \brief Determines if the Transfer Syntax was already encountered
228 * and if it corresponds to a JPEG2000 one
229 * @return True when JPEG2000 (Lossly or LossLess) found. False in all
232 bool gdcmHeader::IsJPEG2000(void) {
233 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
236 LoadHeaderEntrySafe(Element);
238 std::string Transfer = Element->GetValue();
239 if ( (Transfer == "1.2.840.10008.1.2.4.90")
240 || (Transfer == "1.2.840.10008.1.2.4.91") )
246 * \ingroup gdcmHeader
247 * \brief Predicate for dicom version 3 file.
248 * @return True when the file is a dicom version 3.
250 bool gdcmHeader::IsDicomV3(void) {
251 // Checking if Transfert Syntax exists is enough
252 // Anyway, it's to late check if the 'Preamble' was found ...
253 // And ... would it be a rich idea to check ?
254 // (some 'no Preamble' DICOM images exist !)
255 return (GetHeaderEntryByNumber(0x0002, 0x0010) != NULL);
259 * \ingroup gdcmHeader
260 * \brief Retrieve the number of columns of image.
261 * @return The encountered size when found, 0 by default.
262 * 0 means the file is NOT USABLE. The caller will have to check
264 int gdcmHeader::GetXSize(void) {
266 StrSize = GetEntryByNumber(0x0028,0x0011);
267 if (StrSize == GDCM_UNFOUND)
269 return atoi(StrSize.c_str());
273 * \ingroup gdcmHeader
274 * \brief Retrieve the number of lines of image.
275 * \warning The defaulted value is 1 as opposed to gdcmHeader::GetXSize()
276 * @return The encountered size when found, 1 by default
277 * (The ACR-MEMA file contains a Signal, not an Image).
279 int gdcmHeader::GetYSize(void) {
280 std::string StrSize = GetEntryByNumber(0x0028,0x0010);
281 if (StrSize != GDCM_UNFOUND)
282 return atoi(StrSize.c_str());
286 // The Rows (0028,0010) entry was optional for ACR/NEMA. It might
287 // hence be a signal (1d image). So we default to 1:
292 * \ingroup gdcmHeader
293 * \brief Retrieve the number of planes of volume or the number
294 * of frames of a multiframe.
295 * \warning When present we consider the "Number of Frames" as the third
296 * dimension. When absent we consider the third dimension as
297 * being the ACR-NEMA "Planes" tag content.
298 * @return The encountered size when found, 1 by default (single image).
300 int gdcmHeader::GetZSize(void) {
301 // Both DicomV3 and ACR/Nema consider the "Number of Frames"
302 // as the third dimension.
303 std::string StrSize = GetEntryByNumber(0x0028,0x0008);
304 if (StrSize != GDCM_UNFOUND)
305 return atoi(StrSize.c_str());
307 // We then consider the "Planes" entry as the third dimension
308 StrSize = GetEntryByNumber(0x0028,0x0012);
309 if (StrSize != GDCM_UNFOUND)
310 return atoi(StrSize.c_str());
315 * \ingroup gdcmHeader
316 * \brief Retrieve the number of Bits Stored (actually used)
317 * (as opposite to number of Bits Allocated)
318 * @return The encountered number of Bits Stored, 0 by default.
319 * 0 means the file is NOT USABLE. The caller has to check it !
321 int gdcmHeader::GetBitsStored(void) {
322 std::string StrSize = GetEntryByNumber(0x0028,0x0101);
323 if (StrSize == GDCM_UNFOUND)
324 return 0; // It's supposed to be mandatory
325 // the caller will have to check
326 return atoi(StrSize.c_str());
330 * \ingroup gdcmHeader
331 * \brief Retrieve the number of Bits Allocated
332 * (8, 12 -compacted ACR-NEMA files, 16, ...)
333 * @return The encountered number of Bits Allocated, 0 by default.
334 * 0 means the file is NOT USABLE. The caller has to check it !
336 int gdcmHeader::GetBitsAllocated(void) {
337 std::string StrSize = GetEntryByNumber(0x0028,0x0100);
338 if (StrSize == GDCM_UNFOUND)
339 return 0; // It's supposed to be mandatory
340 // the caller will have to check
341 return atoi(StrSize.c_str());
345 * \ingroup gdcmHeader
346 * \brief Retrieve the number of Samples Per Pixel
347 * (1 : gray level, 3 : RGB -1 or 3 Planes-)
348 * @return The encountered number of Samples Per Pixel, 1 by default.
349 * (Gray level Pixels)
351 int gdcmHeader::GetSamplesPerPixel(void) {
352 std::string StrSize = GetEntryByNumber(0x0028,0x0002);
353 if (StrSize == GDCM_UNFOUND)
354 return 1; // Well, it's supposed to be mandatory ...
355 // but sometimes it's missing : *we* assume Gray pixels
356 return atoi(StrSize.c_str());
360 * \ingroup gdcmHeader
361 * \brief Retrieve the Planar Configuration for RGB images
362 * (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane)
363 * @return The encountered Planar Configuration, 0 by default.
365 int gdcmHeader::GetPlanarConfiguration(void) {
366 std::string StrSize = GetEntryByNumber(0x0028,0x0006);
367 if (StrSize == GDCM_UNFOUND)
369 return atoi(StrSize.c_str());
373 * \ingroup gdcmHeader
374 * \brief Return the size (in bytes) of a single pixel of data.
375 * @return The size in bytes of a single pixel of data; 0 by default
376 * 0 means the file is NOT USABLE; the caller will have to check
378 int gdcmHeader::GetPixelSize(void) {
379 std::string PixelType = GetPixelType();
380 if (PixelType == "8U" || PixelType == "8S")
382 if (PixelType == "16U" || PixelType == "16S")
384 if (PixelType == "32U" || PixelType == "32S")
386 if (PixelType == "FD")
388 dbg.Verbose(0, "gdcmHeader::GetPixelSize: Unknown pixel type");
393 * \ingroup gdcmHeader
394 * \brief Build the Pixel Type of the image.
395 * Possible values are:
396 * - 8U unsigned 8 bit,
398 * - 16U unsigned 16 bit,
399 * - 16S signed 16 bit,
400 * - 32U unsigned 32 bit,
401 * - 32S signed 32 bit,
402 * - FD floating double 64 bits (Not kosher DICOM, but so usefull!)
403 * \warning 12 bit images appear as 16 bit.
404 * \ 24 bit images appear as 8 bit
405 * @return 0S if nothing found. NOT USABLE file. The caller has to check
407 std::string gdcmHeader::GetPixelType(void) {
408 std::string BitsAlloc = GetEntryByNumber(0x0028, 0x0100); // Bits Allocated
409 if (BitsAlloc == GDCM_UNFOUND) {
410 dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated");
411 BitsAlloc = std::string("16");
413 if (BitsAlloc == "64") // )
415 if (BitsAlloc == "12") // It will be unpacked
416 BitsAlloc = std::string("16");
417 else if (BitsAlloc == "24") // (in order no to be messed up
418 BitsAlloc = std::string("8"); // by old RGB images)
420 std::string Signed = GetEntryByNumber(0x0028, 0x0103); // "Pixel Representation"
421 if (Signed == GDCM_UNFOUND) {
422 dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation");
423 BitsAlloc = std::string("0");
426 Signed = std::string("U");
428 Signed = std::string("S");
430 return( BitsAlloc + Signed);
435 * \ingroup gdcmHeader
436 * \brief Recover the offset (from the beginning of the file)
437 * \ of *image* pixels (not *icone image* pixels, if any !)
438 * @return Pixel Offset
440 size_t gdcmHeader::GetPixelOffset(void) {
442 // If the element (0x0088,0x0200) 'icone image sequence' is found
443 // (grPixel,numPixel) is stored twice : the first one for the icon
444 // the second one for the image ...
445 // pb : sometimes , (0x0088,0x0200) exists, but doesn't contain *anything*
446 // see gdcmData/MxTwinLossLess.dcm ...
448 //std::string icone = GetEntryByNumber(0x0088,0x0200); //icone image sequence
450 IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);
451 TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
452 gdcmHeaderEntry* PixelElement;
453 if (countGrPixel == 1)
454 PixelElement = (it.first)->second;
456 PixelElement = (++it.first)->second; // hope there are no more than 2 !
459 return PixelElement->GetOffset();
462 std::cout << "Big trouble : Pixel Element ("
463 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found"
467 // TODO : unify those two (previous one and next one)
469 * \ingroup gdcmHeader
470 * \brief Recover the pixel area length (in Bytes)
471 * @return Pixel Element Length, as stored in the header
472 * (NOT the memory space necessary to hold the Pixels
473 * - in case of embeded compressed image-)
474 * 0 : NOT USABLE file. The caller has to check.
476 size_t gdcmHeader::GetPixelAreaLength(void) {
478 IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);
479 TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
480 gdcmHeaderEntry* PixelElement;
483 PixelElement = (it.first)->second;
485 PixelElement = (++it.first)->second;
488 return PixelElement->GetLength();
490 std::cout << "Big trouble : Pixel Element ("
491 << std::hex << GrPixel<<","<< NumPixel<< ") NOT found"
498 * \ingroup gdcmHeader
499 * \brief tells us if LUT are used
500 * \warning Right now, 'Segmented xxx Palette Color Lookup Table Data'
501 * \ are NOT considered as LUT, since nobody knows
502 * \ how to deal with them
503 * \ Please warn me if you know sbdy that *does* know ... jprx
504 * @return true if LUT Descriptors and LUT Tables were found
506 bool gdcmHeader::HasLUT(void) {
508 // Check the presence of the LUT Descriptors, and LUT Tables
510 if ( !GetHeaderEntryByNumber(0x0028,0x1101) )
512 // LutDescriptorGreen
513 if ( !GetHeaderEntryByNumber(0x0028,0x1102) )
516 if ( !GetHeaderEntryByNumber(0x0028,0x1103) )
518 // Red Palette Color Lookup Table Data
519 if ( !GetHeaderEntryByNumber(0x0028,0x1201) )
521 // Green Palette Color Lookup Table Data
522 if ( !GetHeaderEntryByNumber(0x0028,0x1202) )
524 // Blue Palette Color Lookup Table Data
525 if ( !GetHeaderEntryByNumber(0x0028,0x1203) )
531 * \ingroup gdcmHeader
532 * \brief gets the info from 0028,1101 : Lookup Table Desc-Red
534 * @return Lookup Table number of Bits , 0 by default
535 * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
536 * @ return bit number of each LUT item
538 int gdcmHeader::GetLUTNbits(void) {
539 std::vector<std::string> tokens;
543 //Just hope Lookup Table Desc-Red = Lookup Table Desc-Red = Lookup Table Desc-Blue
544 // Consistency already checked in GetLUTLength
545 std::string LutDescription = GetEntryByNumber(0x0028,0x1101);
546 if (LutDescription == GDCM_UNFOUND)
548 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
549 Tokenize (LutDescription, tokens, "\\");
550 //LutLength=atoi(tokens[0].c_str());
551 //LutDepth=atoi(tokens[1].c_str());
552 LutNbits=atoi(tokens[2].c_str());
558 * \ingroup gdcmHeader
559 * \brief builts Red/Green/Blue/Alpha LUT from Header
560 * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
561 * \ and (0028,1101),(0028,1102),(0028,1102)
562 * \ - xxx Palette Color Lookup Table Descriptor - are found
563 * \ and (0028,1201),(0028,1202),(0028,1202)
564 * \ - xxx Palette Color Lookup Table Data - are found
565 * \warning does NOT deal with :
566 * \ 0028 1100 Gray Lookup Table Descriptor (Retired)
567 * \ 0028 1221 Segmented Red Palette Color Lookup Table Data
568 * \ 0028 1222 Segmented Green Palette Color Lookup Table Data
569 * \ 0028 1223 Segmented Blue Palette Color Lookup Table Data
570 * \ no known Dicom reader deals with them :-(
571 * @return a RGBA Lookup Table
573 unsigned char * gdcmHeader::GetLUTRGBA(void) {
575 // http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
577 // if Photometric Interpretation # PALETTE COLOR, no LUT to be done
578 if (GetEntryByNumber(0x0028,0x0004) != "PALETTE COLOR ") {
581 int lengthR, debR, nbitsR;
582 int lengthG, debG, nbitsG;
583 int lengthB, debB, nbitsB;
585 // Get info from Lut Descriptors
586 // (the 3 LUT descriptors may be different)
587 std::string LutDescriptionR = GetEntryByNumber(0x0028,0x1101);
588 if (LutDescriptionR == GDCM_UNFOUND)
590 std::string LutDescriptionG = GetEntryByNumber(0x0028,0x1102);
591 if (LutDescriptionG == GDCM_UNFOUND)
593 std::string LutDescriptionB = GetEntryByNumber(0x0028,0x1103);
594 if (LutDescriptionB == GDCM_UNFOUND)
597 std::vector<std::string> tokens;
599 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
600 Tokenize (LutDescriptionR, tokens, "\\");
601 lengthR=atoi(tokens[0].c_str()); // Red LUT length in Bytes
602 debR =atoi(tokens[1].c_str()); // subscript of the first Lut Value
603 nbitsR =atoi(tokens[2].c_str()); // Lut item size (in Bits)
606 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
607 Tokenize (LutDescriptionG, tokens, "\\");
608 lengthG=atoi(tokens[0].c_str()); // Green LUT length in Bytes
609 debG =atoi(tokens[1].c_str()); // subscript of the first Lut Value
610 nbitsG =atoi(tokens[2].c_str()); // Lut item size (in Bits)
613 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
614 Tokenize (LutDescriptionB, tokens, "\\");
615 lengthB=atoi(tokens[0].c_str()); // Blue LUT length in Bytes
616 debB =atoi(tokens[1].c_str()); // subscript of the first Lut Value
617 nbitsB =atoi(tokens[2].c_str()); // Lut item size (in Bits)
620 // Load LUTs into memory, (as they were stored on disk)
621 unsigned char *lutR = (unsigned char *)
622 GetEntryVoidAreaByNumber(0x0028,0x1201);
623 unsigned char *lutG = (unsigned char *)
624 GetEntryVoidAreaByNumber(0x0028,0x1202);
625 unsigned char *lutB = (unsigned char *)
626 GetEntryVoidAreaByNumber(0x0028,0x1203);
628 if (!lutR || !lutG || !lutB ) {
631 // forge the 4 * 8 Bits Red/Green/Blue/Alpha LUT
633 unsigned char *LUTRGBA = (unsigned char *)calloc(1024,1); // 256 * 4 (R, G, B, Alpha)
637 memset(LUTRGBA, 0, 1024);
640 std::string str_nb = GetEntryByNumber(0x0028,0x0100);
641 if (str_nb == GDCM_UNFOUND ) {
644 nb = atoi(str_nb.c_str() );
648 if (nbitsR==16 && nb==8) // when LUT item size is different than pixel size
649 mult=2; // high byte must be = low byte
650 else // See PS 3.3-2003 C.11.1.1.2 p 619
653 // if we get a black image, let's just remove the '+1'
654 // from 'i*mult+1' and check again
655 // if it works, we shall have to check the 3 Palettes
656 // to see which byte is ==0 (first one, or second one)
658 // We give up the checking to avoid some (useless ?)overhead
659 // (optimistic asumption)
664 for(i=0;i<lengthR;i++) {
669 for(i=0;i<lengthG;i++) {
674 for(i=0;i<lengthB;i++) {
680 *a = 1; // Alpha component
684 //How to free the now useless LUTs?
685 //free(LutR); free(LutB); free(LutG); // Seg Fault when used
690 * \ingroup gdcmHeader
691 * \brief gets the info from 0002,0010 : Transfert Syntax
693 * @return Transfert Syntax Name (as oposite to Transfert Syntax UID)
695 std::string gdcmHeader::GetTransfertSyntaxName(void) {
696 // use the gdcmTS (TS : Transfert Syntax)
697 std::string TransfertSyntax = GetEntryByNumber(0x0002,0x0010);
698 if (TransfertSyntax == GDCM_UNFOUND) {
699 dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName: unfound Transfert Syntax (0002,0010)");
700 return "Uncompressed ACR-NEMA";
702 // we do it only when we need it
703 gdcmTS * ts = gdcmGlobal::GetTS();
704 std::string tsName=ts->GetValue(TransfertSyntax);
705 //delete ts; // Seg Fault when deleted ?!
710 * \ingroup gdcmHeader
711 * \brief Sets the Pixel Area size in the Header
712 * --> not-for-rats function
713 * @param ImageDataSize new Pixel Area Size
714 * warning : nothing else is checked
716 void gdcmHeader::SetImageDataSize(size_t ImageDataSize) {
717 std::string content1;
720 // Assumes HeaderEntry (GrPixel, NumPixel) is unique ...
721 // TODO deal with multiplicity (see gdcmData/icone.dcm)
722 sprintf(car,"%d",ImageDataSize);
724 gdcmHeaderEntry *a = GetHeaderEntryByNumber(GrPixel, NumPixel);
725 a->SetLength(ImageDataSize);
728 sprintf(car,"%d",ImageDataSize);
730 SetEntryByNumber(content1, GrPixel, NumPixel);
735 * \ingroup gdcmHeader
736 * \brief compares 2 Headers, according to DICOMDIR rules
737 * --> not-for-rats function
738 * \warning does NOT work with ACR-NEMA files
739 * \todo find a trick to solve the pb (use RET fields ?)
741 * @return true if 'smaller'
743 bool gdcmHeader::operator<(gdcmHeader &header){
747 s1=this->GetEntryByNumber(0x0010,0x0010);
748 s2=header.GetEntryByNumber(0x0010,0x0010);
756 s1=this->GetEntryByNumber(0x0010,0x0020);
757 s2=header.GetEntryByNumber(0x0010,0x0020);
764 // Study Instance UID
765 s1=this->GetEntryByNumber(0x0020,0x000d);
766 s2=header.GetEntryByNumber(0x0020,0x000d);
773 // Serie Instance UID
774 s1=this->GetEntryByNumber(0x0020,0x000e);
775 s2=header.GetEntryByNumber(0x0020,0x000e);
786 //-----------------------------------------------------------------------------
789 //-----------------------------------------------------------------------------
792 //-----------------------------------------------------------------------------