2 //-----------------------------------------------------------------------------
3 #include "gdcmHeader.h"
7 #include <cctype> // for isalpha
12 //-----------------------------------------------------------------------------
13 // Refer to gdcmHeader::CheckSwap()
14 //const unsigned int gdcmHeader::HEADER_LENGTH_TO_READ = 256;
16 // Refer to gdcmHeader::SetMaxSizeLoadEntry()
17 //const unsigned int gdcmHeader::MAX_SIZE_LOAD_ELEMENT_VALUE = 4096;
19 //-----------------------------------------------------------------------------
20 // Constructor / Destructor
25 * @param exception_on_error
26 * @param enable_sequences = true to allow the header
27 * to be parsed *inside* the SeQuences,
28 * when they have an actual length
29 * @param ignore_shadow = true if user wants to skip shadow groups
30 during parsing, to save memory space
31 *\TODO : may be we need one more bool,
32 * to allow skipping the private elements while parsing the header
33 * in order to save space
35 gdcmHeader::gdcmHeader(const char *InFilename,
36 bool exception_on_error,
37 bool enable_sequences,
39 gdcmParser(InFilename,exception_on_error,enable_sequences,ignore_shadow)
46 * @param exception_on_error
48 gdcmHeader::gdcmHeader(bool exception_on_error) :
49 gdcmParser(exception_on_error)
55 * \brief Canonical destructor.
57 gdcmHeader::~gdcmHeader (void) {
60 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
67 * \brief This predicate, based on hopefully reasonable heuristics,
68 * decides whether or not the current gdcmParser was properly parsed
69 * and contains the mandatory information for being considered as
70 * a well formed and usable Dicom/Acr File.
71 * @return true when gdcmParser is the one of a reasonable Dicom/Acr file,
74 bool gdcmHeader::IsReadable(void) {
75 if(!gdcmParser::IsReadable())
78 std::string res = GetEntryByNumber(0x0028, 0x0005);
79 if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
80 return false; // Image Dimensions
81 if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
82 return false; // "Bits Allocated"
83 if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
84 return false; // "Bits Stored"
85 if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
86 return false; // "High Bit"
87 if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
88 return false; // "Pixel Representation"
94 * \brief Determines if the Transfer Syntax was already encountered
95 * and if it corresponds to a JPEGBaseLineProcess1 one.
97 * @return True when JPEGBaseLineProcess1found. False in all other cases.
99 bool gdcmHeader::IsJPEGBaseLineProcess1TransferSyntax(void) {
100 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
103 LoadHeaderEntrySafe(Element);
105 std::string Transfer = Element->GetValue();
106 if ( Transfer == "1.2.840.10008.1.2.4.50" )
112 * \ingroup gdcmHeader
113 * \brief Determines if the Transfer Syntax was already encountered
114 * and if it corresponds to a JPEGExtendedProcess2-4 one.
116 * @return True when JPEGExtendedProcess2-4 found. False in all other cases.
118 bool gdcmHeader::IsJPEGExtendedProcess2_4TransferSyntax(void) {
119 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
122 LoadHeaderEntrySafe(Element);
123 return ( Element->GetValue() == "1.2.840.10008.1.2.4.51" );
127 * \ingroup gdcmHeader
128 * \brief Determines if the Transfer Syntax was already encountered
129 * and if it corresponds to a JPEGExtendeProcess3-5 one.
131 * @return True when JPEGExtendedProcess3-5 found. False in all other cases.
133 bool gdcmHeader::IsJPEGExtendedProcess3_5TransferSyntax(void) {
134 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
137 LoadHeaderEntrySafe(Element);
139 std::string Transfer = Element->GetValue();
140 if ( Transfer == "1.2.840.10008.1.2.4.52" )
146 * \ingroup gdcmHeader
147 * \brief Determines if the Transfer Syntax was already encountered
148 * and if it corresponds to a JPEGSpectralSelectionProcess6-8 one.
150 * @return True when JPEGSpectralSelectionProcess6-8 found. False in all
153 bool gdcmHeader::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) {
154 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
157 LoadHeaderEntrySafe(Element);
159 std::string Transfer = Element->GetValue();
160 if ( Transfer == "1.2.840.10008.1.2.4.53" )
166 * \ingroup gdcmHeader
167 * \brief Determines if the Transfer Syntax was already encountered
168 * and if it corresponds to a RLE Lossless one.
170 * @return True when RLE Lossless found. False in all
173 bool gdcmHeader::IsRLELossLessTransferSyntax(void) {
174 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
177 LoadHeaderEntrySafe(Element);
179 std::string Transfer = Element->GetValue();
180 if ( Transfer == "1.2.840.10008.1.2.5" ) {
187 * \ingroup gdcmHeader
188 * \brief Determines if Transfer Syntax was already encountered
189 * and if it corresponds to a JPEG Lossless one.
191 * @return True when RLE Lossless found. False in all
194 bool gdcmHeader::IsJPEGLossless(void) {
195 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
196 // faire qq chose d'intelligent a la place de ça
199 LoadHeaderEntrySafe(Element);
201 const char * Transfert = Element->GetValue().c_str();
202 if ( memcmp(Transfert+strlen(Transfert)-2 ,"70",2)==0) return true;
203 if ( memcmp(Transfert+strlen(Transfert)-2 ,"55",2)==0) return true;
204 if (Element->GetValue() == "1.2.840.10008.1.2.4.57") return true;
210 * \ingroup gdcmHeader
211 * \brief Determines if the Transfer Syntax was already encountered
212 * and if it corresponds to a JPEG200 one.0
214 * @return True when JPEG2000 (Lossly or LossLess) found. False in all
217 bool gdcmHeader::IsJPEG2000(void) {
218 gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
221 LoadHeaderEntrySafe(Element);
223 std::string Transfer = Element->GetValue();
224 if ( (Transfer == "1.2.840.10008.1.2.4.90")
225 || (Transfer == "1.2.840.10008.1.2.4.91") )
231 * \ingroup gdcmHeader
232 * \brief Predicate for dicom version 3 file.
233 * @return True when the file is a dicom version 3.
235 bool gdcmHeader::IsDicomV3(void) {
236 // Checking if Transfert Syntax exists is enough
237 return (GetHeaderEntryByNumber(0x0002, 0x0010) != NULL);
241 * \ingroup gdcmHeader
242 * \brief Retrieve the number of columns of image.
243 * @return The encountered size when found, 0 by default.
244 * 0 means the file is NOT USABLE. The caller will have to check
246 int gdcmHeader::GetXSize(void) {
248 StrSize = GetEntryByNumber(0x0028,0x0011);
249 if (StrSize == GDCM_UNFOUND)
251 return atoi(StrSize.c_str());
255 * \ingroup gdcmHeader
256 * \brief Retrieve the number of lines of image.
257 * \warning The defaulted value is 1 as opposed to gdcmHeader::GetXSize()
258 * @return The encountered size when found, 1 by default
259 * (The file contains a Signal, not an Image).
261 int gdcmHeader::GetYSize(void) {
262 std::string StrSize = GetEntryByNumber(0x0028,0x0010);
263 if (StrSize != GDCM_UNFOUND)
264 return atoi(StrSize.c_str());
268 // The Rows (0028,0010) entry was optional for ACR/NEMA. It might
269 // hence be a signal (1d image). So we default to 1:
274 * \ingroup gdcmHeader
275 * \brief Retrieve the number of planes of volume or the number
276 * of frames of a multiframe.
277 * \warning When present we consider the "Number of Frames" as the third
278 * dimension. When absent we consider the third dimension as
279 * being the "Planes" tag content.
280 * @return The encountered size when found, 1 by default (single image).
282 int gdcmHeader::GetZSize(void) {
283 // Both DicomV3 and ACR/Nema consider the "Number of Frames"
284 // as the third dimension.
285 std::string StrSize = GetEntryByNumber(0x0028,0x0008);
286 if (StrSize != GDCM_UNFOUND)
287 return atoi(StrSize.c_str());
289 // We then consider the "Planes" entry as the third dimension [we
290 // cannot retrieve by name since "Planes tag is present both in
291 // IMG (0028,0012) and OLY (6000,0012) sections of the dictionary].
292 StrSize = GetEntryByNumber(0x0028,0x0012);
293 if (StrSize != GDCM_UNFOUND)
294 return atoi(StrSize.c_str());
299 * \ingroup gdcmHeader
300 * \brief Retrieve the number of Bits Stored (actually used)
301 * (as opposite to number of Bits Allocated)
303 * @return The encountered number of Bits Stored, 0 by default.
304 * 0 means the file is NOT USABLE. The caller has to check it !
306 int gdcmHeader::GetBitsStored(void) {
307 std::string StrSize = GetEntryByNumber(0x0028,0x0101);
308 if (StrSize == GDCM_UNFOUND)
309 return 0; // It's supposed to be mandatory
310 // the caller will have to check
311 return atoi(StrSize.c_str());
315 * \ingroup gdcmHeader
316 * \brief Retrieve the number of Bits Allocated
317 * (8, 12 -compacted ACR-NEMA files, 16, ...)
319 * @return The encountered number of Bits Allocated, 0 by default.
320 * 0 means the file is NOT USABLE. The caller has to check it !
322 int gdcmHeader::GetBitsAllocated(void) {
323 std::string StrSize = GetEntryByNumber(0x0028,0x0100);
324 if (StrSize == GDCM_UNFOUND)
325 return 0; // It's supposed to be mandatory
326 // the caller will have to check
327 return atoi(StrSize.c_str());
331 * \ingroup gdcmHeader
332 * \brief Retrieve the number of Samples Per Pixel
333 * (1 : gray level, 3 : RGB -1 or 3 Planes-)
335 * @return The encountered number of Samples Per Pixel, 1 by default.
336 * (Gray level Pixels)
338 int gdcmHeader::GetSamplesPerPixel(void) {
339 std::string StrSize = GetEntryByNumber(0x0028,0x0002);
340 if (StrSize == GDCM_UNFOUND)
341 return 1; // Well, it's supposed to be mandatory ...
342 // but sometimes it's missing : we assume Gray pixels
343 return atoi(StrSize.c_str());
347 * \ingroup gdcmHeader
348 * \brief Retrieve the Planar Configuration for RGB images
349 * (0 : RGB Pixels , 1 : R Plane + G Plane + B Plane)
351 * @return The encountered Planar Configuration, 0 by default.
353 int gdcmHeader::GetPlanarConfiguration(void) {
354 std::string StrSize = GetEntryByNumber(0x0028,0x0006);
355 if (StrSize == GDCM_UNFOUND)
357 return atoi(StrSize.c_str());
361 * \ingroup gdcmHeader
362 * \brief Return the size (in bytes) of a single pixel of data.
363 * @return The size in bytes of a single pixel of data; 0 by default
364 * 0 means the file is NOT USABLE; the caller will have to check
366 int gdcmHeader::GetPixelSize(void) {
367 std::string PixelType = GetPixelType();
368 if (PixelType == "8U" || PixelType == "8S")
370 if (PixelType == "16U" || PixelType == "16S")
372 if (PixelType == "32U" || PixelType == "32S")
374 dbg.Verbose(0, "gdcmHeader::GetPixelSize: Unknown pixel type");
379 * \ingroup gdcmHeader
380 * \brief Build the Pixel Type of the image.
381 * Possible values are:
382 * - 8U unsigned 8 bit,
384 * - 16U unsigned 16 bit,
385 * - 16S signed 16 bit,
386 * - 32U unsigned 32 bit,
387 * - 32S signed 32 bit,
388 * \warning 12 bit images appear as 16 bit.
389 * \ 24 bit images appear as 8 bit
390 * @return 0S if nothing found. NOT USABLE file. The caller has to check
392 std::string gdcmHeader::GetPixelType(void) {
393 std::string BitsAlloc = GetEntryByNumber(0x0028, 0x0100); // Bits Allocated
394 if (BitsAlloc == GDCM_UNFOUND) {
395 dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Bits Allocated");
396 BitsAlloc = std::string("16");
398 if (BitsAlloc == "12") // It will be unpacked
399 BitsAlloc = std::string("16");
400 else if (BitsAlloc == "24") // (in order no to be messed up
401 BitsAlloc = std::string("8"); // by old RGB images)
403 std::string Signed = GetEntryByNumber(0x0028, 0x0103); // "Pixel Representation"
404 if (Signed == GDCM_UNFOUND) {
405 dbg.Verbose(0, "gdcmHeader::GetPixelType: unfound Pixel Representation");
406 BitsAlloc = std::string("0");
409 Signed = std::string("U");
411 Signed = std::string("S");
413 return( BitsAlloc + Signed);
417 * \ingroup gdcmHeader
418 * \brief Recover the offset (from the beginning of the file)
419 * \ of *image* pixels (not *icone image* pixels, if any !)
421 size_t gdcmHeader::GetPixelOffset(void) {
422 // We may encounter the 'RETired' (0x0028, 0x0200) tag
423 // (Image Location") . This Element contains the number of
424 // the group that contains the pixel data (hence the "Pixel Data"
425 // is found by indirection through the "Image Location").
426 // Inside the group pointed by "Image Location" the searched element
427 // is conventionally the element 0x0010 (when the norm is respected).
428 // When the "Image Location" is absent we default to group 0x7fe0.
430 // If the element (0x0088,0x0200) 'icone image sequence' is found
431 // (grPixel,numPixel) is stored twice : the first one for the icon
432 // the second one for the image ...
433 // pb : sometimes , (0x0088,0x0200) exists, but doesn't contain *anything*
434 // see gdcmData/MxTwinLossLess.dcm ...
437 std::string ImageLocation = GetEntryByNumber(0x0028, 0x0200);
439 if ( ImageLocation == GDCM_UNFOUND ) { // Image Location
440 grPixel = 0x7fe0; // default value
442 grPixel = (guint16) atoi( ImageLocation.c_str() );
445 if (grPixel == 0xe07f) // sometimes Image Location value doesn't follow
446 grPixel = 0x7fe0; // the supposed processor endianity.
447 // see gdcmData/cr172241.dcm
449 if (grPixel != 0x7fe0)
450 // This is a kludge for old dirty Philips imager.
455 IterHT it = GetHeaderEntrySameNumber(grPixel,numPixel);
456 //std::string icone = GetEntryByNumber(0x0088,0x0200); //icone image sequence
457 TagKey key = gdcmDictEntry::TranslateToKey(grPixel,numPixel);
458 gdcmHeaderEntry* PixelElement;
460 if (tagHT.count(key) == 1)
461 PixelElement = (it.first)->second;
463 PixelElement = (++it.first)->second;
466 return PixelElement->GetOffset();
471 // TODO : unify those two (previous one and next one)
473 * \ingroup gdcmHeader
474 * \brief Recover the pixel area length (in Bytes)
475 * @return 0 by default. NOT USABLE file. The caller has to check.
477 size_t gdcmHeader::GetPixelAreaLength(void) {
478 // If this file complies with the norm we should encounter the
479 // "Image Location" tag (0x0028, 0x0200). This tag contains the
480 // the group that contains the pixel data (hence the "Pixel Data"
481 // is found by indirection through the "Image Location").
482 // Inside the group pointed by "Image Location" the searched element
483 // is conventionally the element 0x0010 (when the norm is respected).
484 // When the "Image Location" is absent we default to group 0x7fe0.
487 std::string ImageLocation = GetEntryByNumber(0x0028, 0x0200);
488 if ( ImageLocation == GDCM_UNFOUND ) { // Image Location
489 grPixel = 0x7fe0; // default value
491 grPixel = (guint16) atoi( ImageLocation.c_str() );
493 if (grPixel == 0xe07f) // sometimes group doesn't follow
494 grPixel = 0x7fe0; // the supposed processor endianity. see cr172241.dcm
496 if (grPixel != 0x7fe0)
497 // This is a kludge for old dirty Philips imager.
502 IterHT it = GetHeaderEntrySameNumber(grPixel,numPixel);
503 //std::string icone = GetEntryByNumber(0x0088,0x0200); //icone image sequence
504 TagKey key = gdcmDictEntry::TranslateToKey(grPixel,numPixel);
505 gdcmHeaderEntry* PixelElement;
507 if (tagHT.count(key) == 1)
508 PixelElement = (it.first)->second;
510 PixelElement = (++it.first)->second;
513 return PixelElement->GetLength();
515 std::cout << "Big trouble : Pixel Element ("
516 << std::hex << grPixel<<","<< numPixel<< ") NOT found"
523 * \ingroup gdcmHeader
524 * \brief tells us if LUT are used
525 * \warning Right now, 'Segmented xxx Palette Color Lookup Table Data'
526 * \ are NOT considered as LUT, since nobody knows
527 * \ how to deal with them
530 bool gdcmHeader::HasLUT(void) {
532 // Check the presence of the LUT Descriptors
535 if ( !GetHeaderEntryByNumber(0x0028,0x1101) )
537 // LutDescriptorGreen
538 if ( !GetHeaderEntryByNumber(0x0028,0x1102) )
541 if ( !GetHeaderEntryByNumber(0x0028,0x1103) )
544 // It is not enough :
547 // Red Palette Color Lookup Table Data
548 if ( !GetHeaderEntryByNumber(0x0028,0x1201) )
550 // Green Palette Color Lookup Table Data
551 if ( !GetHeaderEntryByNumber(0x0028,0x1202) )
553 // Blue Palette Color Lookup Table Data
554 if ( !GetHeaderEntryByNumber(0x0028,0x1203) )
560 * \ingroup gdcmHeader
561 * \brief gets the info from 0028,1101 : Lookup Table Desc-Red
563 * @return Lookup Table number of Bits , 0 by default
564 * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
566 int gdcmHeader::GetLUTNbits(void) {
567 std::vector<std::string> tokens;
571 //Just hope Lookup Table Desc-Red = Lookup Table Desc-Red = Lookup Table Desc-Blue
572 // Consistency already checked in GetLUTLength
573 std::string LutDescription = GetEntryByNumber(0x0028,0x1101);
574 if (LutDescription == GDCM_UNFOUND)
576 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
577 Tokenize (LutDescription, tokens, "\\");
578 //LutLength=atoi(tokens[0].c_str());
579 //LutDepth=atoi(tokens[1].c_str());
580 LutNbits=atoi(tokens[2].c_str());
586 * \ingroup gdcmHeader
587 * \brief builts Red/Green/Blue/Alpha LUT from Header
588 * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ]
589 * \ and (0028,1101),(0028,1102),(0028,1102)
590 * \ - xxx Palette Color Lookup Table Descriptor - are found
591 * \ and (0028,1201),(0028,1202),(0028,1202)
592 * \ - xxx Palette Color Lookup Table Data - are found
593 * \warning does NOT deal with :
594 * \ 0028 1100 Gray Lookup Table Descriptor (Retired)
595 * \ 0028 1221 Segmented Red Palette Color Lookup Table Data
596 * \ 0028 1222 Segmented Green Palette Color Lookup Table Data
597 * \ 0028 1223 Segmented Blue Palette Color Lookup Table Data
598 * \ no known Dicom reader deals with them :-(
599 * @return a RGBA Lookup Table
601 unsigned char * gdcmHeader::GetLUTRGBA(void) {
603 // http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
605 // if Photometric Interpretation # PALETTE COLOR, no LUT to be done
606 if (GetEntryByNumber(0x0028,0x0004) != "PALETTE COLOR ") {
609 int lengthR, debR, nbitsR;
610 int lengthG, debG, nbitsG;
611 int lengthB, debB, nbitsB;
613 // Get info from Lut Descriptors
614 // (the 3 LUT descriptors may be different)
615 std::string LutDescriptionR = GetEntryByNumber(0x0028,0x1101);
616 if (LutDescriptionR == GDCM_UNFOUND)
618 std::string LutDescriptionG = GetEntryByNumber(0x0028,0x1102);
619 if (LutDescriptionG == GDCM_UNFOUND)
621 std::string LutDescriptionB = GetEntryByNumber(0x0028,0x1103);
622 if (LutDescriptionB == GDCM_UNFOUND)
625 std::vector<std::string> tokens;
627 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
628 Tokenize (LutDescriptionR, tokens, "\\");
629 lengthR=atoi(tokens[0].c_str()); // Red LUT length in Bytes
630 debR =atoi(tokens[1].c_str()); // subscript of the first Lut Value
631 nbitsR =atoi(tokens[2].c_str()); // Lut item size (in Bits)
634 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
635 Tokenize (LutDescriptionG, tokens, "\\");
636 lengthG=atoi(tokens[0].c_str()); // Green LUT length in Bytes
637 debG =atoi(tokens[1].c_str()); // subscript of the first Lut Value
638 nbitsG =atoi(tokens[2].c_str()); // Lut item size (in Bits)
641 tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
642 Tokenize (LutDescriptionB, tokens, "\\");
643 lengthB=atoi(tokens[0].c_str()); // Blue LUT length in Bytes
644 debB =atoi(tokens[1].c_str()); // subscript of the first Lut Value
645 nbitsB =atoi(tokens[2].c_str()); // Lut item size (in Bits)
648 // Load LUTs into memory, (as they were stored on disk)
649 unsigned char *lutR = (unsigned char *)
650 GetEntryVoidAreaByNumber(0x0028,0x1201);
651 unsigned char *lutG = (unsigned char *)
652 GetEntryVoidAreaByNumber(0x0028,0x1202);
653 unsigned char *lutB = (unsigned char *)
654 GetEntryVoidAreaByNumber(0x0028,0x1203);
656 if (!lutR || !lutG || !lutB ) {
659 // forge the 4 * 8 Bits Red/Green/Blue/Alpha LUT
661 unsigned char *LUTRGBA = (unsigned char *)calloc(1024,1); // 256 * 4 (R, G, B, Alpha)
665 memset(LUTRGBA, 0, 1024);
668 std::string str_nb = GetEntryByNumber(0x0028,0x0100);
669 if (str_nb == GDCM_UNFOUND ) {
672 nb = atoi(str_nb.c_str() );
676 if (nbitsR==16 && nb==8) // when LUT item size is different than pixel size
677 mult=2; // high byte must be = low byte
678 else // See PS 3.3-2003 C.11.1.1.2 p 619
681 // if we get a black image, let's just remove the '+1'
682 // from 'i*mult+1' and check again
683 // if it works, we shall have to check the 3 Palettes
684 // to see which byte is ==0 (first one, or second one)
686 // We give up the checking to avoid some (useless ?)overhead
687 // (optimistic asumption)
692 for(i=0;i<lengthR;i++) {
697 for(i=0;i<lengthG;i++) {
702 for(i=0;i<lengthB;i++) {
708 *a = 1; // Alpha component
712 //How to free the now useless LUTs?
713 //free(LutR); free(LutB); free(LutG); // Seg Fault when used
718 * \ingroup gdcmHeader
719 * \brief gets the info from 0002,0010 : Transfert Syntax
721 * @return Transfert Syntax Name (as oposite to Transfert Syntax UID)
723 std::string gdcmHeader::GetTransfertSyntaxName(void) {
724 // use the gdcmTS (TS : Transfert Syntax)
725 std::string TransfertSyntax = GetEntryByNumber(0x0002,0x0010);
726 if (TransfertSyntax == GDCM_UNFOUND) {
727 dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName: unfound Transfert Syntax (0002,0010)");
728 return "Uncompressed ACR-NEMA";
730 // we do it only when we need it
731 gdcmTS * ts = gdcmGlobal::GetTS();
732 std::string tsName=ts->GetValue(TransfertSyntax);
733 //delete ts; // Seg Fault when deleted ?!
739 * \brief Sets the Pixel Area size in the Header
740 * --> not-for-rats function
742 * \warning WARNING doit-etre etre publique ?
743 * TODO : y aurait il un inconvenient à fusionner ces 2 fonctions
745 * @param ImageDataSize new Pixel Area Size
746 * warning : nothing else is checked
748 void gdcmHeader::SetImageDataSize(size_t ImageDataSize) {
749 std::string content1;
751 // Assumes HeaderEntry (0x7fe0, 0x0010) exists ...
752 // TODO define private members PixelGroupNumber, PicxelElementNumber
753 // update them, use them (only necessary for ACR-NEMA, not DICOM)
754 sprintf(car,"%d",ImageDataSize);
756 gdcmHeaderEntry *a = GetHeaderEntryByNumber(0x7fe0, 0x0010);
757 a->SetLength(ImageDataSize);
760 sprintf(car,"%d",ImageDataSize);
762 SetEntryByNumber(content1, 0x7fe0, 0x0000);
765 //-----------------------------------------------------------------------------
768 //-----------------------------------------------------------------------------
771 //-----------------------------------------------------------------------------