+ Group0002Parsed = false;
+
+ gdcmWarningMacro( "Starting parsing of file: " << Filename.c_str());
+
+ Fp->seekg(0, std::ios::end);
+ long lgt = Fp->tellg(); // total length of the file
+
+ Fp->seekg(0, std::ios::beg);
+
+ // CheckSwap returns a boolean
+ // (false if no swap info of any kind was found)
+ if (! CheckSwap() )
+ {
+ gdcmWarningMacro( "Neither a DICOM V3 nor an ACR-NEMA file: "
+ << Filename.c_str());
+ CloseFile();
+ return ;
+ }
+
+ long beg = Fp->tellg(); // just after DICOM preamble (if any)
+
+ lgt -= beg; // remaining length to parse
+
+ ParseDES( this, beg, lgt, false); // Loading is done during parsing
+
+ if ( IsEmpty() )
+ {
+ gdcmWarningMacro( "No tag in internal hash table for: "
+ << Filename.c_str());
+ CloseFile();
+ return ;
+ }
+ IsDocumentAlreadyLoaded = true;
+
+ Fp->seekg( 0, std::ios::beg);
+
+ // Load 'non string' values
+
+ std::string PhotometricInterpretation = GetEntryValue(0x0028,0x0004);
+ if( PhotometricInterpretation == "PALETTE COLOR " )
+ {
+ LoadEntryBinArea(0x0028,0x1200); // gray LUT
+ /// FIXME FIXME FIXME
+ /// The tags refered by the three following lines used to be CORRECTLY
+ /// defined as having an US Value Representation in the public
+ /// dictionary. BUT the semantics implied by the three following
+ /// lines state that the corresponding tag contents are in fact
+ /// the ones of a BinEntry.
+ /// In order to fix things "Quick and Dirty" the dictionary was
+ /// altered on PURPOSE but now contains a WRONG value.
+ /// In order to fix things and restore the dictionary to its
+ /// correct value, one needs to decided of the semantics by deciding
+ /// whether the following tags are either:
+ /// - multivaluated US, and hence loaded as ValEntry, but afterwards
+ /// also used as BinEntry, which requires the proper conversion,
+ /// - OW, and hence loaded as BinEntry, but afterwards also used
+ /// as ValEntry, which requires the proper conversion.
+ LoadEntryBinArea(0x0028,0x1201); // R LUT
+ LoadEntryBinArea(0x0028,0x1202); // G LUT
+ LoadEntryBinArea(0x0028,0x1203); // B LUT
+
+ // Segmented Red Palette Color LUT Data
+ LoadEntryBinArea(0x0028,0x1221);
+ // Segmented Green Palette Color LUT Data
+ LoadEntryBinArea(0x0028,0x1222);
+ // Segmented Blue Palette Color LUT Data
+ LoadEntryBinArea(0x0028,0x1223);
+ }
+ //FIXME later : how to use it?
+ LoadEntryBinArea(0x0028,0x3006); //LUT Data (CTX dependent)
+
+ CloseFile();
+
+ // ----------------------------
+ // Specific code to allow gdcm to read ACR-LibIDO formated images
+ // Note: ACR-LibIDO is an extension of the ACR standard that was
+ // used at CREATIS. For the time being (say a couple years)
+ // we keep this kludge to allow CREATIS users
+ // reading their old images.
+ //
+ // if recognition code tells us we deal with a LibIDO image
+ // we switch lineNumber and columnNumber
+ //
+ std::string RecCode;
+ RecCode = GetEntryValue(0x0008, 0x0010); // recognition code (RET)
+ if (RecCode == "ACRNEMA_LIBIDO_1.1" ||
+ RecCode == "CANRME_AILIBOD1_1." ) // for brain-damaged softwares
+ // with "little-endian strings"
+ {
+ Filetype = ACR_LIBIDO;
+ std::string rows = GetEntryValue(0x0028, 0x0010);
+ std::string columns = GetEntryValue(0x0028, 0x0011);
+ SetValEntry(columns, 0x0028, 0x0010);
+ SetValEntry(rows , 0x0028, 0x0011);
+ }
+ // --- End of ACR-LibIDO kludge ---