6 #include "gdcmCommon.h"
7 #include "gdcmHeader.h"
9 ////////////////////////////////////////////////////////////////////////////
10 // In addition to Dicom header exploration, this class is designed
11 // for accessing the image/volume content. One can also use it to
14 class GDCM_EXPORT gdcmFile: public gdcmHeader
18 size_t lgrTotaleRaw; // Area length to receive the pixels
19 size_t lgrTotale; // Area length to receive the RGB pixels
20 // from Grey Plane + Palette Color
22 int Parsed; // weather already parsed
23 std::string OrigFileName; // To avoid file overwrite
24 void SwapZone(void* im, int swap, int lgr, int nb);
26 bool ReadPixelData(void * destination);
28 int gdcm_read_JPEG_file (void * image_buffer); // For JPEG 8 Bits
29 int gdcm_read_JPEG_file12 (void * image_buffer); // For JPEG 12 Bits
30 int gdcm_read_JPEG2000_file (void * image_buffer); // For JPEG 2000 (TODO)
32 // For Run Length Encoding (TOCHECK)
33 int gdcm_read_RLE_file (void * image_buffer);
37 int WriteBase(std::string FileName, FileType type);
39 gdcmFile(std::string & filename);
40 gdcmFile(const char * filename);
42 // For promotion (performs a deepcopy of pointed header object)
43 // TODO Swig gdcmFile(gdcmHeader* header);
44 // TODO Swig ~gdcmFile();
46 // On writing purposes. When instance was created through
47 // gdcmFile(std::string filename) then the filename argument MUST be
48 // different from the constructor's one (no overwriting allowed).
49 // TODO Swig int SetFileName(std::string filename);
51 void SetPixelDataSizeFromHeader(void);
52 size_t GetImageDataSize();
53 size_t GetImageDataSizeRaw();
54 void * GetImageData();
55 size_t GetImageDataIntoVector(void* destination, size_t MaxSize);
56 void * GetImageDataRaw();
57 size_t GetImageDataIntoVectorRaw(void* destination, size_t MaxSize);
59 // Allocates ExpectedSize bytes of memory at this->Data and copies the
60 // pointed data to it. Copying the image might look useless but
61 // the caller might destroy it's image (without knowing it: think
62 // of a complicated interface where display is done with a library
63 // e.g. VTK) before calling the Write
64 int SetImageData (void * Data, size_t ExpectedSize);
65 // When the caller is aware we simply point to the data:
66 // TODO int SetImageDataNoCopy (void * Data, size_t ExpectedSize);
67 void SetImageDataSize (size_t ExpectedSize);
70 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
71 // incohérente avec l'ordre des octets en mémoire ?
72 // TODO Swig int Write();
74 // Ecrit sur disque les pixels d'UNE image
75 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
76 // Ca sera à l'utilisateur d'appeler son Reader correctement
78 int WriteRawData (std::string fileName);
79 int WriteDcmImplVR(std::string fileName);
80 int WriteDcmImplVR(const char * fileName);
81 int WriteDcmExplVR(std::string fileName);
82 int WriteAcr (std::string fileName);
84 bool ParsePixelData(void);