-
+// gdcmRLE.cxx
+//-----------------------------------------------------------------------------
#include <stdio.h>
#include "gdcmFile.h"
#include <ctype.h> /* to declare isprint() */
#define str2num(str, typeNum) *((typeNum *)(str))
-static int _gdcm_read_RLE_fragment (char ** image_buffer,
- long lengthToDecode,
- long uncompressedSegmentSize,
- FILE* fp);
-// static because nothing but gdcm_read_RLE_file may call it
-
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
/**
* \ingroup gdcmFile
* \brief Reads a 'Run Length Encoded' Dicom encapsulated file
+ * @param fp already open File Pointer
* @param image_buffer destination Address (in caller's memory space)
* at which the pixel data should be copied
*
- * @return int acts as a Boolean
+ * @return Boolean
*/
-
-// This is a debug version.
-// Forget the printf as they will be removed
-// as soon as the last Heuristics are checked
-
-// pb with RLE 16 Bits :
-
-
bool gdcmFile::gdcm_read_RLE_file (FILE *fp,void * image_buffer) {
long fragmentBegining; // for ftell, fseek
char * im = (char *)image_buffer;
RleSegmentLength[k]=RleSegmentOffsetTable[k+1]-RleSegmentOffsetTable[k];
ftellRes=ftell(fp);
fragmentBegining=ftell(fp);
- _gdcm_read_RLE_fragment (&im, RleSegmentLength[k],uncompressedSegmentSize,fp);
+ gdcm_read_RLE_fragment (&im, RleSegmentLength[k],uncompressedSegmentSize,fp);
fseek(fp,fragmentBegining,SEEK_SET);
fseek(fp,RleSegmentLength[k],SEEK_CUR);
}
RleSegmentLength[nbRleSegments] = fragmentLength - RleSegmentOffsetTable[nbRleSegments];
ftellRes=ftell(fp);
fragmentBegining=ftell(fp);
- _gdcm_read_RLE_fragment (&im, RleSegmentLength[nbRleSegments],uncompressedSegmentSize, fp);
+ gdcm_read_RLE_fragment (&im, RleSegmentLength[nbRleSegments],uncompressedSegmentSize, fp);
fseek(fp,fragmentBegining,SEEK_SET);
fseek(fp,RleSegmentLength[nbRleSegments],SEEK_CUR);
}
- /* -------------------------------------------------------------------- */
- //
- // RLE LossLess Fragment
- //
- /* -------------------------------------------------------------------- */
-
- // static because nothing but gdcm_read_RLE_file can call it
- // DO NOT doxygen !
-
-static int
-_gdcm_read_RLE_fragment (char ** areaToRead,
- long lengthToDecode,
- long uncompressedSegmentSize,
- FILE* fp) {
+// ----------------------------------------------------------------------------
+// RLE LossLess Fragment
+int gdcmFile::gdcm_read_RLE_fragment(char **areaToRead, long lengthToDecode,
+ long uncompressedSegmentSize, FILE *fp) {
long ftellRes;
int count;
long numberOfOutputBytes=0;
ftellRes =ftell(fp);
while(numberOfOutputBytes<uncompressedSegmentSize) {
-
ftellRes =ftell(fp);
fread(&n,sizeof(char),1,fp);
count=n;
}
return 1;
}
+
+// ----------------------------------------------------------------------------