- * \brief constructor
- * @param inFilename file to be opened for parsing
- * @param exception_on_error whether we throw an exception or not
- * @param enable_sequences = true to allow the header
- * to be parsed *inside* the SeQuences,
- * when they have an actual length
- * \warning enable_sequences *has to be* true for reading PAPYRUS 3.0 files
- * @param ignore_shadow to allow skipping the shadow elements,
- * to save memory space.
- * \warning The TRUE value for this param has to be used
- * with a FALSE value for the 'enable_sequence' param.
- * ('public elements' may be embedded in 'shadow Sequences')
- */
-gdcmDocument::gdcmDocument( std::string const & filename,
- bool exception_on_error,
- bool enable_sequences,
- bool ignore_shadow)
- : gdcmElementSet(-1)
-{
- IgnoreShadow = ignore_shadow;
- //EnableSequences=enable_sequences;
- (void)enable_sequences;
- EnableSequences = true; // JPR // TODO : remove params out of the constructor
- SetMaxSizeLoadEntry(MAX_SIZE_LOAD_ELEMENT_VALUE);
- Filename = filename;
- Initialise();
-
- if ( !OpenFile(exception_on_error))
- {
- return;
- }
-
- dbg.Verbose(0, "gdcmDocument::gdcmDocument: starting parsing of file: ",
- Filename.c_str());
- rewind(Fp);
-
- fseek(Fp,0L,SEEK_END);
- long lgt = ftell(Fp);
-
- rewind(Fp);
- CheckSwap();
- long beg = ftell(Fp);
- lgt -= beg;
-
- SQDepthLevel=0;
-
- long l = ParseDES( this, beg, lgt, false); // le Load sera fait a la volee
- (void)l; //is l used anywhere ?
-
- rewind(Fp);
-
- // Load 'non string' values
-
- std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);
- if( PhotometricInterpretation == "PALETTE COLOR " )
- {
- LoadEntryVoidArea(0x0028,0x1200); // gray LUT
- LoadEntryVoidArea(0x0028,0x1201); // R LUT
- LoadEntryVoidArea(0x0028,0x1202); // G LUT
- LoadEntryVoidArea(0x0028,0x1203); // B LUT
-
- LoadEntryVoidArea(0x0028,0x1221); // Segmented Red Palette Color LUT Data
- LoadEntryVoidArea(0x0028,0x1222); // Segmented Green Palette Color LUT Data
- LoadEntryVoidArea(0x0028,0x1223); // Segmented Blue Palette Color LUT Data
- }
- //FIXME later : how to use it?
- LoadEntryVoidArea(0x0028,0x3006); //LUT Data (CTX dependent)
-
- CloseFile();
-
- // --------------------------------------------------------------
- // Special Patch to allow gdcm to read ACR-LibIDO formated images
- //
- // if recognition code tells us we deal with a LibIDO image
- // we switch lineNumber and columnNumber
- //
- std::string RecCode;
- RecCode = GetEntryByNumber(0x0008, 0x0010); // recognition code
- if (RecCode == "ACRNEMA_LIBIDO_1.1" ||
- RecCode == "CANRME_AILIBOD1_1." ) // for brain-damaged softwares
- // with "little-endian strings"
- {
- Filetype = gdcmACR_LIBIDO;
- std::string rows = GetEntryByNumber(0x0028, 0x0010);
- std::string columns = GetEntryByNumber(0x0028, 0x0011);
- SetEntryByNumber(columns, 0x0028, 0x0010);
- SetEntryByNumber(rows , 0x0028, 0x0011);
- }
- // ----------------- End of Special Patch ----------------
-
- PrintLevel = 1; // 'Medium' print level by default
-}
-
-/**
- * \brief constructor
- * @param exception_on_error