+2004-10-06 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+ * CLEANUP_ROUND (3) for gdcmPixelConvert (nightmare stage)
+ - src/gdcmRLEFramesInfo.[cxx|h], gdcmRLEFrame.h added
+ - src/gdcmDocument.[cxx|h] ::Parse7FE0 now sets up the RLEInfo.
+ - src/CMakeLists.txt: alphabetic order reodering + new entries.
+
2004-10-01 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* Added documentation of vtkgdcmReader on Website:
- testvtkGdcmReader.cxx renamed to vtkGdcmDemo.cxx (to be compatible
)
SET(libgdcm_la_SOURCES
- gdcmDirList.cxx
+ gdcmBinEntry.cxx
gdcmDebug.cxx
+ gdcmDicomDir.cxx
+ gdcmDicomDirElement.cxx
+ gdcmDicomDirImage.cxx
+ gdcmDicomDirMeta.cxx
+ gdcmDicomDirObject.cxx
+ gdcmDicomDirPatient.cxx
+ gdcmDicomDirSerie.cxx
+ gdcmDicomDirStudy.cxx
gdcmDict.cxx
gdcmDictEntry.cxx
gdcmDictSet.cxx
+ gdcmDirList.cxx
+ gdcmDocEntry.cxx
+ gdcmDocEntrySet.cxx
+ gdcmDocument.cxx
+ gdcmElementSet.cxx
gdcmException.cxx
+ gdcmFile.cxx
gdcmGlobal.cxx
+ gdcmHeader.cxx
+ gdcmHeaderHelper.cxx
gdcmJpeg12.cxx
gdcmJpeg2000.cxx
gdcmJpeg.cxx
- gdcmTS.cxx
- gdcmUtil.cxx
- gdcmVR.cxx
- gdcmFile.cxx
- gdcmHeader.cxx
- gdcmHeaderHelper.cxx
gdcmParsePixels.cxx
+ gdcmPixelConvert.cxx
gdcmRLE.cxx
- gdcmDocEntry.cxx
- gdcmDocEntrySet.cxx
- gdcmBinEntry.cxx
+ gdcmRLEFramesInfo.cxx
gdcmSeqEntry.cxx
gdcmSQItem.cxx
- gdcmElementSet.cxx
+ gdcmTS.cxx
+ gdcmUtil.cxx
gdcmValEntry.cxx
- gdcmDicomDirElement.cxx
- gdcmDocument.cxx
- gdcmDicomDir.cxx
- gdcmDicomDirMeta.cxx
- gdcmDicomDirPatient.cxx
- gdcmDicomDirStudy.cxx
- gdcmDicomDirSerie.cxx
- gdcmDicomDirImage.cxx
- gdcmDicomDirObject.cxx
- gdcmPixelConvert.cxx
+ gdcmVR.cxx
)
ADD_LIBRARY(gdcm ${libgdcm_la_SOURCES} )
Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:06 $
- Version: $Revision: 1.92 $
+ Date: $Date: 2004/10/06 09:58:08 $
+ Version: $Revision: 1.93 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmValEntry.h"
#include "gdcmBinEntry.h"
#include "gdcmSeqEntry.h"
-
#include "gdcmGlobal.h"
#include "gdcmUtil.h"
#include "gdcmDebug.h"
if (newDocEntry->GetGroup() == 0x7fe0 &&
newDocEntry->GetElement() == 0x0010 )
{
- if (newDocEntry->GetReadLength()==0xffffffff)
+ if ( newDocEntry->GetReadLength()==0xffffffff )
{
// Broken US.3405.1.dcm
Parse7FE0(); // to skip the pixels
return;
}
- // ---------------- for Parsing : Position on begining of Jpeg/RLE Pixels
+ // Encoded pixel data: for the time being we are only concerned with
+ // Jpeg or RLE Pixel data encodings.
+ // As stated in ps-3.3, 8.2:
+ // "If sent in Encapsulated Format (i.e. other than the Narive Format) the
+ // value representation OB is used".
+ // Hence we expect an OB value representation. Concerning OB VR,
+ // the section PS3.3, A.4.c (p58 and p59), states:
+ // "For the Value Representations OB and OW, the encoding shall meet the
+ // following specifications depending on the Data element tag:"
+ // [...snip...]
+ // - the first item in the sequence of items before the encoded pixel
+ // data stream shall be basic offset table item. The basic offset table
+ // item value, however, is not required to be present"
//// Read the Basic Offset Table Item Tag length...
uint32_t itemLength = ReadTagLength(0xfffe, 0xe000);
- //// ... and then read length[s] itself[themselves]. We don't use
- // the values read (BTW what is the purpous of those lengths ?)
+ // When present, read the basic offset table itself.
+ // Notes: - since the presence of this basic offset table is optional
+ // we can't rely on it for the implementation, and we will simply
+ // trash it's content (when present).
+ // - still, when present, we could add some further checks on the
+ // lengths, but not bother with such fuses for the time being.
if ( itemLength != 0 )
{
- // BTW, what is the purpous of those length anyhow !?
char* basicOffsetTableItemValue = new char[itemLength + 1];
fread(basicOffsetTableItemValue, itemLength, 1, Fp);
for (unsigned int i=0; i < itemLength; i += 4 )
{
- uint32_t individualLength = str2num(&basicOffsetTableItemValue[i],uint32_t);
+ uint32_t individualLength = str2num( &basicOffsetTableItemValue[i],
+ uint32_t);
std::ostringstream s;
s << " Read one length: ";
s << std::hex << individualLength << std::endl;
}
else
{
- // RLE Image
- long ftellRes;
- long rleSegmentLength[15], fragmentLength;
-
- // While we find some items:
- while ( (fragmentLength = ReadTagLength(0xfffe, 0xe000)) )
+ // Encapsulated RLE Compressed Images (see PS-3.3, Annex G).
+ // Loop on the frame[s] and store the parsed information in a
+ // gdcmRLEFramesInfo.
+ long frameLength;
+
+ // Loop on the individual frame[s] and store the information
+ // on the RLE fragments in a gdcmRLEFramesInfo.
+ // Note: - when only a single frame is present, this is a
+ // classical image.
+ // - when more than one frame are present, then we are in
+ // the case of a multi-frame image.
+ while ( (frameLength = ReadTagLength(0xfffe, 0xe000)) )
{
- // Parse fragments of the current Fragment (Frame)
- //------------------ scanning (not reading) fragment pixels
+ // Parse the RLE Header and store the corresponding RLE Segment
+ // Offset Table information on fragments of this current Frame.
+ // Note that the fragment pixels themselves are not loaded
+ // (but just skipped).
uint32_t nbRleSegments = ReadInt32();
- //// Reading RLE Segments Offset Table
uint32_t rleSegmentOffsetTable[15];
- for(int k=1; k<=15; k++)
+ long ftellRes;
+ for( int k = 1; k <= 15; k++ )
{
ftellRes = ftell(Fp);
rleSegmentOffsetTable[k] = ReadInt32();
}
+ // Deduce from both the RLE Header and the frameLength the
+ // fragment length, and again store this infor in a
+ // gdcmRLEFramesInfo.
+ long rleSegmentLength[15];
// skipping (not reading) RLE Segments
if ( nbRleSegments > 1)
{
}
}
- rleSegmentLength[nbRleSegments] = fragmentLength
- - rleSegmentOffsetTable[nbRleSegments];
+ rleSegmentLength[nbRleSegments] = frameLength
+ - rleSegmentOffsetTable[nbRleSegments];
ftellRes = ftell(Fp);
SkipBytes(rleSegmentLength[nbRleSegments]);
+
+ // Store the collected info
+ gdcmRLEFrame* newFrameInfo = new gdcmRLEFrame;
+ newFrameInfo->NumberFragments = nbRleSegments;
+ for( unsigned int k = 1; k <= nbRleSegments; k++ )
+ {
+ newFrameInfo->Offset[k] = rleSegmentOffsetTable[k];
+ newFrameInfo->Length[k] = rleSegmentLength[k];
+ }
+ RLEInfo.Frames.push_back( newFrameInfo );
}
// Make sure that at the end of the item we encounter a 'Sequence
Program: gdcm
Module: $RCSfile: gdcmDocument.h,v $
Language: C++
- Date: $Date: 2004/09/27 08:39:07 $
- Version: $Revision: 1.44 $
+ Date: $Date: 2004/10/06 09:58:08 $
+ Version: $Revision: 1.45 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmException.h"
#include "gdcmDictSet.h"
#include "gdcmDocEntry.h"
+#include "gdcmRLEFramesInfo.h"
class gdcmValEntry;
class gdcmBinEntry;
/// \ref gdcmDocument::SetMaxSizePrintEntry()
static const unsigned int MAX_SIZE_PRINT_ELEMENT_VALUE;
- /// Will be set 1 if user asks to 'go inside' the 'sequences' (VR = "SQ")
- int EnableSequences;
+ /// Store the RLE frames info obtained during parsing of pixels.
+ gdcmRLEFramesInfo RLEInfo;
/// \brief Amount of printed details for each Header Entry (Dicom Element):
/// 0 : stands for the least detail level.
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmRLEFrame.h,v $
+ Language: C++
+ Date: $Date: 2004/10/06 09:58:08 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef GDCMRLEFRAME_H
+#define GDCMRLEFRAME_H
+
+#include "gdcmCommon.h"
+
+/**
+ * \brief Utility class for summerizing the informations of a SINGLE RLE
+ * frame of an "Encapsulated RLE Compressed Image" (see PS-3.3 annex G).
+ * This information is a mix of:
+ * - the RLE Header (see PS-3.3 section G5) and
+ * - the lengths of each RLE segment [ which can be decuded from
+ * both the above RLE Header and the itemlength of the frame).
+ *
+ * Each instance of this class (they can be as many instances for
+ * a given gdcmDocument as they are frames and they are collected in
+ * a \ref gdcmRLEFramesInfo ) describes :
+ * - the total number of segments (up to 15),
+ * - the offsets of each segment of the frame,
+ * - the (corresponding) lengths of each segment of the frame.
+ */
+class GDCM_EXPORT gdcmRLEFrame
+{
+friend class gdcmDocument;
+friend class gdcmFile;
+ int NumberFragments;
+ uint8_t Offset[15];
+ long Length[15];
+ gdcmRLEFrame() { NumberFragments = 0; }
+
+};
+
+//-----------------------------------------------------------------------------
+#endif
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmRLEFramesInfo.cxx,v $
+ Language: C++
+ Date: $Date: 2004/10/06 09:58:08 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "gdcmRLEFramesInfo.h"
+
+gdcmRLEFramesInfo::~gdcmRLEFramesInfo()
+{
+ for(RLEFrameList::iterator it = Frames.begin(); it != Frames.end(); ++it)
+ {
+ delete (*it);
+ }
+ Frames.clear();
+}
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: gdcmRLEFramesInfo.h,v $
+ Language: C++
+ Date: $Date: 2004/10/06 09:58:08 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef GDCMRLEFRAMESINFO_H
+#define GDCMRLEFRAMESINFO_H
+
+#include "gdcmRLEFrame.h"
+#include <list>
+
+/**
+ * \brief Utility class for gathering the informations of the collection
+ * of RLE frame[s] (see \ref gdcmRLEFrame) when handling
+ * "Encapsulated RLE Compressed Images" (see PS-3.3 annex G).
+ * Note: a classical image can be considered as the degenerated case
+ * of a multiframe image. In this case the collection is limited
+ * to a single individual frame.
+ * The informations on each frame are obtained during the parsing
+ * of a gdcmDocument (refer to \ref gdcmDocument::Parse7FE0() ).
+ * They shall be used when (if necessary) decoding the frames.
+ *
+ * This class is simply a stl list<> of \ref gdcmRLEFrame.
+ */
+class GDCM_EXPORT gdcmRLEFramesInfo
+{
+ typedef std::list< gdcmRLEFrame* > RLEFrameList;
+friend class gdcmDocument;
+friend class gdcmFile;
+ RLEFrameList Frames;
+public:
+ ~gdcmRLEFramesInfo();
+};
+
+//-----------------------------------------------------------------------------
+#endif