#include "gdcmFile.h"
#include "gdcmUtil.h"
#include "iddcmjpeg.h"
+using namespace std;
/////////////////////////////////////////////////////////////////
/**
SetPixelDataSizeFromHeader();
}
-
-/////////////////////////////////////////////////////////////////
/**
* \ingroup gdcmFile
* \brief calcule la longueur (in bytes) A ALLOUER pour recevoir les
*
* @return longueur a allouer
*/
-
void gdcmFile::SetPixelDataSizeFromHeader(void) {
int nb;
string str_nb;
/**
* \ingroup gdcmFile
- * \brief Accessor
+ * \brief Returns the size (in bytes) of required memory to hold
+ * the pixel data represented in this file.
+ * @return The size of pixel data in bytes.
*/
size_t gdcmFile::GetImageDataSize(void) {
return (lgrTotale);
}
-
/**
* \ingroup gdcmFile
* \brief Read pixel data from disk (optionaly decompressing) into the
IsExplicitVRLittleEndianTransferSyntax() ||
IsExplicitVRBigEndianTransferSyntax() ||
IsDeflatedExplicitVRLittleEndianTransferSyntax() ) {
-
- size_t ItemRead = fread(destination, lgrTotale, 1, fp);
- if ( ItemRead != 1 ) {
- CloseFile();
- return false;
- } else {
- CloseFile();
- return true;
- }
+
+ size_t ItemRead = fread(destination, lgrTotale, 1, fp);
+ if ( ItemRead != 1 ) {
+ CloseFile();
+ return false;
+ } else {
+ CloseFile();
+ return true;
+ }
}
if (IsJPEGLossless()) {
_IdDcmJpegFree (jpg);
CloseFile();
return true;
- }
-
+ }
+
printf ("Sorry, TransfertSyntax not yet taken into account ...\n");
CloseFile();
return false;
}
-/////////////////////////////////////////////////////////////////
/**
* \ingroup gdcmFile
* \brief Allocates necessary memory, copies the pixel data
- * (image[s]/volume[s]) to newly allocated zone and return a
- * pointer to it:
+ * (image[s]/volume[s]) to newly allocated zone.
+ * @return Pointer to newly allocated pixel data.
*/
void * gdcmFile::GetImageData (void) {
PixelData = (void *) malloc(lgrTotale);
return(PixelData);
}
-/////////////////////////////////////////////////////////////////
/**
- * \ingroup gdcmFile
- * \brief amene en mémoire dans une zone précisee par l'utilisateur
- * les Pixels d'une image
- *
- * @param destination
- * @param MaxSize
- *
- * @return The number of bytes actually copied.
+ * \ingroup gdcmFile
+ * \brief Copies at most MaxSize bytes of pixel data to caller's
+ * memory space.
+ * @param destination Address (in caller's memory space) at which the
+ * pixel data should be copied
+ * @param MaxSize Maximum number of bytes to be copied. When MaxSize
+ * is not sufficient to hold the pixel data the copy is not
+ * executed (i.e. no partial copy).
+ * @return On success, the number of bytes actually copied. Zero on
+ * failure e.g. MaxSize is lower than necessary.
*/
size_t gdcmFile::GetImageDataIntoVector (void* destination, size_t MaxSize) {
* \ingroup gdcmFile
* \brief TODO JPR
* \warning doit-etre etre publique ? FIXME JPR
+ * TODO : y a-t-il un inconvenient à fusioner ces 2 fonctions
*
* @param inData TODO JPR
* @param ExpectedSize TODO JPR
SetImageDataSize(ExpectedSize);
PixelData = inData;
lgrTotale = ExpectedSize;
+
+
return(1);
}
* \brief TODO JPR
* \
* \warning WARNING doit-etre etre publique ? FIXME JPR
+ * TODO : y aurait il un inconvenient à fusionner ces 2 fonctions
*
* @param ImageDataSize TODO JPR
*
void gdcmFile::SetImageDataSize(size_t ImageDataSize) {
string content1;
- string content2;
char car[20];
// suppose que le ElValue (0x7fe0, 0x0010) existe ...
sprintf(car,"%d",ImageDataSize);
- content2=car;
- SetPubElValByNumber(content2, 0x7fe0, 0x0010);
-
+
+ gdcmElValue*a = GetElValueByNumber(0x7fe0, 0x0010);
+ a->SetLength(ImageDataSize);
+
ImageDataSize+=8;
sprintf(car,"%d",ImageDataSize);
content1=car;